# BloomText API documentation > Full text of every page at https://www.bloomtext.com/developers/api/. Base URL https://api.bloomtext.com/v1. OpenAPI spec: https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml. # BloomText API > Bring BloomText into your own software: patient texting and patient records, and staff provisioning across your account's organizations, with an API key and a downloadable OpenAPI spec. Source: https://www.bloomtext.com/developers/api/ The BloomText API brings your BloomText account into your own software: text patients and read their replies, keep patient records in step with your EHR, and keep staff, organizations and teams in step with your HR or identity system. An account's Owners and IT create API keys and choose the organizations each one reaches. - Patient API (API key): [quickstart](https://www.bloomtext.com/developers/api/patient-api-quickstart/) - OAuth (a person's own conversations): [quickstart](https://www.bloomtext.com/developers/api/oauth-quickstart/) ## What you can build ## How it works Your server texts a patient and reads the reply with an API key. No one signs in. ```mermaid sequenceDiagram participant Server as Your server participant BT as BloomText participant Patient Server->>BT: POST /patient-messages to a phone number (API key) BT->>Patient: Secure link (or SMS) from the clinic's number Patient->>BT: Reply Server->>BT: GET /patient-messages?after=…&q=from:patient BT-->>Server: The patient's reply ``` 1. BloomText turns on API access for your account, and an Owner or IT person [creates an API key](https://www.bloomtext.com/developers/api/api-keys/) under **Settings → Account → API keys**, choosing its scopes and the organizations it reaches. 2. Your server [messages patients](https://www.bloomtext.com/developers/api/send-messages/), [manages patient records](https://www.bloomtext.com/developers/api/patients/), and keeps [staff and teams](https://www.bloomtext.com/developers/api/members-api/) in step with your HR or identity system. 3. If your staff sign in with Okta, [SSO and Directory Sync](https://www.bloomtext.com/developers/api/identity-and-sso/) can manage people instead, and the API sees who manages each membership. ## The OpenAPI spec Every endpoint is described in an OpenAPI spec you can download, feed to a client generator, or import into tools like Okta Workflows and Postman. The [API reference](https://www.bloomtext.com/developers/api/reference/) is generated from it. Download the OpenAPI spec: [OpenAPI 3.1 (YAML)](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml), [OpenAPI 3.1 (JSON)](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.json), [OpenAPI 3.0](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-3.0.yaml) (Okta Workflows), [Swagger 2.0](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-2.0.yaml) (Power Automate), and a [Postman collection](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json). ## Turned on when you ask Some features are turned on per account when you ask. They're documented in full, and each page has a **Request access** button that books a call: [webhooks](https://www.bloomtext.com/developers/api/webhooks/), [API identities](https://www.bloomtext.com/developers/api/api-identity/), [phone-number limits on keys](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers), [campaigns](https://www.bloomtext.com/developers/api/campaigns/), [patient imports](https://www.bloomtext.com/developers/api/patients/#import-patients), the [audit events API](https://www.bloomtext.com/developers/api/reporting-and-audit/#audit-events-api), and [OAuth](https://www.bloomtext.com/developers/api/oauth/). Everything else on these pages works today. ## Access API access requires a signed BAA. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) to get started, and see [Security and BAA](https://www.bloomtext.com/developers/api/security-and-baa/) for how the API protects patient data. > **Warning:** Don't include patient information in your access request. The form isn't a secure channel. --- # Core concepts > Accounts, organizations, API keys, members and teams, patients, phone numbers, conversations and messages, and the access rules that govern each in the BloomText API. Source: https://www.bloomtext.com/developers/api/concepts/ This page explains the objects the API works with and who can reach them. The rest of the docs build on it. ## Accounts and organizations Everything in BloomText belongs to an **organization**: a practice, a clinic, or one clinic of a larger group. [Retrieve the organization](https://www.bloomtext.com/developers/api/reference/get-organization/) to check which one a call acted on. An **account** is the subscription your organizations share. Its Owners and IT people manage what spans every organization: API keys, people, settings, Okta single sign-on, Message reports and the Audit log. A group with several clinics, like Riverbend Health with its Northside Clinic and Eastside Clinic, runs each as its own organization on one account, so their patients, phone numbers and conversations stay apart while IT manages them in one place. ```mermaid flowchart TB Account[Account: Riverbend Health, Owners and IT] --> OrgA[Organization: Northside Clinic] Account --> OrgB[Organization: Eastside Clinic] Account --> Key[API key] Key -->|reaches all, or the ones picked| OrgA Key --> OrgB OrgA --> TeamA[Teams, phone numbers, patients] OrgB --> TeamB[Teams, phone numbers, patients] ``` ## API keys and identities An **API key** belongs to the account, not to a person. It reaches every organization on the account or only the ones picked, and it never sees an organization it wasn't given. A key that reaches several names one with `org_id` on each call. Its scopes say what it can do in them. A key that sends belongs to an [API identity](https://www.bloomtext.com/developers/api/api-identity/), the automated sender it sends as; read-only and provisioning keys need none. See [API keys](https://www.bloomtext.com/developers/api/api-keys/) and [Authentication](https://www.bloomtext.com/developers/api/authentication/). [OAuth](https://www.bloomtext.com/developers/api/oauth/) adds a second way to authenticate a key, and a way for a person to connect your app to their own conversations. ## Members and teams A **member** is a staff person in an organization, with the role `admin` or `user`. The same person can be a member of several organizations on the account. Account Owners and IT are set only in BloomText, never through the API. Each membership records who manages it, in `managed_by`: | `managed_by` | Who changes it | | --- | --- | | `admin` | The organization's admins, in BloomText | | `api` | An API key. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). | | `account` | The account's Owners and IT, on the Account page | | `okta` | The account's Okta rules, through Directory Sync. See [SSO and Directory Sync](https://www.bloomtext.com/developers/api/identity-and-sso/). | A **team** is a group of members in an organization, like "Front desk". Teams own phone numbers and the patient conversations on them. ## What the API can reach Access is narrow on purpose: - **Patients are always named.** You find a patient record by patient ID, phone number, or MRN. No call lists the patient directory or searches it by name. - **Reads are bounded.** Every read of patient messages or conversations is limited by a time range, a patient, or a conversation. - **Staff conversations stay private.** An API key never reads direct, group or team chats between staff; those calls return `403` with `code: oauth_required`. With [OAuth](https://www.bloomtext.com/developers/api/oauth/), a person who connected your app reaches only the conversations they're in. For the other protections and your responsibilities under the BAA, see [Security and BAA](https://www.bloomtext.com/developers/api/security-and-baa/). ## Patients A [patient](https://www.bloomtext.com/developers/api/reference/patient-object/) is someone your organization messages, with a name, mobile number, email, date of birth, and `mrn` (their ID in your system). Patients belong to the organization. Messaging a new phone number creates the patient. See [Patients](https://www.bloomtext.com/developers/api/patients/). ## Phone numbers Each clinic phone number belongs to a team, like "Front desk" at +1 512-555-0100. Texts to patients come from a phone number, and patients' replies go back to that team's conversation. Name the number with `from` when you send, or leave it out to use the key's default number or the organization's only number. An API key can send from any of the organization's numbers, or only from its own with a [phone-number limit](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers). See [Which number it comes from](https://www.bloomtext.com/developers/api/send-messages/#which-number-it-comes-from). ## Conversations A [conversation](https://www.bloomtext.com/developers/api/reference/conversation-object/) is a thread between people in your organization and, often, a patient or family member. Its type is `patient`, `direct`, `group`, or `broadcast`. A patient conversation belongs to one phone number, so a patient who has texted two teams has two conversations. [Participants](https://www.bloomtext.com/developers/api/reference/participant-object/) can be staff or patients. An API key reads patient conversations by time range, by patient (`patient_id`), or one conversation at a time; see [Read messages](https://www.bloomtext.com/developers/api/read-messages/). Other conversations follow the [access rules above](#what-the-api-can-reach). ## Messages, replies, and reactions - A [message](https://www.bloomtext.com/developers/api/reference/message-object/) carries either text (`body`) or a file (`file`). It includes its `sender` (name, and whether they're staff or a patient), its `conversation` and `patient`, and its `channel`, so you can read a list of messages without extra lookups. - Messages to patients carry a `delivery` status. See [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/). - A reply is a message with `reply_to_message_id` set. A conversation's messages include its replies; group them by that field to rebuild a thread. - [Reactions](https://www.bloomtext.com/developers/api/reference/reaction-object/) are emoji on a message. They have no ID of their own; each is identified by the message, the user, and the emoji. ## Messages sent through the API Messages to patients go by secure link unless the request sets `channel` to `sms`. A message goes out from one of the organization's phone numbers, in that number's team's conversation with the patient, and the patient's reply lands in that team's inbox like any other. Your integration sends as an [API identity](https://www.bloomtext.com/developers/api/api-identity/): an automated sender on your account, like "Appointment reminders", with a name and avatar, limited to the teams and numbers Owners and IT choose. It isn't a person: it isn't listed in the Directory or People, isn't a billable seat, and can't sign in. API keys belong to an identity, and a key that sends must have one. Staff see the identity in the thread marked as automated, and Owners and IT see it in Message reports and the Audit log (with an **Automated** filter); patients see its name in secure chat and the office's number on SMS. Messages carry it as `sender` with `kind: api_identity`. Nothing is ever sent on behalf of a staff member. Until identities are turned on for your account, a message sent with a key shows the key's name, like "Reminder service", with an **API** marker (`kind: api_key`). Every message records what sent it, so an organization can always tell what came through the API. Make sure staff know what your integration sends. See [Build an AI agent](https://www.bloomtext.com/developers/api/ai-agents/#guardrails-that-matter). ## Read state API keys have no read state: `unread` is always `false`, and reading through the API never marks anything as read in BloomText. ## Finding and following messages - [Read messages](https://www.bloomtext.com/developers/api/read-messages/): `GET /patient-messages` returns every patient message in a time range, newest first, one by one or grouped by conversation, with a cursor. Narrow it to a patient or conversation. - [Search](https://www.bloomtext.com/developers/api/search/): add `q` for words and filters, like `refill from:patient is:failed`. - Keep up: ask again with `after` set to the newest message you've seen. ## IDs, timestamps, and requests | Convention | Detail | | --- | --- | | Base URL | `https://api.bloomtext.com/v1` | | Authentication | `Authorization: Bearer `. See [Authentication](https://www.bloomtext.com/developers/api/authentication/). | | IDs | Objects have a stable `id`, usually a UUID. Reactions have none; each is identified by its message, user, and emoji. | | Timestamps | RFC 3339 strings in UTC, like `2026-09-21T12:00:00Z`. | | Bodies | JSON in and out. Send `Content-Type: application/json`. | | Lists | Cursor-paginated. See [Pagination](https://www.bloomtext.com/developers/api/pagination/). | | Writes | Every `POST` takes an `Idempotency-Key`. See [Idempotency](https://www.bloomtext.com/developers/api/idempotency/). | | Errors | RFC 9457 problem details. See [Errors](https://www.bloomtext.com/developers/api/errors/). | --- # Authentication > Authenticate with an API key sent as a Bearer token, choose its scopes, attach sending keys to an API identity, limit keys to some organizations or phone numbers, and connect apps with OAuth. Source: https://www.bloomtext.com/developers/api/authentication/ Every request carries an API key as a Bearer token: ```http filename="Header" Authorization: Bearer ``` All requests must use HTTPS. A request without a valid key returns `401 Unauthorized`. API keys belong to your account, not to a person. An account Owner or IT person creates them in BloomText under **Settings → Account → API keys**, picks their scopes, and chooses which organizations each one reaches. See [API keys](https://www.bloomtext.com/developers/api/api-keys/). API access is available to accounts with a signed BAA. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) to get started. ## What a key reaches Within its scopes, a key works in every organization it was given, across the whole organization: - **Patients**: find them by phone number or MRN, and retrieve, create, update and delete them. - **Patient messages**: message a patient, check delivery, and read and search patient messages and conversations. - **Phone numbers and the organization**: list the organization's numbers and read its details. - **Staff and organizations**, with the member scopes: list the organizations the key reaches, add, change and remove members, place them on teams, and read member events. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). A key never reads staff conversations (direct, group or team chats) and never lists every patient. See [What the API can reach](https://www.bloomtext.com/developers/api/concepts/#what-the-api-can-reach). ## Scopes A key's scopes are chosen by the Owner or IT person who creates it. There is a read and a write scope for patient messages, another pair for patients, and three scopes for staff. No scope includes another. Request only what you need: a call outside the key's scopes returns `403` with `code: insufficient_scope`, and every endpoint in the [API reference](https://www.bloomtext.com/developers/api/reference/) lists the scope it needs. | Scope | Allows | | --- | --- | | `messages.read` | [Patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) and [patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) in a time range, with [search](https://www.bloomtext.com/developers/api/search/), a [patient message's delivery status](https://www.bloomtext.com/developers/api/reference/get-patient-message/), and the organization's [phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | | `messages.write` | [Message a patient](https://www.bloomtext.com/developers/api/reference/send-message/) by patient ID or phone number (a new number creates the patient), or [many patients at once](https://www.bloomtext.com/developers/api/reference/send-message-batch/). The key sends as its [API identity](#sending-keys-belong-to-an-identity). Grants no read access on its own. | | `patients.read` | [Find](https://www.bloomtext.com/developers/api/reference/list-patients/) patients by phone number or MRN, and [retrieve](https://www.bloomtext.com/developers/api/reference/get-patient/) them by ID | | `patients.write` | [Create](https://www.bloomtext.com/developers/api/reference/create-patient/), [update](https://www.bloomtext.com/developers/api/reference/update-patient/) and [delete](https://www.bloomtext.com/developers/api/reference/delete-patient/) patients | | `members.read` | [Organizations](https://www.bloomtext.com/developers/api/reference/list-orgs/) the key reaches, [members](https://www.bloomtext.com/developers/api/reference/list-members/) and who manages each, [teams](https://www.bloomtext.com/developers/api/reference/list-teams/), and [member events](https://www.bloomtext.com/developers/api/reference/list-member-events/) | | `members.write` | [Add](https://www.bloomtext.com/developers/api/reference/create-member/), [update](https://www.bloomtext.com/developers/api/reference/update-member/) and [remove](https://www.bloomtext.com/developers/api/reference/delete-member/) members | | `teams.write` | [Add a member to a team](https://www.bloomtext.com/developers/api/reference/add-team-member/) and [take them off](https://www.bloomtext.com/developers/api/reference/remove-team-member/) | | `audit.read` | Read the account's [audit events](https://www.bloomtext.com/developers/api/reference/list-audit-events/). See [Reporting and audit data](https://www.bloomtext.com/developers/api/reporting-and-audit/#audit-events-api). | Some calls also need a feature on: [campaigns](https://www.bloomtext.com/developers/api/campaigns/) and [patient imports](https://www.bloomtext.com/developers/api/patients/#import-patients) use `messages.write` and `patients.write` once BloomText turns them on for your account. To change a key's scopes, create a new key with the scopes you need and revoke the old one. ### Common scope sets Finds patients and texts them reminders. ```text patients.read messages.write ``` Keeps BloomText's patients in step with your EHR, and reads each patient's messages back into the chart. ```text patients.read patients.write messages.read ``` Adds new hires to the right organizations and teams, and removes people who leave. ```text members.read members.write teams.write ``` ## Sending keys belong to an identity > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=api-identity) Scopes say what a key may do; an [API identity](https://www.bloomtext.com/developers/api/api-identity/) says who it does it as. An identity is an automated sender on your account, created under **Settings → Account → API keys → API identities**, with a name and avatar Owners and IT choose and the teams and phone numbers it may use. It isn't listed in the Directory or People, isn't a billable seat, and can't sign in. Keys belong to an identity, and one identity can have several keys, so rotating a key never changes who messages come from. | Key | Identity | | --- | --- | | With `messages.write` | Required. The key sends as its identity, from the identity's numbers. | | Read-only (`messages.read`, `patients.read`, `members.read`, report and audit reads) | Not needed | | Provisioning (`members.write`, `teams.write`, `patients.write` without `messages.write`) | Not needed | A key never sends on behalf of a staff member. Until identities are turned on for your account, a sending key's messages show the key's name with an **API** marker. ## Limits that narrow a key Scopes say what a key can do. Limits say where. A sending key's limits come from its [identity](#sending-keys-belong-to-an-identity) once identities are on. A limit never adds an action; it only narrows reach. | Limit | What it does | | --- | --- | | [Organizations](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches) | The key reaches every organization on the account, including ones added later, or only the ones picked. A key that reaches several names one with `org_id` on every call. | | [Phone numbers](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers) | The key sends only from the numbers picked, and reads only the messages, conversations and numbers of each number's team. Patients stay organization-wide. | ## Choose the organization A key that reaches several organizations names one with `org_id` on every call; a key that reaches one can leave it out. [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/) lists the ones it reaches. Without `org_id`, a call returns `400` with `code: org_id_required`, and an organization the key can't reach returns `403` with `code: org_not_reachable`. ## OAuth > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) OAuth is a second way to authenticate, for two cases: - **Client credentials**: your server exchanges a client ID and secret for a short-lived access token for an existing API key, with that key's scopes and limits. Use it when your security policy prefers rotating tokens over a long-lived key. - **Authorization code with PKCE**: a person connects your app to their BloomText account, and your app works in their own conversations under `/me`, including staff chats. For now, org admins can connect. Both are covered in [Connect with OAuth](https://www.bloomtext.com/developers/api/oauth/). With an authorization-code token, the same scopes apply, plus `offline_access` for a refresh token. Today, calls under `/me` and to the staff directory answer an API key with `403` and `code: oauth_required`. ## Keep keys safe - Store API keys like PHI: in a secrets manager or encrypted at rest, readable only by the people and systems that need them. A key with `messages.read` can read patient messages. - Keep keys out of models. If an AI agent calls the API, your code holds the key and makes the request. Never put a key in a prompt, a tool description, or chat history. - Give each system its own key with the least it needs. A key that only sends reminders doesn't need `patients.write`. See [Build an AI agent](https://www.bloomtext.com/developers/api/ai-agents/). - Set an expiry, and rotate keys when people with access leave. See [Rotate or revoke a key](https://www.bloomtext.com/developers/api/api-keys/#rotate-or-revoke-a-key). --- # Quickstarts > Pick a BloomText API quickstart: the Patient API with an API key, or OAuth for an org admin's own conversations. Source: https://www.bloomtext.com/developers/api/quickstart/ Each credential has its own quickstart. Pick the one that matches what you're building. - Patient API (API key): [quickstart](https://www.bloomtext.com/developers/api/patient-api-quickstart/) - OAuth (a person's own conversations): [quickstart](https://www.bloomtext.com/developers/api/oauth-quickstart/) --- # Patient API quickstart > Make your first Patient API requests with an API key. Text your phone, check delivery, read the reply, and clean up. Source: https://www.bloomtext.com/developers/api/patient-api-quickstart/ Text your own phone as a test patient, check that the message was delivered, read your reply through the API, and clean up. ### Get an API key BloomText turns on API access for organizations with a signed BAA. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) if you don't have it yet. An account Owner or IT person then creates a key in BloomText under **Settings → Account → API keys**. For this guide, give it the scopes `patients.read`, `patients.write`, `messages.read`, and `messages.write`. If your account has several organizations, limit the key to one, so the calls below need no `org_id`; see [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). If your organization has more than one phone number, add `"from"` with one of them to the send below; see [Which number it comes from](https://www.bloomtext.com/developers/api/send-messages/#which-number-it-comes-from). Store the key in an environment variable. Never commit it or ship it to a browser. ```bash filename="Terminal" export BLOOMTEXT_API_KEY="bt_key_4f7c2a9e1b..." ``` ### Check the key Retrieve your organization to confirm the key works. ```bash filename="Request" curl https://api.bloomtext.com/v1/organization \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="check.mjs" const response = await fetch('https://api.bloomtext.com/v1/organization', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}` }, }) console.log(response.status, await response.json()) ``` ```python filename="check.py" import os import requests response = requests.get( "https://api.bloomtext.com/v1/organization", headers={"Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}"}, ) print(response.status_code, response.json()) ``` ```json filename="Response · 200 OK" { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" } ``` ### Text your own phone Send a message to your own mobile number. BloomText doesn't know the number yet, so it creates a patient. Name the patient "API Test" so staff know what it is. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "to": { "phone": "YOUR_MOBILE_NUMBER", "patient": { "first_name": "API", "last_name": "Test" } }, "body": "Hello from the BloomText API. Reply to this message to test replies.", "channel": "secure" }' ``` ```js filename="send.mjs" const response = await fetch('https://api.bloomtext.com/v1/patient-messages', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ to: { phone: 'YOUR_MOBILE_NUMBER', patient: { first_name: 'API', last_name: 'Test' } }, body: 'Hello from the BloomText API. Reply to this message to test replies.', channel: 'secure', }), }) console.log(await response.json()) ``` ```python filename="send.py" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/patient-messages", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "to": {"phone": "YOUR_MOBILE_NUMBER", "patient": {"first_name": "API", "last_name": "Test"}}, "body": "Hello from the BloomText API. Reply to this message to test replies.", "channel": "secure", }, ) response.raise_for_status() print(response.json()) ``` The examples explicitly choose the secure channel, so your phone gets a text with a link to read it. Save `message.id` and `message.patient.id` from the response. ```json filename="Response · 201 Created" { "message": { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "API Test" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "API Test" }, "channel": "secure", "delivery": { "status": "queued", "error": null, "updated_at": "2026-09-27T15:04:05Z" }, "body": "Hello from the BloomText API. Reply to this message to test replies.", "...": "..." }, "patient_created": true, "conversation_created": true } ``` ### Check delivery After a few seconds, [retrieve the message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) to see its delivery status. ```bash filename="Request" curl https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1 \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` `delivery.status` moves from `queued` to `sent` to `delivered` as the carrier reports, within minutes. See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status). ### Read your reply Open the link on your phone and reply. Then list the messages the test patient (you) sent, newest first: ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'patient_id=5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77' \ --data-urlencode 'q=from:patient' ``` ### Clean up Delete the test patient so it doesn't stay in your organization's records. ```bash filename="Request" curl -X DELETE https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77 \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ## Next steps - [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/) - [Patients](https://www.bloomtext.com/developers/api/patients/) - [Manage members](https://www.bloomtext.com/developers/api/members-api/) - [Read messages](https://www.bloomtext.com/developers/api/read-messages/) Building for an org admin's own conversations, like staff team chats? See the [OAuth quickstart](https://www.bloomtext.com/developers/api/oauth-quickstart/). --- # API keys > Create an API key, send it as a Bearer token, and choose its scopes, the organizations and phone numbers it reaches, its expiry, and how to rotate it. Source: https://www.bloomtext.com/developers/api/api-keys/ An API key lets your server work with BloomText with no one signed in: syncing patients from your EHR, sending reminders, reading what patients write back, and managing staff across your organizations. ### Your organization gets API access BloomText turns on API access once your BAA is signed. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) to get started. Until then, the API keys tab says so and offers the same request. ### An Owner or IT person creates a key Keys belong to your BloomText account, the subscription your organizations share. Once API access is on, an account Owner or IT person creates keys under **Settings → Account → API keys → Create API key**. Each key has: - a **name**, like "Reminder service", so you can tell your keys apart. - for a key with `messages.write`, the **[API identity](https://www.bloomtext.com/developers/api/api-identity/)** it sends as: an automated sender, set up in the **API identities** section of the same tab, with its own name, avatar, teams and numbers. It isn't a person, a seat, or listed under People. Several keys can share one identity, so rotating a key keeps the sender. Read-only and provisioning keys need no identity. Until identities are on for your account, staff see a sending key's messages under the key's name with an **API** marker, and patients see the clinic. - the **organizations** it reaches: all of them, including ones added later, or only the ones picked. Separate clinics that run as separate organizations, like Northside Clinic and Eastside Clinic, can each get their own key. See [Organizations a key reaches](#organizations-a-key-reaches). - its **[scopes](https://www.bloomtext.com/developers/api/authentication/#scopes)**. A key that only sends reminders needs `messages.write` and `patients.read`. - an **expiry**: 1 day, 7 days, 30 days, 90 days (the default), 1 year, or never. Never asks you to confirm. See [Expiry](#expiry). If your account doesn't have the Account page yet, BloomText creates your keys. Organizations have no API keys tab of their own. A key made in Settings has no default phone number, so a send without `from` works only when your organization has one number. See [Phone numbers](https://www.bloomtext.com/developers/api/send-messages/#which-number-it-comes-from). The key is shown once. Store it in your secrets manager right away. Owners and IT see every key under **Settings → Account → API keys**. ### Your server sends it Send the key as a Bearer token: ```bash filename="Request" curl https://api.bloomtext.com/v1/organization \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```json filename="Response · 200 OK" { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" } ``` ## Organizations a key reaches A key that reaches one organization acts on it with no extra parameter. A key that reaches several needs `org_id` on every call, taken from [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/): ```bash filename="Request" curl "https://api.bloomtext.com/v1/patients?phone=%2B15555550123&org_id=$ORG_ID" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` - Leaving out `org_id` on a key that reaches several organizations returns `400` with `code: org_id_required`. - An `org_id` the key can't reach returns `403` with `code: org_not_reachable`. - Keys made before accounts were turned on keep working with no `org_id`: each reaches only its own organization. ## Limit a key to phone numbers > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=phone-number-limits) A key can also be limited to some of the account's phone numbers. Use it when one system serves one department, like a reminder service that should only ever text from the pediatrics number. When an Owner or IT person creates the key, they choose **Only some phone numbers** under the organizations it reaches and pick the numbers, grouped by organization. A limited key then: | Call | With a phone-number limit | | --- | --- | | [Send a message](https://www.bloomtext.com/developers/api/send-messages/) | `from` must be one of the key's numbers. With exactly one number, that number is the default and `from` can be left out. Otherwise a send without `from` returns `422` with `code: from_required`, listing the key's numbers. | | [Read patient messages and conversations](https://www.bloomtext.com/developers/api/read-messages/) | Only conversations owned by the teams of the key's numbers. | | [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | Only the key's numbers. | | [Patients](https://www.bloomtext.com/developers/api/patients/) | Unchanged: patients are organization-wide, since a patient record has no number. | | [Members and teams](https://www.bloomtext.com/developers/api/members-api/) | Unchanged: the limit applies to message scopes only. | A number belongs to one organization, so limiting a key to numbers also limits it to those numbers' organizations. Reads follow each number's team, not the number itself. If a team has two numbers and the key has one of them, the key reads that team's conversations on both. ## What a key can reach In each organization it reaches, a key works across the whole organization, every team's patients and patient conversations, within its scopes, unless it has a [phone-number limit](#limit-a-key-to-phone-numbers). Keep that in mind when deciding who gets a key. - Patients: [find](https://www.bloomtext.com/developers/api/reference/list-patients/) them by phone number or MRN, and [retrieve](https://www.bloomtext.com/developers/api/reference/get-patient/), [create](https://www.bloomtext.com/developers/api/reference/create-patient/), [update](https://www.bloomtext.com/developers/api/reference/update-patient/) and [delete](https://www.bloomtext.com/developers/api/reference/delete-patient/) them. - Patient communication: [message a patient](https://www.bloomtext.com/developers/api/send-messages/), and [read patient messages](https://www.bloomtext.com/developers/api/read-messages/) in a time range, for one patient, or across all patient conversations. - Staff: list organizations, add, change and remove members, and place them on teams. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). - Turned on per account: [campaigns](https://www.bloomtext.com/developers/api/campaigns/) and [patient imports](https://www.bloomtext.com/developers/api/patients/#import-patients). A key reads with [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) and [`GET /patient-conversations`](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/), which cover patient conversations only. It never sees staff conversations; see [What the API can reach](https://www.bloomtext.com/developers/api/concepts/#what-the-api-can-reach). A person's own conversations under `/me`, the staff directory, reactions and participants use [OAuth](https://www.bloomtext.com/developers/api/oauth/); an API key calling them gets `403` with `code: oauth_required`. Members a key adds show **Managed by API** in BloomText, and only an API key can change them. If the account's Okta rules later match those people, Okta takes them over at the next rule save; the API then gets `409` with `code: managed_by_identity_provider`. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). > **Warning:** Keep keys on your server. Never put a key in a browser, a mobile app, a public repository, or an AI prompt. ## Expiry A key stops working when its expiry passes. Requests then return `401` with `code: key_expired`. Under **Settings → Account → API keys**, an Owner or IT person can give a key a new expiry from the same choices, counted from that moment. This works even after the key has expired. A key that expires within 14 days is highlighted there. A key that never expires stays valid until someone revokes it. If it leaks, anyone can use it until then, so pick an expiry unless you rotate keys some other way. ## Rotate or revoke a key To rotate a key, create a second one, deploy it, then revoke the old one. Both work during the overlap. An Owner or IT person can revoke a key at any time under **Settings → Account → API keys**. It stops working on the next request, which returns `401` with `code: key_revoked`. A revoked key can't be restored. Messages it sent keep its name. --- # Send messages to patients > Text a patient by phone number or patient ID in one request. BloomText finds or creates the patient, sends securely by default, and reports delivery. Source: https://www.bloomtext.com/developers/api/send-messages/ Reach a patient with one request. [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) takes a patient ID or phone number and the text. BloomText finds the patient (or creates one for a new number), finds or starts the conversation on the right clinic phone number, and sends the message. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "to": { "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" }, "body": "Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.", "channel": "secure" }' ``` ```js filename="send.mjs" export async function messagePatient(credential, to, body, channel, { idempotencyKey } = {}) { const response = await fetch('https://api.bloomtext.com/v1/patient-messages', { method: 'POST', headers: { Authorization: `Bearer ${credential}`, 'Idempotency-Key': idempotencyKey ?? crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ to, body, channel }), }) const result = await response.json() if (!response.ok) throw Object.assign(new Error(result.detail), { problem: result }) return result // { message, patient_created, conversation_created } } await messagePatient(process.env.BLOOMTEXT_API_KEY, { patient_id: '5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77' }, 'Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.', 'secure') ``` ```python filename="send.py" import os import uuid import requests def message_patient(credential: str, to: dict, body: str, channel: str, idempotency_key: str | None = None) -> dict: payload = {"to": to, "body": body, "channel": channel} response = requests.post( "https://api.bloomtext.com/v1/patient-messages", headers={ "Authorization": f"Bearer {credential}", "Idempotency-Key": idempotency_key or str(uuid.uuid4()), }, json=payload, ) result = response.json() if not response.ok: raise RuntimeError(f"{result['code']}: {result.get('detail')}") return result # message, patient_created, conversation_created message_patient( os.environ["BLOOMTEXT_API_KEY"], {"patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"}, "Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.", "secure", ) ``` The response holds the sent [message](https://www.bloomtext.com/developers/api/reference/message-object/), with its conversation, patient, channel, and [delivery status](#delivery-status), plus `patient_created` and `conversation_created`. A send returns `201 Created`. When your organization requires consent before texting and the patient's phone hasn't agreed yet, it returns `202 Accepted` with the same body. The message is in the conversation with `delivery.status` `consent_requested`, and BloomText has texted the patient a consent request. The text goes out under the same message `id` when the patient replies YES or staff record their consent. Don't send it again. Use an [API key](https://www.bloomtext.com/developers/api/api-keys/) with the `messages.write` scope, even when the send creates a patient. An [OAuth](https://www.bloomtext.com/developers/api/oauth/) token works the same way. ## Who it comes from Your integration sends as its [API identity](https://www.bloomtext.com/developers/api/api-identity/), the automated sender the key belongs to. Nothing is sent on behalf of a staff member. | | The patient sees | Staff see | | --- | --- | --- | | With an API identity | Its name in secure chat; the office's number on SMS | Its name and avatar, marked as automated | | Today's default, without one | The clinic | The key's name, like "Reminder service", with an **API** marker | See [Messages sent through the API](https://www.bloomtext.com/developers/api/concepts/#messages-sent-through-the-api). ## Who gets it Set `to` to exactly one of: | `to` | What happens | | --- | --- | | `{"patient_id": "…"}` | Sends to that patient. | | `{"phone": "…"}` | Looks up the phone number in your organization's patients. | A phone number can be in any common format, like `(512) 555-0143` or `+15125550143`. BloomText resolves it this way: - **No patient has that number:** BloomText creates one, as it does when a new number texts the clinic. Add a `patient` object with `first_name`, `last_name`, `date_of_birth`, `email`, or `mrn` to fill in the new record. - **One patient has it:** that patient. - **Several patients share it,** like a family phone: `409 ambiguous_recipient`. BloomText never guesses; the error's `candidates` lists the matching patients. Send again with the right `patient_id`, or add `patient.mrn` to say which one. - **`patient.mrn` points at someone else:** `409 recipient_mismatch`, and nothing is sent. That's when the MRN belongs to a patient with a different phone number, or no one has the MRN but the number's only patient has another one. BloomText only ever texts the number you sent to, and never files a message under a patient the MRN contradicts. `candidates` lists the patient the MRN or the number belongs to. If their number changed, [update the patient](https://www.bloomtext.com/developers/api/reference/update-patient/) and send again, or send with their `patient_id`. ```json filename="Request · a new number" { "to": { "phone": "(512) 555-0199", "patient": { "first_name": "John", "last_name": "Doe", "mrn": "MRN-21004" } }, "body": "Welcome to Riverbend Health. Your intake form is ready.", "channel": "sms" } ``` ## Secure or plain text Every send names its `channel`. There's no default, because the two reach the patient differently; a send without one returns `422 channel_required`. | `channel` | The patient receives | Use it for | | --- | --- | --- | | `secure` | A text or email with a secure link. The message itself stays inside BloomText, and the patient reads and replies there. | Anything clinical or personal. | | `sms` | The message text as a regular SMS from the clinic's number. Replies come back by SMS. | Logistics, like reminders, directions, or "your forms are ready." | ```json filename="Request · plain SMS" { "to": { "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" }, "body": "Reminder: your appointment is tomorrow at 9:00 at 1200 Main St.", "channel": "sms" } ``` > **Warning:** Plain SMS puts the message on the patient's phone and the carrier's network, outside BloomText. Keep clinical detail out of `sms` messages. ## Which number it comes from Each clinic phone number belongs to a team, like "Front desk" at +1 512-555-0100 or "Billing" at +1 512-555-0200. Texts come from one of them, and the patient's replies go back to that team's conversation. Name the number with `from`: ```json filename="Request" { "to": { "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" }, "from": "+15125550200", "body": "Your statement is ready. Reply here with any billing questions.", "channel": "sms" } ``` - [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) returns the numbers you can send from: every number in the organization, or only the key's numbers with a [phone-number limit](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers). - Without `from`, BloomText uses the default number, marked `is_default`: the one set on the API key, or else the organization's only number. A key's default that's no longer one of the organization's numbers is ignored. - If there's no default and more than one number, the request returns `422 from_required`. It never picks one for you; `detail` and `numbers` list every number you can choose: ```json filename="Response · 422 Unprocessable Entity" { "type": "https://www.bloomtext.com/developers/api/errors/#from_required", "title": "Unprocessable Entity", "status": 422, "code": "from_required", "detail": "This organization has 2 numbers. Set \"from\" to one of them: +15025550142 (WIC), +15025550199 (Immunizations). See GET /v1/phone-numbers.", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [], "numbers": [ { "number": "+15025550142", "team": "WIC" }, { "number": "+15025550199", "team": "Immunizations" } ] } ``` Send again with `"from": "+15025550142"`. BloomText keeps one conversation per phone number and patient. Sending again from the same number continues that conversation; sending from another team's number starts a separate one. ## Reply in a conversation With an API key, reply to a patient with this same request: name the patient and the `from` number, and BloomText continues their conversation on that number. > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) With [OAuth](https://www.bloomtext.com/developers/api/oauth/), you can also reply by conversation ID, for example one you found by [reading messages](https://www.bloomtext.com/developers/api/read-messages/). [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) in the conversation (`POST /me/conversations/{id}/messages`); it uses the conversation's phone number and channel. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"body": "Friday at 9:00 works. You are all set."}' ``` ## Delivery status A text can fail after BloomText accepts it: a landline, a disconnected number, or a carrier block. Every message to a patient carries a `delivery` object that BloomText updates from the carrier's reports, which arrive within minutes. Messages from patients have `delivery: null`. | `delivery.status` | Meaning | | --- | --- | | `queued` | Accepted, not yet handed to the carrier. | | `sent` | Handed to the carrier, or a secure message whose link went by email. | | `delivered` | The carrier confirmed delivery. | | `failed`, `undelivered` | The text didn't reach the patient. | | `rejected` | BloomText didn't send the text: after you sent it, the patient opted out, the carrier blocked texts to them, an admin blocked their number, their number can't receive texts, your organization requires consent and the patient hasn't given it, or the text waited for consent and wasn't sent. See [Opt-outs and blocked numbers](#opt-outs-and-blocked-numbers). | | `consent_requested` | Your organization requires consent before texting, and BloomText texted the patient a consent request. The text goes out when they reply YES or staff record their consent. | When a text isn't delivered, `delivery.error_code` says why and `delivery.detail` explains it. The common codes: | `error_code` | Meaning | What to do | | --- | --- | --- | | `patient_opted_out` | The patient opted out. | Stop texting them. Texts resume when the patient texts START, or when an admin clears an opt-out staff recorded. | | `carrier_blocked` | The patient texted STOP. | Stop texting them. The patient can text START to get texts again. | | `number_blocked` | An admin blocked the patient's number. | Stop texting them; an admin can unblock it. | | `number_unreachable` | The patient's number can't receive texts (a landline or unreachable). | Ask the patient for a mobile number and update their profile, or send `secure`. | | `consent_required` | Your organization requires consent and the patient hasn't given it. This is rare: a send that needs consent normally waits as `consent_requested`. | Ask the patient to reply YES, or have staff record their consent, then send again. | | `consent_not_sent` | The text waited for consent and wasn't sent: the consent request couldn't be sent, or sending the text failed. A blocked or unreachable number reports its own code instead, like `carrier_blocked` or `number_unreachable`. | Send it again if you still need to. | | `30003` | The phone was off or had no signal. | Usually clears on its own. If it keeps failing, call the patient to check the number. | | `30004` | The patient's phone or carrier blocked the text. | Ask the patient whether they block unknown numbers, or send `secure`. Contact BloomText if many patients show this. | | `30005` | Number not in service. | Get a current number from the patient and update their profile. | | `30006` | A landline, or a number that can't get texts. | Ask the patient for a mobile number, or call them. Until it's updated, later texts to the number are refused with `number_unreachable`. | | `30007` | The carrier's spam filter blocked the text. | Contact BloomText, which reviews the number's registration and wording with the carrier. Avoid link shorteners. | | `30008` | The carrier gave no reason. | Try again later, and contact BloomText if it keeps happening. | | `30019` | The text was too long for the patient's carrier; emoji and accented letters lower the limit. | Send a shorter text, and contact BloomText if it keeps happening. | | `30024` | The patient's carrier hasn't set up this organization's number yet, or the patient just switched carriers. | Try again tomorrow, and contact BloomText if it keeps failing. | | `60005` | A temporary carrier connection error. | Send the text again. | | `21610` | The patient texted STOP to this number. | Stop texting them from it. The patient can text START to this number to get texts again. | Every `detail` says what happened and then what to do, in at most two sentences. Other codes are the carrier's own; `detail` names them and says to contact BloomText with the code if it keeps happening. A message to several patients, in a group conversation, also has `delivery.recipients`, with each patient's status. The top-level `status` is the worst of them: `failed` if any failed, and `delivered` only when all were. ```json filename="delivery" { "status": "failed", "error_code": "30005", "detail": "Number not in service. Get a current number from the patient and update their profile.", "updated_at": "2026-10-12T14:07:31Z" } ``` To follow up, [read messages](https://www.bloomtext.com/developers/api/read-messages/) with `after` set to the start of the day and `q=is:failed` (or `is:rejected`, `is:undelivered`, `is:queued`, `is:delivered`), or check one message with [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/). Statuses arrive by polling, or by [webhooks](https://www.bloomtext.com/developers/api/webhooks/). ## Getting replies and delivery status Poll [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) for both replies and delivery status. With [webhooks](https://www.bloomtext.com/developers/api/webhooks/), BloomText calls your server instead. To poll: 1. **Ask for what's new.** Pass `after` set to the newest `created_at` you've processed, with `order=asc` and `page[limit]=100`, and follow `pagination.next_cursor` in `page[after]` until `has_more` is `false`. Messages are keyed by `id`, so seeing one twice is harmless. The full loop is in [Keep up with new messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages). 2. **Poll every 1 to 5 minutes.** That's well within the [rate limits](https://www.bloomtext.com/developers/api/rate-limits/), and patients rarely expect a faster answer by text. Don't poll faster than once a minute. 3. **Tell replies from your own messages** by `sender.kind`: `patient` is a patient writing in; `staff` and `api_key` are your organization writing out. To read only replies, add `q=from:patient`. See [Search](https://www.bloomtext.com/developers/api/search/). 4. **Track delivery on the messages you sent.** Each message carries `delivery.status`: `queued`, then `sent`, then `delivered`, or `failed`, `undelivered` or `rejected` with `delivery.error_code` and `delivery.detail` saying why. See [Delivery status](#delivery-status). Re-read recent messages until they settle; a status rarely changes after a day. ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'after=2026-10-12T14:05:00Z' \ --data-urlencode 'q=from:patient' \ --data-urlencode 'order=asc' \ --data-urlencode 'page[limit]=100' ``` ## Opt-outs and blocked numbers BloomText keeps one list of patient numbers your organization can't text, and checks it before it queues an SMS. If the patient's number is on it, the send fails with the reason, and nothing is sent. Each reason blocks texts from all of your organization's numbers, whichever `from` you pick. Batch sends report the same codes per message. - **The patient opted out**: they replied STOP to one of your organization's numbers, or staff recorded their opt-out in the app. ```json filename="Response · 422 Unprocessable Entity" { "type": "https://www.bloomtext.com/developers/api/errors/#patient_opted_out", "title": "Unprocessable Entity", "status": 422, "code": "patient_opted_out", "detail": "This patient replied STOP on Oct 5, so texts from (502) 555-0142 and the organization's other numbers are blocked until they reply START. Stop sending them texts; a secure message can still reach them by email.", "number": "+15025550142", "since": "2026-10-05T15:04:00Z", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [] } ``` `number` is the number the text would have come from, and `since` is when the opt-out began. **What to do:** stop texting this patient. Only the patient can lift it, by replying START. A `secure` message still reaches them by email, if they have one. - **The carrier is blocking** texts to the patient, because it refused an earlier text after they replied STOP to that number: `422 carrier_blocked`, with the same `number` and `since` fields. **What to do:** stop texting them. The patient lifts it by texting START to one of your numbers. - **An admin blocked the number** in the app: `422 number_blocked`, with the same `number` and `since` fields. A blocked number also can't text your organization. **What to do:** stop texting them. Only an admin can unblock it, in the app. - **The number can't receive texts**, because an earlier text failed with carrier error 30006 (a landline, or a carrier that couldn't be reached): `422 number_unreachable`, with the same `number` and `since` fields. **What to do:** [update the patient's](https://www.bloomtext.com/developers/api/reference/update-patient/) mobile number, or send `secure`. It also clears when the patient texts one of your numbers, or when an admin clears it in the app. If more than one applies, the code is the first of these. To check before you send, [retrieve the patient](https://www.bloomtext.com/developers/api/reference/get-patient/): `sms_opted_out` is true when the patient can't be texted for any reason, and `sms_undeliverable_reasons` lists why (`opted_out`, `carrier_blocked`, `admin_blocked`, `unreachable`). - **The patient has no phone number:** `422 patient_has_no_phone`. **What to do:** [update the patient](https://www.bloomtext.com/developers/api/reference/update-patient/), or send `secure` if they have an email address. The same check runs again when the text goes out, because a patient can reply STOP in between. Then the message is kept, and its `delivery.status` becomes `rejected`, with the reason in `delivery.error_code` (`patient_opted_out`, `carrier_blocked`, `number_blocked` or `number_unreachable`). Secure messages aren't refused for an opt-out or a block. As with a message staff send, the link still goes by email, and the text carrying the link is skipped. ## Long texts An SMS body can be up to 1,600 characters. A longer one returns `422 too_long`, with `length` and `max`: ```json filename="Response · 422 Unprocessable Entity" { "code": "too_long", "detail": "This text is 1,750 characters; SMS allows 1,600. Shorten it, split it yourself, or send it with channel \"secure\".", "length": 1750, "max": 1600 } ``` BloomText doesn't split a long text for you. You know where your text can break, and each piece would be a separate message. Keep in mind: - Carriers bill a long SMS as several segments, about 160 characters each, or 70 with emoji or non-Latin characters. - The first text a patient gets from your organization may end with a short opt-out line ("Reply STOP to stop") when it fits, so leave a little room. - A `secure` message can be up to 40,000 characters. ## Errors to handle | Status | Code | What to do | | --- | --- | --- | | 403 | `plan_required` | The organization's plan doesn't include patient messaging. Contact BloomText. A batch is refused whole. | | 404 | `not_found` | The `patient_id` doesn't exist in your organization, or `from` isn't one of its numbers. | | 409 | `ambiguous_recipient` | Pick a patient from `candidates` and send with `patient_id`, or add `patient.mrn`. | | 409 | `recipient_mismatch` | `patient.mrn` and `to.phone` point at different patients. Update the patient's phone, or send with `patient_id`. | | 422 | `channel_required` | Set `channel` to `sms` or `secure`. See [Secure or plain text](#secure-or-plain-text). | | 422 | `from_required` | Set `from` to one of the numbers in the error's `numbers`. | | 422 | `too_long` | Shorten the SMS, split it yourself, or send it `secure`. See [Long texts](#long-texts). | | 422 | `patient_has_no_phone` | Add a phone number, or send `secure` to a patient with an email address. | | 422 | `no_contact_method` | A `secure` send to a patient with neither phone nor email. [Update the patient](https://www.bloomtext.com/developers/api/reference/update-patient/). | | 422 | `patient_opted_out` | Stop texting them; they must reply START. See [Opt-outs and blocked numbers](#opt-outs-and-blocked-numbers). | | 422 | `carrier_blocked` | Stop texting them; they can text START to one of your numbers. | | 422 | `number_blocked` | Stop texting them; an admin blocked the number, and only an admin can unblock it. | | 422 | `number_unreachable` | The number can't receive texts. Update the patient's mobile number, or send `secure`. | Every send takes an `Idempotency-Key`, so a retry after a timeout never texts a patient twice. For automated jobs, derive the key from something stable, like the appointment ID. See [Idempotency](https://www.bloomtext.com/developers/api/idempotency/). ## Sending to many patients To send a different message to each of many patients, like a morning's appointment reminders, use [Send messages in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/). One request carries up to 60 messages, each the body of a single send: ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/messages:batch" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: 0b8e6f6a-3c1d-4f5e-9a2b-7c4d8e1f2a30" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "to": { "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" }, "body": "Reminder: your appointment is tomorrow at 9:30.", "channel": "secure" }, { "to": { "phone": "+15125550143" }, "body": "Reminder: your appointment is tomorrow at 10:00.", "channel": "sms" }, { "to": { "patient_id": "9f2d1c4b-0e3a-4b7c-8d6e-1a2b3c4d5e6f" }, "body": "Reminder: your appointment is tomorrow at 11:15.", "channel": "sms" } ] }' ``` Each message is checked exactly like a single send, and one message's error never fails the others. The exception is a field the API doesn't know: that's checked for the whole body first, and any unknown field in any message returns `422 unknown_field` for the batch, naming the message (`/messages/3/...`). Nothing is sent. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). The response is `207 Multi-Status`, with one result per message in the order you sent them: ```json filename="Response · 207 Multi-Status" { "results": [ { "index": 0, "id": "3f1e2d4c-5b6a-4789-8a1b-2c3d4e5f6a7b", "status": "queued" }, { "index": 1, "id": "7a6b5c4d-3e2f-4a1b-9c8d-7e6f5a4b3c2d", "status": "queued" }, { "index": 2, "error": { "type": "https://www.bloomtext.com/developers/api/errors/#patient_has_no_phone", "title": "Unprocessable Entity", "status": 422, "code": "patient_has_no_phone", "detail": "The patient has no phone number, so there's nothing to text. Add one with Update a patient, or send with channel \"secure\" if they have an email address.", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [] } } ] } ``` - **Retry the whole batch with the same `Idempotency-Key` and the same body.** One key covers the batch: a retry returns the same results and sends nothing twice. Fix a failed message, then send it again in a new request with a new key. - **It's one request toward the rate limits,** and each message counts toward your organization's 60 messages per minute, shared by all its API keys. 200 reminders are 4 batches of up to 60, one a minute. After a `429`, wait `Retry-After` and retry with the same `Idempotency-Key`. See [Rate limits](https://www.bloomtext.com/developers/api/rate-limits/). - Each queued message's delivery status is on the message, as for a single send. See [Delivery status](#delivery-status). - A message that waits for the patient's consent has `status: consent_requested` instead of `queued`. Its text goes out when the patient replies YES or staff record their consent, so don't send it again. To send the same message to many patients, you can also use a [campaign](https://www.bloomtext.com/developers/api/campaigns/). --- # API identities > Give your integration its own automated sender, a bot on your account with a name, avatar and chosen teams and numbers, and attach API keys to it so every message it sends comes from that sender. Source: https://www.bloomtext.com/developers/api/api-identity/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=api-identity) An API identity is an automated sender on your account, a bot your integration sends as: for example **Appointment reminders** or **EHR sync**. Owners and IT give it a name and an avatar, choose the teams and phone numbers it can use, and attach API keys to it. Staff see it in threads marked as automated, and every message it sends is recorded against it. An identity isn't a person: it isn't listed in the Directory or under People, isn't a billable seat, can't sign in, and sends only from its allowed teams and numbers. The identity is who sends. A key is only how your server proves it's that identity. One identity can have several keys, so you can rotate keys, or run the same integration from two servers, without changing who the messages come from. ```mermaid flowchart LR subgraph Account ID["API identity: Appointment reminders (automated)"] K1[Key: reminders-prod] --> ID K2[Key: reminders-rotation] --> ID ID -->|sends from| N["Pediatrics number (Front desk team)"] end N --> P[Patient] P -->|replies| T[Front desk team inbox] ``` ## Which keys need an identity | Key | Needs an identity | | --- | --- | | Has `messages.write` (sends to patients) | Yes. A sending key must be attached to an identity. | | Only reads: `messages.read`, `patients.read`, `members.read`, report and audit reads | No | | Provisioning: `members.write`, `teams.write`, `patients.write` without `messages.write` | No | On an account with API identities turned on, creating a key with `messages.write` asks which identity it belongs to, and a sending key can't be left without one. An identity never sends on behalf of a staff member. Messages from your integration always come from the identity, so staff and auditors can tell what your system sent from what a person sent. ## Create an identity ### Name it Under **Settings → Account → API keys**, in the **API identities** section, an Owner or IT person clicks **Create identity** and gives it: - a **name** staff and patients will recognize, like "Appointment reminders". Patients see it in secure chat. - an **avatar**, shown next to its messages in BloomText. It's always marked as automated, so no one mistakes it for a person. ### Choose where it can send Pick the **teams** and **phone numbers** the identity can use. Its keys can then send only from those numbers, and read only those teams' patient conversations. This is the same [phone-number limit](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers) a key can carry, set once for every key the identity has. ### Attach keys On the same tab, create a key with `messages.write` and choose the identity it belongs to, or attach an existing key from the identity's row. See [API keys](https://www.bloomtext.com/developers/api/api-keys/). ## What people see | Who | Sees | | --- | --- | | Staff, in the thread | The identity's name and avatar, marked as automated | | Owners and IT, in [Message reports](https://www.bloomtext.com/developers/api/reporting-and-audit/#in-bloomtext-for-owners-and-it) | The identity as the sender; the **Automated** filter shows only identities' messages | | Owners and IT, in the [Audit log](https://www.bloomtext.com/developers/api/reporting-and-audit/#in-bloomtext-for-owners-and-it) | The identity as the actor, and the key it used; the **Automated** filter shows only identities | | Anyone, in the Directory or People | Nothing: identities aren't listed there | | Patients, in secure chat | The identity's name | | Patients, on SMS | The office's phone number | A patient's reply lands in the sending number's team inbox, like any other patient message, so a person on that team picks it up. ## In the API Messages an identity sends carry it as their `sender`: ```json filename="Message.sender" { "id": "3f6c1a9e-0b7d-4c55-9a43-8f2d6e1b7a10", "name": "Appointment reminders", "kind": "api_identity" } ``` Sends follow the usual number rules: `from` must be one of the identity's numbers; with exactly one, it's the default; otherwise a send without `from` returns `422` with `code: from_required`. See [Which number it comes from](https://www.bloomtext.com/developers/api/send-messages/#which-number-it-comes-from). ## Rotate keys without changing the sender 1. Create a second key for the identity and deploy it. 2. Revoke the old key. Messages sent before and after the rotation come from the same identity. Revoking every key stops the identity from sending; it stays on the account, with its history, until an Owner or IT person deletes it. ## Today's default Until API identities are turned on for your account, a message sent with an API key shows the key's name, like "Reminder service", with an **API** marker, and its `sender.kind` is `api_key`. Patients see the clinic. Turning identities on doesn't change messages already sent. ## How this compares If your IT team knows chat platforms: an API identity works like a Slack bot user or a Discord bot. It's a named, automated sender with its own avatar and permissions, its tokens belong to it, it can't sign in as a person, and it doesn't take a seat. --- # Patients > Find patients by phone number or MRN; create, update and delete them, import them in bulk; and read each patient's conversations and messages. Source: https://www.bloomtext.com/developers/api/patients/ Find, create, update and delete the patients your organization messages, import them in bulk, and read each patient's conversations. A [patient](https://www.bloomtext.com/developers/api/reference/patient-object/) has a name, mobile number, email address, date of birth, and `mrn`, the patient's ID in your own system. Patients belong to the organization, not to a team or a staff member. ## Access Patient operations use an [API key](https://www.bloomtext.com/developers/api/api-keys/), and work the same with an [OAuth](https://www.bloomtext.com/developers/api/oauth/) token. You always name the patient, by ID, phone number, or MRN; there's no directory listing or name search. See [What the API can reach](https://www.bloomtext.com/developers/api/concepts/#what-the-api-can-reach). | To | You need | | --- | --- | | Find and read patients | `patients.read` | | Create, update and delete patients, and [import](#import-patients) them | `patients.write` | | Read a patient's conversations and messages | `messages.read` | | Message a patient, including a new phone number | `messages.write` | See [Scopes](https://www.bloomtext.com/developers/api/authentication/#scopes). ## Find a patient [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) by `phone`, `mrn`, or both: ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patients \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'mrn=MRN-20931' ``` A phone number can be in any common format, like `(512) 555-0143` or `+15125550143`. It can match more than one patient, like a family sharing a phone, so the response is a list. Patients are looked up by `phone` or `mrn` only. Bulk listing isn't available: a request with neither returns `400 patient_filter_required`. If you need to sync every patient between BloomText and your system, [contact BloomText](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access). Keeping each patient's `mrn` in BloomText is the most reliable way to link the two systems. Names change and phones get shared; your own ID doesn't. With a patient's BloomText `id`, [retrieve them](https://www.bloomtext.com/developers/api/reference/get-patient/) directly. ## Create a patient [Create a patient](https://www.bloomtext.com/developers/api/reference/create-patient/) needs a phone number, an email address, or both. BloomText first checks whether the patient already exists, using the same rules as its CSV import, so the API and the app never disagree about who someone is: 1. The same **MRN** in the organization. 2. Otherwise the same **phone number**, after normalizing the format. If several patients match, the most recently created one. 3. Otherwise the same **email address**. 4. Otherwise it's a new patient. A new patient returns `201`. A match returns `200` with `matched_by` set to `mrn`, `phone`, or `email`, and leaves the existing record as it was. [Update the patient](https://www.bloomtext.com/developers/api/reference/update-patient/) to change it. You don't need to create a patient before messaging them: sending to a new phone number creates one. See [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/#who-gets-it). ## Update or delete a patient [Update a patient](https://www.bloomtext.com/developers/api/reference/update-patient/) with only the fields that changed; send `null` to clear one. [Delete a patient](https://www.bloomtext.com/developers/api/reference/delete-patient/) removes the record, as deleting a patient in BloomText does. Their conversations stay in BloomText for your records and for the staff in them, and any campaign messages still waiting to go to them are cancelled. ## Import patients > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=patient-imports) To load many patients at once, like a nightly sync from your EHR, [import them](https://www.bloomtext.com/developers/api/reference/create-patient-import/). An import runs in the background and takes up to 10,000 patients as JSON or CSV. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/patient-imports \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: text/csv" \ --data-binary @patients.csv ``` ```text filename="patients.csv" first_name,last_name,dob,mrn,phone,email Jane,Doe,1986-04-12,MRN-20931,512-555-0143,jane.doe@example.com John,Doe,1979-11-02,MRN-20932,(512) 555-0188, ``` Each row is matched with the rules above. Poll [Retrieve an import](https://www.bloomtext.com/developers/api/reference/get-patient-import/) until `status` is `completed`, then read each row's outcome: ```json filename="Response · 200 OK" { "id": "imp_71c2", "status": "completed", "rows": 2, "created": 1, "matched": 1, "failed": 0, "results": [ { "row": 1, "outcome": "matched", "matched_by": "mrn", "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "error": null }, { "row": 2, "outcome": "created", "matched_by": null, "patient_id": "9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98", "error": null } ], "created_at": "2026-09-26T06:00:00Z" } ``` Matched rows don't change existing patients; if your system has newer details, update those patients afterwards. Use each row's `patient_id` to [add the patients to a campaign](https://www.bloomtext.com/developers/api/campaigns/#add-recipients). ## A patient's conversations and messages Pass `patient_id` to limit the conversation and message lists to one patient: - [List patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) with `patient_id` returns every conversation with that patient in the organization, one per clinic phone number they've texted with. - [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) with `patient_id` returns their messages across all those conversations, from everyone in them, and takes a time range and `q` like any read. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/). ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'patient_id=5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77' \ --data-urlencode 'after=2026-09-01' \ --data-urlencode 'group_by=conversation' ``` To pick up every patient's replies at once, read messages with `after` set to your last check and `q=from:patient`. See [Keep up with new messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages). --- # Campaigns > Send one message to many patients from a clinic phone number. Create, start, pause, stop, and archive campaigns, and track each delivery. Source: https://www.bloomtext.com/developers/api/campaigns/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) Use a campaign to send the same message to many patients, one at a time, from a clinic phone number: flu shot reminders, a new office address, forms everyone needs to fill out. Campaigns are the API counterpart of [broadcasts](https://www.bloomtext.com/how-to/broadcasts/overview/) in the BloomText app, which already personalize each message, can be scheduled, and can be paused and resumed. This page describes the Campaigns API. Each patient gets the message in their own conversation on that phone number, so replies come back to the team like any other patient message. Campaigns use an [API key](https://www.bloomtext.com/developers/api/api-keys/) with the `messages.write` scope to create, change, and run them, and `messages.read` to check on them. Messages come from the [API identity](https://www.bloomtext.com/developers/api/api-identity/) the key belongs to, like "Appointment reminders"; until identities are on for your account, they show the key's name. ## The lifecycle ```mermaid stateDiagram-v2 [*] --> draft: Create draft --> running: Start running --> paused: Pause paused --> running: Start running --> completed: Every recipient sent running --> stopped: Stop paused --> stopped: Stop ``` | `status` | Meaning | You can | | --- | --- | --- | | `draft` | Created, not yet sent. | Edit everything, add and remove recipients, start, delete. | | `running` | Sending, one message every `send_interval_seconds`. | Add recipients, pause, stop. | | `paused` | Sending is on hold. | Edit the message, channel, and pace, add and remove recipients, start again to resume, stop. | | `completed` | Every recipient was sent to. | Archive. | | `stopped` | Stopped early. Unsent recipients were cancelled. | Archive. It can't be restarted. | ## Send a campaign ### Create it ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/campaigns \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "name": "Flu shot reminders, October", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "from": "+15125550100" }' ``` Every recipient gets the same `body`, up to 1,600 characters. `name` is for staff; patients never see it. Like [single messages](https://www.bloomtext.com/developers/api/send-messages/#secure-or-plain-text), campaigns are secure unless you set `channel` to `sms`. `from`, the phone number to send from, defaults to the key's default number, or the organization's only number. `send_interval_seconds` (0.5 to 30, default 1) sets the pace. ### Add recipients Add up to 10,000 patient IDs per request. To reach patients you've loaded from your EHR, [import them](https://www.bloomtext.com/developers/api/patients/#import-patients) first and use the IDs from the import results. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"patient_ids": ["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}' ``` ```json filename="Response · 200 OK" { "changed": 2, "skipped": [] } ``` Unknown patient IDs come back in `skipped` with `reason: not_found`, and patients already on the campaign with `already_added`. Recipients are always patient IDs; there's no "every patient" option. To take patients off while the campaign is a draft or paused, use [Remove campaign recipients](https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/). ### Start it ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` BloomText sends to one recipient every `send_interval_seconds`, in the order they were added. A campaign of 400 patients at the default pace takes about seven minutes. ### Watch it go [Retrieve the campaign](https://www.bloomtext.com/developers/api/reference/get-campaign/) for its `counts`, or [list its recipients](https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/) for each patient's status: ```json filename="counts" { "recipients": 412, "pending": 148, "sent": 264, "delivered": 251, "failed": 6, "skipped": 0 } ``` ## Recipient status | `status` | Meaning | | --- | --- | | `pending` | Waiting its turn. | | `sending` | Being sent now. | | `sent`, `delivered`, `opened` | On its way, confirmed delivered, or the secure link was opened. | | `failed`, `undelivered` | Didn't reach the patient. `error` says why, like `landline`. | | `skipped` | Couldn't be sent, like `opted_out` for an SMS campaign or `no_contact_method`. | | `cancelled` | The campaign was stopped before this patient's turn. | List only the ones that need attention with `?status=failed`. Each sent recipient has a `message_id`, and the message sits in that patient's conversation on the campaign's phone number. Messages a campaign sent carry its `campaign_id`. To pick up replies, [read messages](https://www.bloomtext.com/developers/api/read-messages/) from the campaign's start with `q=from:patient`. ## Change a campaign [Update a campaign](https://www.bloomtext.com/developers/api/reference/update-campaign/) with only the fields you want to change: - **Name, message, channel, phone number, and pace** can change while the campaign is a draft or paused. Pause it first to fix a typo mid-send; patients already sent to keep the original. - **Phone number** (`from`) can change only while it's a draft. - **`archived: true`** hides a finished campaign from [List campaigns](https://www.bloomtext.com/developers/api/reference/list-campaigns/). Archiving isn't allowed while it's running. `archived: false` brings it back. A change the campaign's status doesn't allow returns `409 campaign_not_editable`. ## Pause, stop, and delete - [Pause](https://www.bloomtext.com/developers/api/reference/pause-campaign/) holds sending after the message in progress. [Start](https://www.bloomtext.com/developers/api/reference/start-campaign/) it again to carry on where it left off. - [Stop](https://www.bloomtext.com/developers/api/reference/stop-campaign/) ends the campaign for good; recipients who haven't been sent to are `cancelled`. To send to them later, create a new campaign. - [Delete](https://www.bloomtext.com/developers/api/reference/delete-campaign/) removes a draft. Once a campaign has started, its messages are in patients' conversations, so it can't be deleted; archive it instead. ## Good to know - Plain SMS campaigns put the message on patients' phones and the carrier's network. Keep clinical detail out of them. - In SMS campaigns, opted-out patients are skipped and show as `skipped` with `error: opted_out`. - Every recipient of an API campaign gets the same text. For personalized messages from the API, loop over [Send a message to a patient](https://www.bloomtext.com/developers/api/send-messages/) instead. Broadcasts in the BloomText app fill in names and other details with variables like `{{first_name | there}}`. --- # Webhooks > Get a signed HTTPS request when a patient writes in or a text's delivery status changes, instead of polling. Set up, events, payloads, signature checks, retries and secret rotation. Source: https://www.bloomtext.com/developers/api/webhooks/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=webhooks) A webhook sends your server an HTTPS request when something happens in BloomText: a patient writes in, or a text your key sent is delivered or fails. You stop polling [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) and react within seconds. Webhooks carry IDs and a status, never message text. Your server fetches the details with the API, using the same key, so patient data only ever travels over an authenticated call. ## Set up a webhook ### Add the URL to a key Each API key has at most one webhook. Under **Settings → Account → API keys**, an Owner or IT person opens the key and clicks **Webhook**, then sets: - the **URL**: `https` only, on a server you control. BloomText doesn't follow redirects. - the **events** to send. Only events the key's scopes allow are offered. ### Store the signing secret BloomText shows the webhook's signing secret once, starting with `whsec_`. Store it with the key, in your secrets manager. ### Send a test Click **Send test event**. BloomText sends a `webhook.test` event, and the webhook's page shows your server's response. ## Events | Event | Sent when | The key needs | | --- | --- | --- | | `message.received` | A patient sends a message, on any channel, in an organization the key reaches. A key with a [phone-number limit](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers) gets only messages to its numbers' teams. | `messages.read` | | `message.status` | A text this key sent changes delivery status: `sent`, `delivered`, `failed`, `undelivered` or `rejected`. See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status). | `messages.write` | | `webhook.test` | You click **Send test event**. | — | ## The payload Every event has the same envelope: ```json filename="message.received" { "id": "0f8e2a1c-6b4d-4f7e-9a2b-3c5d7e9f1a2b", "type": "message.received", "occurred_at": "2026-11-02T14:05:12Z", "org_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "data": { "message_id": "9c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "channel": "sms" } } ``` ```json filename="message.status" { "id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "type": "message.status", "occurred_at": "2026-11-02T14:06:40Z", "org_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "data": { "message_id": "7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "patient_id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "status": "failed", "error_code": "30006" } } ``` `id` is the event's ID and stays the same on every retry. To read the message, call [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) with `message_id` and `org_id`. ## Check the signature BloomText signs every request following [Standard Webhooks](https://www.standardwebhooks.com/). Each request has three headers: | Header | Value | | --- | --- | | `webhook-id` | The event's `id` | | `webhook-timestamp` | When it was sent, in seconds since the Unix epoch | | `webhook-signature` | `v1,` and the Base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}`, keyed with the secret after `whsec_`, Base64-decoded. During a secret rotation it lists two signatures, separated by spaces. | Check the signature against the raw request body, before parsing it, and reject a timestamp more than 5 minutes from your clock. ```js filename="verify.js" import crypto from 'node:crypto' export function verifyWebhook(headers, rawBody, secret) { const id = headers['webhook-id'] const timestamp = Number(headers['webhook-timestamp']) if (!id || !timestamp || Math.abs(Date.now() / 1000 - timestamp) > 300) return false const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64') const expected = crypto.createHmac('sha256', key).update(`${id}.${timestamp}.${rawBody}`).digest() return headers['webhook-signature'].split(' ').some((part) => { const [version, signature] = part.split(',') const given = Buffer.from(signature ?? '', 'base64') return version === 'v1' && given.length === expected.length && crypto.timingSafeEqual(given, expected) }) } ``` ```python filename="verify.py" import base64, hashlib, hmac, time def verify_webhook(headers, raw_body: bytes, secret: str) -> bool: webhook_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp", "") if not webhook_id or not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{webhook_id}.{timestamp}.".encode() + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() return any( part.startswith("v1,") and hmac.compare_digest(part[3:], expected) for part in headers.get("webhook-signature", "").split(" ") ) ``` Standard Webhooks libraries in most languages do the same check. ## Delivery - **Answer fast.** Return any `2xx` within 5 seconds. Do the work afterwards, for example from a queue. - **Retries.** Anything else, or no answer, is retried at 1 minute, 5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours after the first try. `410 Gone` stops retries for that event. - **At least once, in any order.** The same event can arrive twice, and events can arrive out of order. Skip an `id` you've already handled, and use `occurred_at`, or the message itself, for order. - **No fixed addresses.** Requests don't come from a fixed set of IP addresses. Trust the signature, not the sender's address. If your server was down for longer than the retries cover, catch up by [reading messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages) since the last event you handled. ## Rotate the secret On the key's **Webhook** page, click **Rotate secret**. BloomText shows the new secret once. For the next 24 hours it signs every request with both the old and the new secret, so deploy the new one, then let the old one lapse. ## Turn a webhook off Remove the URL from the key, or revoke the key. Revoking a key stops its webhook at once. --- # Build an AI agent > Give an AI agent BloomText tools, with an API key for patient work or an org admin's OAuth token for their own conversations, and clear rules for what it sends. Source: https://www.bloomtext.com/developers/api/ai-agents/ Give an AI agent BloomText tools so it can answer questions like "what did I miss yesterday?", "has anyone replied about the Doe referral?", or "what am I supposed to follow up on this week?". Pick the credential by the job: - For patient work (look up a patient, read what they wrote, text them), use an [API key](https://www.bloomtext.com/developers/api/api-keys/). Tools take a patient ID, phone number, or MRN. - For an admin's own inbox (search their chats, summarize, draft replies), use the admin's [OAuth token](https://www.bloomtext.com/developers/api/oauth/). Only org admins can connect apps for now. ## The inbox assistant > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) The rest of this page builds the inbox assistant. Through OAuth, the agent acts as the admin who connected it. Under `/me` it sees only the admin's own conversations, and it can also use the Patient API, always within the [scopes](https://www.bloomtext.com/developers/api/authentication/#scopes) the admin approved. Staff see your app's name as the "via" label on anything sent through it. The admin can disconnect it at any time. ## Give the model tools, not tokens Your code holds the user's access token and makes every API request. The model sees only tool definitions and results. Three tools cover most assistants: | Tool | Calls | Scope | | --- | --- | --- | | `search_messages` | [`GET /me/messages?q=…&after=…`](https://www.bloomtext.com/developers/api/reference/list-messages/) | `messages.read` | | `read_conversation` | [`GET /me/messages?conversation_id=…`](https://www.bloomtext.com/developers/api/reference/list-messages/) | `messages.read` | | `propose_message` | Nothing. It shows a draft to the user, who sends it from your UI. To let the agent send on its own, swap in a `send_message` tool that calls [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) (`POST /me/conversations/{id}/messages`). | `messages.write` | For patient work, add a `find_patient` tool that calls [`GET /patients?mrn=…`](https://www.bloomtext.com/developers/api/reference/list-patients/) or `?phone=…`, and read a patient's history with [`GET /patient-messages?patient_id=…`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/). With an API key, point `search_messages` at `GET /patient-messages`, which covers patient conversations rather than the admin's own. The search operators are short, so a one-sentence tool description that lists them is enough. Put time in separate `after` and `before` inputs, not in `q`. ```mermaid flowchart LR U[User asks a question] --> M[Model] M -->|search_messages| S["GET /me/messages?q=…&after=…"] S --> M M -->|read_conversation| R["GET /me/messages?conversation_id=…"] R --> M M -->|propose_message| P[Draft shown to the user] P -->|User clicks Send| W["POST /me/conversations/{id}/messages"] ``` ## Example ```js filename="agent.mjs" import Anthropic from '@anthropic-ai/sdk' const anthropic = new Anthropic() const API = 'https://api.bloomtext.com/v1' const tools = [ { name: 'search_messages', description: "Search the user's BloomText messages across all their conversations, newest first. q takes words and operators: " + 'free text, "phrases", from:me|patient|staff, mrn:, is:unread, is:failed, -term, OR. ' + 'Put the time range in after and before (YYYY-MM-DD or an RFC 3339 timestamp), not in q.', input_schema: { type: 'object', properties: { q: { type: 'string' }, after: { type: 'string' }, before: { type: 'string' }, order: { type: 'string', enum: ['desc', 'asc'] }, }, }, }, { name: 'read_conversation', description: 'Read the most recent messages in one conversation, from everyone in it, for context.', input_schema: { type: 'object', properties: { conversation_id: { type: 'string' } }, required: ['conversation_id'] }, }, { name: 'propose_message', description: 'Suggest a message for the user to review and send. It is never sent without the user clicking Send.', input_schema: { type: 'object', properties: { conversation_id: { type: 'string' }, body: { type: 'string' } }, required: ['conversation_id', 'body'], }, }, ] const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i const compact = (m) => ({ id: m.id, at: m.created_at, conversation: m.conversation, from: `${m.sender.name} (${m.sender.kind})`, body: m.body, unread: m.unread }) async function bloomtext(accessToken, path, params = {}) { const url = new URL(`${API}${path}`) for (const [key, value] of Object.entries(params)) url.searchParams.set(key, value) const response = await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }) if (!response.ok) return { error: (await response.json()).code } return (await response.json()).data.map(compact) } // Answers one question for one user. `accessToken` never reaches the model. export async function ask(accessToken, question, { showDraft }) { const messages = [{ role: 'user', content: question }] while (true) { const reply = await anthropic.messages.create({ model: 'claude-sonnet-5', max_tokens: 2000, system: `You help a clinic staff member with their BloomText messages. Today is ${new Date().toDateString()}. Report what messages say; never give clinical advice.`, tools, messages, }) messages.push({ role: 'assistant', content: reply.content }) if (reply.stop_reason !== 'tool_use') return reply.content.find((block) => block.type === 'text')?.text const results = [] for (const call of reply.content.filter((block) => block.type === 'tool_use')) { let result if (call.name === 'search_messages') { const { q, after, before, order = 'desc' } = call.input result = await bloomtext(accessToken, '/me/messages', { ...(q && { q }), ...(after && { after }), ...(before && { before }), order, 'page[limit]': '50' }) } // IDs come from the model, so check them before they reach a request. if (call.name !== 'search_messages' && !UUID.test(call.input.conversation_id)) result = { error: 'invalid_conversation_id' } else if (call.name === 'read_conversation') result = await bloomtext(accessToken, '/me/messages', { conversation_id: call.input.conversation_id, 'page[limit]': '30' }) else if (call.name === 'propose_message') result = await showDraft(call.input) // your UI shows the conversation and text results.push({ type: 'tool_result', tool_use_id: call.id, content: JSON.stringify(result) }) } messages.push({ role: 'user', content: results }) } } ``` ```python filename="agent.py" import json import re from datetime import date import anthropic import requests client = anthropic.Anthropic() API = "https://api.bloomtext.com/v1" UUID = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", re.I) TOOLS = [ { "name": "search_messages", "description": ( "Search the user's BloomText messages across all their conversations, newest first. q takes words and operators: " 'free text, "phrases", from:me|patient|staff, mrn:, is:unread, is:failed, -term, OR. ' "Put the time range in after and before (YYYY-MM-DD or an RFC 3339 timestamp), not in q." ), "input_schema": { "type": "object", "properties": { "q": {"type": "string"}, "after": {"type": "string"}, "before": {"type": "string"}, "order": {"type": "string", "enum": ["desc", "asc"]}, }, }, }, { "name": "read_conversation", "description": "Read the most recent messages in one conversation, from everyone in it, for context.", "input_schema": {"type": "object", "properties": {"conversation_id": {"type": "string"}}, "required": ["conversation_id"]}, }, { "name": "propose_message", "description": "Suggest a message for the user to review and send. It is never sent without the user clicking Send.", "input_schema": { "type": "object", "properties": {"conversation_id": {"type": "string"}, "body": {"type": "string"}}, "required": ["conversation_id", "body"], }, }, ] def compact(m: dict) -> dict: return {"id": m["id"], "at": m["created_at"], "conversation": m["conversation"], "from": f"{m['sender']['name']} ({m['sender']['kind']})", "body": m["body"], "unread": m["unread"]} def bloomtext(access_token: str, path: str, params: dict) -> list | dict: response = requests.get(f"{API}{path}", headers={"Authorization": f"Bearer {access_token}"}, params=params) if not response.ok: return {"error": response.json()["code"]} return [compact(m) for m in response.json()["data"]] def ask(access_token: str, question: str, show_draft) -> str: """Answers one question for one user. access_token never reaches the model.""" messages = [{"role": "user", "content": question}] while True: reply = client.messages.create( model="claude-sonnet-5", max_tokens=2000, system=f"You help a clinic staff member with their BloomText messages. Today is {date.today()}. " "Report what messages say; never give clinical advice.", tools=TOOLS, messages=messages, ) messages.append({"role": "assistant", "content": reply.content}) if reply.stop_reason != "tool_use": return next((block.text for block in reply.content if block.type == "text"), "") results = [] for call in (block for block in reply.content if block.type == "tool_use"): if call.name == "search_messages": params = {key: call.input[key] for key in ("q", "after", "before") if call.input.get(key)} result = bloomtext(access_token, "/me/messages", {**params, "order": call.input.get("order", "desc"), "page[limit]": 50}) # IDs come from the model, so check them before they reach a request. elif not UUID.match(call.input.get("conversation_id", "")): result = {"error": "invalid_conversation_id"} elif call.name == "read_conversation": result = bloomtext(access_token, "/me/messages", {"conversation_id": call.input["conversation_id"], "page[limit]": 30}) else: result = show_draft(call.input) # your UI shows the conversation and text results.append({"type": "tool_result", "tool_use_id": call.id, "content": json.dumps(result)}) messages.append({"role": "user", "content": results}) ``` When the user clicks **Send** on a draft, your code calls [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) (`POST /me/conversations/{id}/messages`) with their token and an [idempotency key](https://www.bloomtext.com/developers/api/idempotency/) derived from the draft, so a double click sends once. ## Guardrails that matter - Have the agent propose messages and let the person send them from your UI. For messages your system sends on its own, like reminders, use an API key that belongs to an [API identity](https://www.bloomtext.com/developers/api/api-identity/), so they come from a named automated sender. - Treat message text as untrusted. Patients and staff write what the agent reads, and that text can try to steer the model. Check every ID the model passes to a tool, and never let message content widen what the agent may do. - Start read-only. Ask for `messages.read` first. Request `messages.write` only when you add sending, and explain why on your own screen before the user approves it. - Keep the job narrow. A clear list of what the agent may do beats a long list of what it may not. - Never let it act clinically: no diagnoses, dosing, or triage advice. Have it quote and link the original messages instead. - Keep the token out of the model. Tools take IDs and queries, never credentials. - Know what changes read state. Searching and reading never mark anything as read, but a message the agent sends marks its conversation as read. If the user should still see the conversation as unread, have the agent propose the reply instead. - Use a model provider that has a BAA with your organization. The agent reads PHI. - Log every tool call with the user, the query, and whether a draft was sent. --- # Manage members > Add, change, and remove staff members and team placements across the organizations on your account with an account API key, so an HR or identity system keeps BloomText in step. Source: https://www.bloomtext.com/developers/api/members-api/ An account API key can keep BloomText's staff in step with your HR or identity system: add a new hire to the right organizations and teams, change their role, and remove them when they leave. Your account is the subscription your organizations share, and the key reaches all of them or the ones picked when it was made. ### Get an account key BloomText turns accounts on per account, on request; in an account without them, these endpoints return `403` with `code: accounts_not_enabled`. An Owner or IT person creates the key under **Settings → Account → API keys**, with the scopes it needs: - `members.read` to list organizations, members, teams, and member events. - `members.write` to add, change, and remove members. - `teams.write` to put members on teams and take them off. See [API keys](https://www.bloomtext.com/developers/api/api-keys/) for expiry, rotation, and storage. ### Find the organization List the organizations the key reaches. Pass one's `id` as `org_id` on the other calls. A key that reaches only one organization can leave `org_id` out; a key that reaches several gets `400 org_id_required` without it. ```bash filename="Request" curl https://api.bloomtext.com/v1/orgs \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```json filename="Response · 200 OK" { "data": [ { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic", "is_default": true }, { "id": "0c5a7e2d-3f41-4b8e-9d26-5a1c8e7f9b30", "name": "Eastside Clinic", "is_default": false } ], "pagination": { "next_cursor": null, "has_more": false } } ``` ### Add a member Add a person by email. A new email creates their BloomText user, owned by your account. They get an invite email only with `send_invite_email: true`; leave it `false` when they sign in another way or you'll invite them later. ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/members?org_id=$ORG_ID" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "email": "jordan.lee@clinic.example", "first_name": "Jordan", "last_name": "Lee", "role": "user", "title": "Front desk", "send_invite_email": false }' ``` ```json filename="Response · 201 Created" { "id": "9f2c4b1a-7d3e-4a5b-8c6d-1e2f3a4b5c6d", "org_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "email": "jordan.lee@clinic.example", "first_name": "Jordan", "last_name": "Lee", "role": "user", "account_role": null, "managed_by": "api", "managed_by_name": "HR sync" } ``` The member's `id` is their BloomText user ID, the same in every organization. To add them to a second organization, repeat the call with that organization's `org_id`. ### Put them on a team List the organization's teams with [`GET /teams`](https://www.bloomtext.com/developers/api/reference/list-teams/), then add the member by `member_id`: ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/teams/$TEAM_ID/members" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "member_id": "9f2c4b1a-7d3e-4a5b-8c6d-1e2f3a4b5c6d" }' ``` The member must already be in the team's organization. It returns `201` with the team, also when they were already on it. Team calls take no `org_id`: the team names its organization. ## Who manages a membership Each membership has one manager, in `managed_by`: | `managed_by` | Who changes it | In BloomText it shows | | --- | --- | --- | | `api` | Only API keys. `managed_by_name` is the key that added it. | **🔒 Managed by API: HR sync**, with no Manage or Remove | | `admin` | People in BloomText. The API answers `409 managed_by_admin`. | A normal member row | | `account` | An Owner or IT person's membership, in every organization, set on the Account page. The API answers `409 managed_by_account`. | **🔒 Set on the Account page** | | `okta` | The account's Okta rules, through Directory Sync. The API answers `409 managed_by_identity_provider`. | **🔒 Managed by Okta** | `account_role` is `owner` or `it` for Owners and IT, and `null` for everyone else. Account roles are set only in BloomText: no API call, and no Okta rule, makes someone an Owner or gives them the IT role. `admin` in the API is what BloomText's People list calls **Manual**. Everyone who joined before your sync started is `admin`, so a sync's first run should read the members first and leave those rows to people in BloomText; the API manages only the members it adds. The same rule covers teams: [`DELETE /teams/{teamId}/members/{memberId}`](https://www.bloomtext.com/developers/api/reference/remove-team-member/) takes off only people the API put on the team. ### With Okta Directory Sync When your account connects Okta, its rules decide which organizations, role and teams each person in Okta gets, and those memberships show `managed_by: "okta"`. See [SSO and Directory Sync](https://www.bloomtext.com/developers/api/identity-and-sso/). For the API that means: - The API can't change or remove a membership or team placement Okta manages. It answers `409 managed_by_identity_provider`; change the person in Okta or in the account's rules. - When an Owner or IT person saves a rule, Okta takes over the matching memberships that people in BloomText or an API key made. Their `managed_by` becomes `okta`, and from then on your sync gets `409` for them. - Deactivating, suspending or deleting someone in Okta removes every membership they have on the account, including the ones an API key made. - The account's **Allow Admins to invite people outside Okta** switch limits organization Admins in BloomText. It doesn't limit API keys. Pick one source of truth per person. Use Directory Sync when Okta is where your staff live; use the API for people Okta doesn't cover, such as contractors, or when your HR system is the source. ## Run a sync A sync that keeps BloomText in step with an HR system usually runs on a schedule, once per organization: 1. Read the organization's members with [`GET /members?org_id=…`](https://www.bloomtext.com/developers/api/reference/list-members/), following `next_cursor` to the end. Match them to your records by email. 2. Leave alone everyone whose `managed_by` isn't `api`: people in BloomText, the Account page or Okta manage them. 3. Add the people who are missing with `POST /members`. Derive the `Idempotency-Key` from something stable, such as the employee ID and the organization, so a retried run never adds anyone twice. 4. Change role and title with `PATCH /members/{memberId}`. For a line-of-business lead who should run their organization, set `role` to `admin` in that organization. 5. Remove leavers with `DELETE /members/{memberId}?confirm_delete_user=true`. 6. Put people on their teams with `POST /teams/{teamId}/members`; list the teams with [`GET /teams`](https://www.bloomtext.com/developers/api/reference/list-teams/). 7. Check the result with [`GET /member-events`](https://www.bloomtext.com/developers/api/reference/list-member-events/). Every call counts toward the organization's limit of 300 requests a minute; see [Rate limits](https://www.bloomtext.com/developers/api/rate-limits/). ## Change a member [`PATCH /members/{memberId}`](https://www.bloomtext.com/developers/api/reference/update-member/) changes the `role` (`admin` or `user`) or `title` of a membership the API manages. ```bash filename="Request" curl -X PATCH "https://api.bloomtext.com/v1/members/$MEMBER_ID?org_id=$ORG_ID" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "role": "admin" }' ``` ## Remove a member [`DELETE /members/{memberId}`](https://www.bloomtext.com/developers/api/reference/delete-member/) removes a membership the API manages, and answers `204`. When this is the person's only organization and your account owns their user, removing them deletes their BloomText user, and they can no longer sign in. The API asks you to confirm that. Without `confirm_delete_user=true` the call changes nothing and answers: ```json filename="Response · 409 Conflict" { "type": "https://www.bloomtext.com/developers/api/errors/#confirmation_required", "title": "Conflict", "status": 409, "code": "confirmation_required", "reason": "would_delete_user", "detail": "This is the person's only organization, so removing them deletes their BloomText user and they can't sign in. Repeat the call with confirm_delete_user=true to do that.", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [] } ``` Repeat it with the confirmation to remove and delete them: ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/members/$MEMBER_ID?org_id=$ORG_ID&confirm_delete_user=true" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` Someone who is also in another organization is only removed from this one, with or without the flag. A sync that offboards people can always send `confirm_delete_user=true` when it means "this person has left". ## See what changed [`GET /member-events`](https://www.bloomtext.com/developers/api/reference/list-member-events/) lists who was added, approved, or removed in an organization, newest first, and who did it. A change an API key made shows `actor_name` as `API key: HR sync`, and a change Okta made shows `Okta directory`. BloomText's member history export names them the same way, and Owners and IT see the API's changes in the account's [Audit log](https://www.bloomtext.com/how-to/security/audit-log/) as **API key: HR sync**. ## Errors | Code | Status | Meaning | | --- | --- | --- | | `org_id_required` | 400 | The key reaches several organizations. Pass `org_id`. | | `org_not_reachable` | 403 | The key can't reach the organization in `org_id`. | | `accounts_not_enabled` | 403 | Accounts are off for this account. Contact BloomText to turn them on. | | `already_member` | 409 | The person is already in that organization. | | `patient_account` | 409 | The email belongs to a patient's BloomText account. | | `managed_by_admin` | 409 | People in BloomText manage this membership or team placement. | | `managed_by_account` | 409 | This is an Owner or IT person's membership. | | `managed_by_identity_provider` | 409 | The account's Okta rules manage this membership or team placement. Change it in Okta or in the rules. | | `confirmation_required` | 409 | Removing them deletes their user. Add `confirm_delete_user=true`. | See [Errors](https://www.bloomtext.com/developers/api/errors/) for the problem object and every other code. --- # SSO and Directory Sync > How Okta single sign-on and Directory Sync work with BloomText, what they manage, how they fit with the members API, and which identity providers BloomText supports. Source: https://www.bloomtext.com/developers/api/identity-and-sso/ Staff can sign in to BloomText with Okta, and Okta can add, change and remove them automatically through Directory Sync. This page is for IT teams deciding how single sign-on (SSO), Directory Sync and the [members API](https://www.bloomtext.com/developers/api/members-api/) fit together. The setup steps are in the admin help: [Okta setup guide for IT](https://www.bloomtext.com/how-to/admin/okta-it-setup-guide/) and [Set up single sign-on](https://www.bloomtext.com/how-to/admin/set-up-sso/). ## Identity providers Okta first; Microsoft Entra ID, Google Workspace and other SAML/SCIM directories through the same WorkOS setup, turned on when you ask. An account connects one identity provider. BloomText uses WorkOS for SSO and Directory Sync, so your IT team sets up a SAML app and a SCIM directory in Okta through WorkOS's setup portal; there's no Okta Integration Network tile to install. ## How it's turned on 1. BloomText turns on SSO for your account. 2. An Owner or IT person opens **Settings → Account → Okta & rules** in BloomText and clicks **Set up in WorkOS**. The setup portal walks them through verifying your email domain, adding BloomText to Okta as a SAML app, and connecting your Okta directory (SCIM). 3. They write rules that decide where people go (below), then assign people or groups to the BloomText app in Okta. 4. Optionally, they turn on **Require SSO**, which covers every organization on the account: people with an email on your domain then sign in only with SSO. SSO and rules are set up in BloomText, not through the API. There are no `/v1` endpoints for SSO settings, rules or the directory. ## What Directory Sync does Directory Sync reads the people assigned to BloomText in Okta, with their email, name, department, office, title and groups, and applies the account's rules: - **A rule** is one Okta group, or up to three attributes (department, office and title) that must all match. It gives a person an organization, the Admin or User role, and teams in that organization. Every matching rule applies; within one organization the higher role wins and the teams add up. - **The last rule** catches everyone no other rule matches and puts them in an organization you choose. Who reaches BloomText at all is decided by who is assigned to the app in Okta. - **Rules never make someone an Owner or give them the IT role.** Those are set only on the Account page in BloomText. - **Before saving**, an Owner or IT person sees a preview of who will be added, taken over, removed or skipped, and confirms removals a second time. **Test a person** shows where one person would land and which conditions match. Changes in Okta usually reach BloomText within about five minutes. When someone is deactivated, suspended or deleted in Okta, BloomText removes every membership they have on the account, whoever made it, removes any Owner or IT role, withdraws pending join requests and signs them out on every device. Their BloomText user is kept. People are matched to their BloomText user by their Okta email. Someone who signs in with SSO before a rule gives them a place becomes a join request to the account's default organization, labelled **via SSO**. ## With the members API Directory Sync and the [members API](https://www.bloomtext.com/developers/api/members-api/) can both manage people on one account, but not the same membership: | | Directory Sync | Members API | | --- | --- | --- | | Source of truth | Okta | Your HR or other system | | `managed_by` on the memberships it makes | `okta` | `api` | | Changing the other's memberships | Takes over admin- and API-made memberships that a rule matches, when an Owner or IT person saves the rule | Answers `409 managed_by_identity_provider` | | Leavers | Deactivate them in Okta | `DELETE /members/{memberId}` | The account's **Allow Admins to invite people outside Okta** switch stops organization Admins in BloomText from inviting people Okta doesn't manage. It doesn't apply to API keys. Choose per person: use Directory Sync when Okta is where your staff live, and the members API for people outside Okta, such as contractors, or when your HR system is the source. Membership changes from both show in [`GET /member-events`](https://www.bloomtext.com/developers/api/reference/list-member-events/) as `Okta directory` or `API key: `. ## Sign-in security with SSO - Okta's sign-in is the only extra check: BloomText doesn't text a code to people who sign in with SSO, so require MFA in the BloomText app's sign-on policy in Okta. - Quick-login PINs are off for SSO sign-ins. - What BloomText sends to WorkOS is limited to your default organization's name, a sign-in email hint and WorkOS IDs; what comes back is each person's name, email, department, office, title and groups. No patient information is shared. ## Related - [Manage members](https://www.bloomtext.com/developers/api/members-api/): the API for staff and teams. - [Okta setup guide for IT](https://www.bloomtext.com/how-to/admin/okta-it-setup-guide/), [Set up single sign-on](https://www.bloomtext.com/how-to/admin/set-up-sso/), [Sign in with SSO](https://www.bloomtext.com/how-to/security/single-sign-on/) in the admin help. - [Security and BAA](https://www.bloomtext.com/developers/api/security-and-baa/). --- # Read messages > Read BloomText patient messages in a time range with GET /patient-messages, one by one or grouped by conversation, and keep up with new ones; with OAuth, a person's own messages under /me. Source: https://www.bloomtext.com/developers/api/read-messages/ Read every message in a time range, newest first, one by one or grouped by conversation. With an API key, that's `GET /patient-messages`. With [OAuth](https://www.bloomtext.com/developers/api/oauth/), `GET /me/messages` reads a person's own conversations the same way. Both take the same range, cursor, and grouping, and differ only in whose conversations they read. | | Patient API | OAuth | | --- | --- | --- | | Endpoint | [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) | [`GET /me/messages`](https://www.bloomtext.com/developers/api/reference/list-messages/) | | Credential | An [API key](https://www.bloomtext.com/developers/api/api-keys/) | A person's [OAuth](https://www.bloomtext.com/developers/api/oauth/) token | | Reads | Patient conversations, across the organization | The person's own conversations: team chats and their patient chats | | Conversations list | [`GET /patient-conversations`](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) | [`GET /me/conversations`](https://www.bloomtext.com/developers/api/reference/list-conversations/) | For example, the last week: ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'after=2026-09-21T00:00:00Z' \ --data-urlencode 'before=2026-09-28T00:00:00Z' ``` ```bash filename="Request" curl -G https://api.bloomtext.com/v1/me/messages \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ --data-urlencode 'after=2026-09-21T00:00:00Z' \ --data-urlencode 'before=2026-09-28T00:00:00Z' ``` ```json filename="Response · 200 OK" { "data": [ { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "created_at": "2026-09-27T16:02:00Z", "body": "Hi, can I move my Thursday appointment to Friday morning?", "...": "..." } ], "pagination": { "next_cursor": "eyJpZCI6IjRjYmZkYjUwIn0", "has_more": true } } ``` Results include everyone's messages in each conversation (staff, patients, and API keys), not only the connected person's. The rest of this page applies to both endpoints. ## Choose the range | Parameter | Meaning | | --- | --- | | `after` | Messages sent at or after this time. | | `before` | Messages sent before this time. | Both take an RFC 3339 timestamp, like `2026-09-21T13:00:00Z`, or a date, like `2026-09-21`, which means midnight in the organization's time zone. Leave `before` out to read up to now. With an API key, every read needs a bound: pass `after`, `patient_id`, or `conversation_id`, or the request returns `400 range_required`. ## One by one, or grouped by conversation `group_by` decides the order: Messages one by one, newest first, across all conversations: the fastest way to see what's recent. Each message carries its `conversation`, so you can tell which chat it belongs to. ```text Jane Doe 4:02 PM "Can I move my Thursday appointment?" Front desk 3:55 PM "Room 2 is open again" John Doe 3:41 PM "Thanks, see you then" Jane Doe 3:30 PM "Hi, it's Jane" ``` Every message in the range from one conversation, then the next, most recently active conversation first. Within each, messages follow `order`. Use it to read a chat as a whole. ```text Jane Doe 4:02 PM "Can I move my Thursday appointment?" Jane Doe 3:30 PM "Hi, it's Jane" Front desk 3:55 PM "Room 2 is open again" John Doe 3:41 PM "Thanks, see you then" ``` Both return the same flat list of messages; only the order changes. `order=asc` flips it to oldest first, which reads more naturally when you summarize a period. ## Narrow it down | Parameter | Returns | | --- | --- | | `conversation_id` | Every message in one conversation. | | `patient_id` | Every message in all of one patient's conversations, on any phone number. | | `q` | Messages matching words and filters, like `refill from:patient`. See [Search messages](https://www.bloomtext.com/developers/api/search/). | To see which conversations were active before you read them, use [`GET /patient-conversations`](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) (or, with OAuth, [`GET /me/conversations`](https://www.bloomtext.com/developers/api/reference/list-conversations/)) with the same `after` and `before`. Each conversation comes back with its latest message and how many messages fell in the range. ## When there's too much - Pages hold up to 100 messages (`page[limit]`, default 50). Follow `pagination.next_cursor` in `page[after]` until `has_more` is `false`. See [Pagination](https://www.bloomtext.com/developers/api/pagination/). - The cursor holds your place. It remembers the range, grouping, and where you were when you started, so messages that arrive while you page don't shift pages or appear twice. - One big conversation doesn't crowd out the rest. With `group_by=conversation`, a chat with 2,000 messages in the range spans several pages, and the next chat starts where it ends. - Narrow the range if you need only part of it. A day at a time is easy to page through. ## Keep up with new messages There's no separate change feed. To pick up what's new, ask again with `after` set to the newest `created_at` you've processed: ```js filename="keep-up.mjs" const API = 'https://api.bloomtext.com/v1' // Run on a schedule. `since` is the newest created_at from the last run. export async function readNew(credential, since, handle) { let cursor = null let newest = since do { const url = new URL(`${API}/patient-messages`) // or /me/messages with OAuth url.searchParams.set('after', since) url.searchParams.set('order', 'asc') url.searchParams.set('page[limit]', '100') if (cursor) url.searchParams.set('page[after]', cursor) const response = await fetch(url, { headers: { Authorization: `Bearer ${credential}` } }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const { data, pagination } = await response.json() for (const message of data) { await handle(message) // keyed by message.id, so a repeat is harmless newest = message.created_at } cursor = pagination.has_more ? pagination.next_cursor : null } while (cursor) return newest // save for the next run } ``` ```python filename="keep_up.py" import requests API = "https://api.bloomtext.com/v1" def read_new(credential: str, since: str, handle) -> str: """Run on a schedule. `since` is the newest created_at from the last run.""" params = {"after": since, "order": "asc", "page[limit]": 100} newest = since while True: response = requests.get(f"{API}/patient-messages", headers={"Authorization": f"Bearer {credential}"}, params=params) response.raise_for_status() page = response.json() for message in page["data"]: handle(message) # keyed by message["id"], so a repeat is harmless newest = message["created_at"] if not page["pagination"]["has_more"]: return newest # save for the next run params["page[after]"] = page["pagination"]["next_cursor"] ``` `after` includes messages sent at exactly that time, so the last run's newest message comes back once more. Handle messages by `id` and the repeat does nothing. With an API key and `/patient-messages`, this picks up every patient's replies, including replies to [campaigns](https://www.bloomtext.com/developers/api/campaigns/). Add `q=from:patient` to skip your own sends. A read returns each message as it is now: an edited message shows its latest text and `edited_at`, and deleted messages don't appear. A range can't tell you that something changed after you read it; read it again if you need the current state. --- # Search messages > Search BloomText patient messages with words and operators like from:patient, mrn:, and is:failed, combined with an after and before time range. Source: https://www.bloomtext.com/developers/api/search/ Find messages by their words and by operators like `from:patient` and `is:failed`. [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) takes these in a `q` parameter. With [OAuth](https://www.bloomtext.com/developers/api/oauth/), so do [`GET /me/messages`](https://www.bloomtext.com/developers/api/reference/list-messages/) and [`GET /me/conversations`](https://www.bloomtext.com/developers/api/reference/list-conversations/). Combine `q` with the `after` and `before` [time range](https://www.bloomtext.com/developers/api/read-messages/#choose-the-range) to say when. ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode 'after=2026-09-21' \ --data-urlencode 'q=refill from:patient' \ --data-urlencode 'order=asc' ``` Search works the same on both. `/patient-messages` searches patient conversations (with an [API key](https://www.bloomtext.com/developers/api/api-keys/)). `/me/messages` searches the connected person's own conversations (with [OAuth](https://www.bloomtext.com/developers/api/oauth/)), including messages sent before they joined one. Results are complete [Message objects](https://www.bloomtext.com/developers/api/reference/message-object/), each with its sender and conversation, so you don't need a second request per message. They're paginated like every other list; see [Pagination](https://www.bloomtext.com/developers/api/pagination/). ## Operators | Operator | Example | Matches messages | | --- | --- | --- | | free text | `referral` | Containing the word, in the text or an attachment's file name. Case doesn't matter. | | `"…"` | `"prior auth"` | Containing the exact phrase. | | `from:` | `from:me`, `from:patient`, `from:staff`, `from:8b9c2d2f-…` | From the connected admin (OAuth only), any patient, any staff member, or a specific user by ID. | | `patient:` | `patient:5a1c9e2b-…` | In conversations with that patient. | | `mrn:` | `mrn:MRN-20931` | Same, by the patient's ID in your system. | | `phone:` | `phone:+15125550143` | Same, by the patient's phone number. Any common format works. | | `is:unread` | `is:unread` | That the connected admin hasn't read yet. OAuth only; API keys have no read state. | | `is:failed` | `is:failed` | Sent to a patient, and the carrier reported it failed. Also `is:undelivered`, `is:rejected` (BloomText didn't send it: the patient opted out, the carrier blocks texts to them, an admin blocked the number, the number can't receive texts, the patient hasn't given consent to text, or the text waited for consent and wasn't sent), `is:queued`, `is:sent`, and `is:delivered`. See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status). | Time isn't part of `q`; use `after` and `before`. To narrow to one conversation or patient, use `conversation_id` or `patient_id`. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#narrow-it-down). ### Combining terms - Terms combine with AND by default: `refill from:patient` matches patients' messages that mention a refill. - `-` negates: `-from:staff` matches messages that staff didn't send. - `OR` gives alternatives. Group with parentheses: `(referral OR "prior auth")`. ## Examples | You want | Parameters | | --- | --- | | Everything since the start of yesterday | `after=2026-09-25` | | What the admin hasn't read (OAuth) | `q=is:unread` | | Patient messages this week | `after=2026-09-21&q=from:patient` | | Everything with one patient this month | `after=2026-09-01&patient_id=5a1c9e2b-…` (or `q=mrn:MRN-20931`) | | Texts that didn't reach patients today | `after=2026-09-26&q=is:failed` | | Everything today except the admin's own messages (OAuth) | `after=2026-09-26&q=-from:me` | | Referrals or prior authorizations this month | `after=2026-09-01&q=(referral OR "prior auth")` | | One conversation's messages about a refill | `conversation_id=e5c3b7b8-…&q=refill` | ## Order and grouping Messages come back newest first. Pass `order=asc` for oldest first, which reads more naturally when you summarize a period. Pass `group_by=conversation` to get every matching message from one conversation before the next. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#one-by-one-or-grouped-by-conversation). ## Search conversations too With [OAuth](https://www.bloomtext.com/developers/api/oauth/), [`GET /me/conversations`](https://www.bloomtext.com/developers/api/reference/list-conversations/) takes its own `q` to find the person's conversations rather than messages. With `after` and `before`, it returns conversations active in that range, each with its latest message and how many messages fell in the range. The Patient API's [`GET /patient-conversations`](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) has no `q`, so patients can't be searched by name. Filter it by `after` or `patient_id` instead. | Operator | Example | Matches conversations | | --- | --- | --- | | free text | `doe` | With the text in the title or a participant's name. | | `is:unread` | `is:unread` | With unread messages. | | `with:` | `with:8b9c2d2f-…` | That include this user or patient. | ```bash filename="Request" curl -G https://api.bloomtext.com/v1/me/conversations \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ --data-urlencode 'after=2026-09-26' \ --data-urlencode 'q=is:unread' ``` ## Find a patient To find a patient rather than messages, use [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) with `phone` or `mrn`. See [Patients](https://www.bloomtext.com/developers/api/patients/#find-a-patient). ## Good to know - Search covers only what the credential can see. See [Core concepts](https://www.bloomtext.com/developers/api/concepts/#what-the-api-can-reach). - Matching is on whole words and phrases, with no fuzzy or meaning-based matching. To find messages about a topic, have your app or model search for a few likely words combined with `OR`. - Queries are limited to 1,000 characters. A query BloomText can't parse returns `400` with `code: invalid_query` and a `detail` pointing at the problem. - Searching never marks messages as read. See [Read state](https://www.bloomtext.com/developers/api/concepts/#read-state). - To keep up with new messages, ask again with `after` set to the newest message you've seen. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages). --- # Reporting and audit data > Pull delivery and membership data through the API, export Message reports and the Audit log as CSV from BloomText, and read audit events through the API. Source: https://www.bloomtext.com/developers/api/reporting-and-audit/ What your organization can pull for its own reporting, an audit or a legal request, without asking BloomText: what the API returns, what Owners and IT export from BloomText, and the audit events API. | You need | Where | Who | | --- | --- | --- | | Every text sent to patients and whether it arrived | [`GET /patient-messages`](#delivery-reporting) or [Message reports](#message-reports) | A key with `messages.read`, or Owners and IT | | Who was added to or removed from an organization | [`GET /member-events`](#membership-changes) | A key with `members.read` | | Who signed in, opened a chat, exported or changed something | [Audit log](#audit-log) | Owners and IT | | The same audit events, in your own tools | [Audit events API](#audit-events-api) | A key with `audit.read` | ## Through the API Each call reads one organization. A key that reaches several organizations names one with `org_id`; list them with [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/). See [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). ### Delivery reporting [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) returns patient messages in a time range, each with its delivery status. Narrow it with `q`: `is:failed`, `is:undelivered`, `is:rejected` (BloomText didn't send it, for example because the patient opted out), `is:queued`, `is:sent` or `is:delivered`. ```bash filename="Request" curl -G https://api.bloomtext.com/v1/patient-messages \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode "org_id=$ORG_ID" \ --data-urlencode 'after=2026-10-01' \ --data-urlencode 'before=2026-11-01' \ --data-urlencode 'q=is:failed' ``` Follow `next_cursor` to read the whole range; see [Pagination](https://www.bloomtext.com/developers/api/pagination/). Each message's `delivery` says what happened and, for a text that didn't arrive, why. See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status) and [Search messages](https://www.bloomtext.com/developers/api/search/). ### Membership changes [`GET /member-events`](https://www.bloomtext.com/developers/api/reference/list-member-events/) lists who was added, approved or removed in an organization, newest first, and who did it: a person, `API key: `, or `Okta directory` for changes Directory Sync made. Use it to check what a provisioning sync or Okta did. See [Manage members](https://www.bloomtext.com/developers/api/members-api/#see-what-changed). ## In BloomText, for Owners and IT Your account's Owners and IT people export these from **Settings → Account**, across every organization on the account. Neither has an API endpoint; for delivery data in your own tools, use [`GET /patient-messages`](#delivery-reporting). ### Message reports The **Reports** tab lists every text your organizations sent to patients and whether it reached the patient's phone, with its organization, team, source (**Staff**, **API** with the key's name, **Campaign**, or **Automatic**) and status. It covers up to 30 days across all organizations, or up to 90 days for one. **Export CSV** downloads up to 50,000 texts. It never shows or exports message text. BloomText turns Reports on per account. See [Message reports](https://www.bloomtext.com/how-to/admin/message-reports/) in the admin help. ### Audit log The **Audit** tab records who did what: sign-ins and failed sign-ins, chat views, exports, and changes to members, teams, settings and patient records. Changes an API key made show as **API key: HR sync**. **Download CSV** holds up to 12 months and 10,000 events per file. Events are kept for six years, and message text is never recorded. BloomText turns the audit log on per account, and recording starts that day. See [Audit log](https://www.bloomtext.com/how-to/security/audit-log/) in the admin help. ## Audit events API > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=audit-events) [`GET /audit-events`](https://www.bloomtext.com/developers/api/reference/list-audit-events/) returns the audit log's events for one organization, newest first, so a SIEM or compliance tool can collect them on a schedule. It takes the audit log's filters: a time range with `after` and `before`, a person, actions and a patient. It needs a key with the `audit.read` scope. Each event names its action with the same dotted name the audit log's CSV uses, grouped as in the log: | Group | Actions | | --- | --- | | Sign-ins | `user.signed_in`, `user.sign_in_failed`, `user.signed_out`, `support.signed_in`, `support.signed_out` | | Chat views | `chat.viewed` | | Exports | `chat.exported`, `members.exported`, `sms_logs.exported`, `audit_log.exported` | | Members and teams | `member.role_changed`, `member.added`, `member.removed`, `team.member_added`, `team.member_removed`, `member.password_reset`, `member.moved`, `member.deleted` | | Settings | `org.setting_changed`, `audit_log.turned_on`, `audit_log.turned_off` | | Patients | `patient.created`, `patient.updated`, `patient.archived`, `patient.restored`, `patients.imported`, `patient.deleted`, `patient.account_deleted`, `message.deleted` | ```bash filename="Request" curl -G https://api.bloomtext.com/v1/audit-events \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ --data-urlencode "org_id=$ORG_ID" \ --data-urlencode 'after=2026-10-01' \ --data-urlencode 'action=chat.viewed' ``` Like the audit log, events hold labels only, never message text or a patient's field values. See [The Audit event object](https://www.bloomtext.com/developers/api/reference/audit-event-object/). ## Related - [Security and BAA](https://www.bloomtext.com/developers/api/security-and-baa/) - [Manage members](https://www.bloomtext.com/developers/api/members-api/) - [Read messages](https://www.bloomtext.com/developers/api/read-messages/) --- # Security and BAA > How the BloomText API protects patient data, what your integration is responsible for under HIPAA, and the BAA required for API access. Source: https://www.bloomtext.com/developers/api/security-and-baa/ BloomText is HIPAA-compliant, and API access requires a signed Business Associate Agreement (BAA). [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) and we'll send the BAA with your onboarding. ## How the API protects data | Protection | What it means | | --- | --- | | **Narrow reads** | Patients are found by ID, phone number, or MRN, with no directory listing or name search. Every read of patient messages or conversations is bounded by a time range, a patient, or a conversation. An API key never reads staff conversations. | | **Narrow keys** | API keys reach patient operations, and with member scopes members and teams, only in the organizations each key was given, and, if you ask BloomText to turn it on, only some phone numbers. No key reads staff conversations. [OAuth](https://www.bloomtext.com/developers/api/oauth/) is limited to org admins and reaches their own conversations plus patient operations. | | **Secure by default** | Messages to patients go by secure link and stay inside BloomText unless an app asks for plain SMS. | | **Least privilege** | Keys carry only the [scopes](https://www.bloomtext.com/developers/api/authentication/#scopes) the Owner or IT person chose. Reading and sending are separate scopes. | | **Admin control** | Only an account's Owners and IT people create API keys, under **Settings → Account → API keys**, choosing the organizations each key reaches; for an account without the Account page, BloomText creates them. With OAuth, only apps that BloomText has registered under a BAA can request tokens, and only after an org admin approves them. | | **Short-lived tokens** | OAuth access tokens last an hour. Refresh tokens rotate on every use, and reusing an old one after a 30-second retry window revokes the connection. Every connection ends after 12 months. | | **Attributed writes** | Messages sent with an API key come from its [API identity](https://www.bloomtext.com/developers/api/api-identity/), an automated sender staff can see, or today show the key's name with an **API** marker. Nothing is sent on behalf of a staff member. Staff always see what came from your system. | | **Audit logging** | BloomText logs every API request with the API key, the endpoint, and the patients, conversations, and messages it returned, and keeps it for six years. Changes an API key makes, like adding a member, also appear in the account's [Audit log](https://www.bloomtext.com/how-to/security/audit-log/) for Owners and IT as "API key: name". | | **Instant revocation** | Owners and IT can revoke an API key, and with OAuth admins can disconnect an app or revoke it for the whole organization. Each takes effect on the next request. | | **Minimal responses** | Users and organizations return only IDs, names, and roles. Passwords, private contact details, and internal fields are never returned. | All traffic uses TLS 1.2 or later. Plain HTTP requests are refused. ## Your responsibilities Messages about patients are protected health information (PHI), so your app becomes part of your organization's HIPAA program. - **Store API data like any other PHI.** Encrypt it at rest, restrict who can read it, log access, and keep only what you need. - **Protect API keys.** Keep keys in a secrets manager (and, with OAuth, your client secret too, with refresh tokens encrypted in your database). Give each system its own key. Never paste any of them into chat tools or AI prompts. - **Be clear about what you send.** Make sure staff know which messages your integration sends, and and from which sender. - **Send the minimum.** Keep diagnoses and clinical detail out of automated messages unless your compliance team approves, and never put them in plain SMS (`channel: sms`). - **Mind Part 2 data.** If you work with substance use disorder records under 42 CFR Part 2, have your compliance lead approve how your app reads and stores messages. - **Check your AI vendors.** If an AI agent reads BloomText data, the model provider needs a BAA with your organization too. > **Warning:** Don't include PHI in support requests or the access request form. Share a `request_id` instead. --- # OAuth quickstart > Connect your own BloomText admin account with OAuth, read the last week of your conversations chat by chat, and reply in a team chat. Source: https://www.bloomtext.com/developers/api/oauth-quickstart/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) Connect your own BloomText account to a registered app with OAuth, read the last week of your conversations chat by chat, and reply in a team chat. > **Note:** For now, only org admins can connect apps. If you're not one, ask an org admin to try this, or use the [Patient API quickstart](https://www.bloomtext.com/developers/api/patient-api-quickstart/) with an API key. ### Get your app's credentials Apps are registered for organizations with a signed BAA. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) if you haven't registered yours. For this guide, ask us to add `http://localhost:8765/callback` as a redirect URI. An org admin in your organization also needs to approve the app in BloomText. Put the credentials in environment variables. Never commit them or ship them to a browser. ```bash filename="Terminal" export BLOOMTEXT_CLIENT_ID="bt_client_7Hq2mX9aLk" export BLOOMTEXT_CLIENT_SECRET="bt_cs_…" ``` ### Connect your account Create a PKCE verifier and challenge, then open the authorize URL in your browser: ```bash filename="Terminal" export VERIFIER=$(openssl rand -base64 48 | tr -d '=+/\n' | cut -c1-64) export CHALLENGE=$(printf %s "$VERIFIER" | openssl dgst -sha256 -binary | openssl base64 | tr '+/' '-_' | tr -d '=\n') open "https://app.bloomtext.com/oauth/authorize?response_type=code&client_id=$BLOOMTEXT_CLIENT_ID&redirect_uri=http://localhost:8765/callback&scope=messages.read%20messages.write&state=quickstart&code_challenge=$CHALLENGE&code_challenge_method=S256" ``` Sign in if asked, then approve the app. Your browser goes to `http://localhost:8765/callback?code=…&state=quickstart`. Nothing is listening there, so the page won't load; copy the `code` from the address bar. ### Exchange the code for a token ```bash filename="Terminal" curl https://app.bloomtext.com/oauth/token \ -u "$BLOOMTEXT_CLIENT_ID:$BLOOMTEXT_CLIENT_SECRET" \ -d grant_type=authorization_code \ -d code=PASTE_THE_CODE_HERE \ -d redirect_uri=http://localhost:8765/callback \ -d code_verifier=$VERIFIER ``` ```json filename="Response · 200 OK" { "access_token": "bt_at_Vq8yG2mN0cT4…", "token_type": "Bearer", "expires_in": 3600, "scope": "messages.read messages.write" } ``` The code expires after 10 minutes, so exchange it right away. The access token lasts an hour; keep it for the next steps. ```bash filename="Terminal" export BLOOMTEXT_ACCESS_TOKEN="bt_at_Vq8yG2mN0cT4…" ``` A real app also requests `offline_access` to get a refresh token. See [Tokens and how long they last](https://www.bloomtext.com/developers/api/oauth/#tokens-and-how-long-they-last). ### Read your last week, chat by chat [List messages](https://www.bloomtext.com/developers/api/reference/list-messages/) (`GET /v1/me/messages`) returns everything in your conversations in a time range, with patients and with colleagues. `group_by=conversation` returns each chat's messages together, most recently active chat first. ```bash filename="Request" curl -G https://api.bloomtext.com/v1/me/messages \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ --data-urlencode 'after=2026-09-21' \ --data-urlencode 'group_by=conversation' ``` ```js filename="read.mjs" const url = new URL('https://api.bloomtext.com/v1/me/messages') url.searchParams.set('after', '2026-09-21') url.searchParams.set('group_by', 'conversation') const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}` }, }) const { data } = await response.json() for (const message of data) console.log(`[${message.conversation.title}] ${message.sender.name}: ${message.body}`) ``` ```python filename="read.py" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/messages", headers={"Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}"}, params={"after": "2026-09-21", "group_by": "conversation"}, ) response.raise_for_status() for message in response.json()["data"]: print(f"[{message['conversation']['title']}] {message['sender']['name']}: {message['body']}") ``` ```json filename="Response · 200 OK" { "data": [ { "id": "7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Front desk" }, "sender": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "kind": "staff" }, "created_at": "2026-09-27T16:02:00Z", "body": "Room 2 is open again if anyone needs it.", "unread": true, "...": "..." } ], "pagination": { "next_cursor": "eyJpZCI6IjdjMWQyZTNmIn0", "has_more": true } } ``` Follow `next_cursor` for more. Reading doesn't mark anything as read, so your unread badges stay as they were. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/) for ranges, grouping, and keeping up. ### Reply in a team chat Copy a team chat's conversation `id` and [send a message](https://www.bloomtext.com/developers/api/reference/create-message/) with `POST /v1/me/conversations/{id}/messages`. It appears under your name, and staff see a "via" label naming your app. ```bash filename="Request" curl -X POST https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"body": "Thanks, I will take room 2 at 3:00."}' ``` Sending marks the chat as read for you, as replying in BloomText does. ## Next steps - [Connect with OAuth in your app](https://www.bloomtext.com/developers/api/oauth/) - [Read messages](https://www.bloomtext.com/developers/api/read-messages/) - [Search messages](https://www.bloomtext.com/developers/api/search/) - [Build an AI agent](https://www.bloomtext.com/developers/api/ai-agents/) Texting patients from a server instead? Try the [Patient API quickstart](https://www.bloomtext.com/developers/api/patient-api-quickstart/). --- # Connect with OAuth > Connect an org admin's BloomText account to your app with the OAuth 2.0 authorization code flow and PKCE, or authenticate an API key with client credentials; refresh tokens and handle revocation. Source: https://www.bloomtext.com/developers/api/oauth/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) OAuth gives you two things. With the [authorization code flow](#the-authorization-flow), an org admin connects your app to their BloomText account, and your app works in that admin's own conversations: it reads and searches them, sends in the ones they're part of, and makes the same patient calls as an API key. With [client credentials](#client-credentials), your server trades an API key's client ID and secret for short-lived access tokens, a second way to authenticate the same key. For now, only org admins can connect apps. Anyone else is sent back to your redirect URI with `error=access_denied`. [Step through the flow](#the-authorization-flow) to see every request, who makes it, and how long each token lasts. ## Before you start Only apps registered with BloomText can connect. [Request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) to register yours. ### We register your app After your organization signs a BAA, we register your app and send you its client ID and client secret. Tell us the name users should see and every redirect URI your app uses. Redirect URIs must match exactly and use HTTPS; `http://localhost` URIs are allowed for development. ### An admin approves your app A BloomText admin in each organization approves your app before anyone there can connect it. Until then, people in that organization skip the approval screen and go straight back to your redirect URI with `error=access_denied`. ### Admins connect one at a time Each org admin signs in and approves your app themselves, and your app keeps a separate token for each. > **Warning:** Keep the client secret on your server. Never put it in a browser, a mobile app, a public repository, or an AI prompt. ## The authorization flow BloomText uses the authorization code flow with PKCE. PKCE is required for every app, including server-side apps with a client secret. Click through the flow, or read the steps below. ### Send the user to BloomText Create a random `state` and a PKCE `code_verifier`, store both with the user's session, and redirect the user to the authorize URL. ```text filename="Authorize URL" https://app.bloomtext.com/oauth/authorize ?response_type=code &client_id=bt_client_7Hq2mX9aLk &redirect_uri=https://ehr.example.com/bloomtext/callback &scope=messages.read offline_access &state=af0ifjsldkj &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM &code_challenge_method=S256 ``` - `response_type` (string, required): Always `code`. - `client_id` (string, required): Your app's client ID. - `redirect_uri` (URL, required): Where BloomText sends the user back. Must exactly match a redirect URI registered for your app. - `scope` (string, required): Space-separated [scopes](https://www.bloomtext.com/developers/api/authentication/#scopes). Include `offline_access` to get a refresh token. - `state` (string, required): A random value you check on the way back, to protect against cross-site request forgery. - `code_challenge` (string, required): The base64url-encoded SHA-256 hash of your `code_verifier`. - `code_challenge_method` (string, required): Always `S256`. ### The user signs in and approves BloomText hosts the sign-in and approval pages, so users sign in with their usual password and multi-factor authentication. A user who is already signed in sees only the approval screen, which names your app, the user's organization, and what each requested scope allows. ### Handle the redirect BloomText sends the user back to your redirect URI: ```text filename="Redirect" https://ehr.example.com/bloomtext/callback?code=SplxlOBeZQQYbYS6WxSbIA&state=af0ifjsldkj ``` Check that `state` matches what you stored, then exchange the code. Codes expire after 10 minutes and work once. If the user declines, isn't an org admin, or their organization hasn't approved your app, the redirect carries `error=access_denied` and an `error_description` instead of a code. The one exception is a bad `client_id` or an unregistered `redirect_uri`: as OAuth requires, BloomText shows an error page instead of redirecting. ### Exchange the code for tokens Call the token endpoint from your server, authenticating with your client ID and secret. ```bash filename="Request" curl https://app.bloomtext.com/oauth/token \ -u "$BLOOMTEXT_CLIENT_ID:$BLOOMTEXT_CLIENT_SECRET" \ -d grant_type=authorization_code \ -d code=SplxlOBeZQQYbYS6WxSbIA \ -d redirect_uri=https://ehr.example.com/bloomtext/callback \ -d code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk ``` ```js filename="oauth.mjs" import crypto from 'node:crypto' const AUTHORIZE_URL = 'https://app.bloomtext.com/oauth/authorize' const TOKEN_URL = 'https://app.bloomtext.com/oauth/token' const REDIRECT_URI = 'https://ehr.example.com/bloomtext/callback' // Step 1: build the authorize URL. Store state and verifier with the session. export function startAuthorization(session) { session.state = crypto.randomBytes(16).toString('base64url') session.verifier = crypto.randomBytes(32).toString('base64url') const challenge = crypto.createHash('sha256').update(session.verifier).digest('base64url') const url = new URL(AUTHORIZE_URL) url.search = new URLSearchParams({ response_type: 'code', client_id: process.env.BLOOMTEXT_CLIENT_ID, redirect_uri: REDIRECT_URI, scope: 'messages.read offline_access', state: session.state, code_challenge: challenge, code_challenge_method: 'S256', }) return url.toString() } // Step 4: exchange the code from the redirect for tokens. export async function finishAuthorization(session, query) { if (query.error) throw new Error(`Not connected: ${query.error_description ?? query.error}`) if (query.state !== session.state) throw new Error('State mismatch') const credentials = Buffer.from(`${process.env.BLOOMTEXT_CLIENT_ID}:${process.env.BLOOMTEXT_CLIENT_SECRET}`).toString('base64') const response = await fetch(TOKEN_URL, { method: 'POST', headers: { Authorization: `Basic ${credentials}` }, body: new URLSearchParams({ grant_type: 'authorization_code', code: query.code, redirect_uri: REDIRECT_URI, code_verifier: session.verifier, }), }) if (!response.ok) throw new Error(`Token exchange failed: ${response.status}`) return response.json() // { access_token, refresh_token, expires_in, scope, token_type } } ``` ```python filename="oauth.py" import base64 import hashlib import os import secrets from urllib.parse import urlencode import requests AUTHORIZE_URL = "https://app.bloomtext.com/oauth/authorize" TOKEN_URL = "https://app.bloomtext.com/oauth/token" REDIRECT_URI = "https://ehr.example.com/bloomtext/callback" def start_authorization(session: dict) -> str: """Step 1: build the authorize URL. Store state and verifier with the session.""" session["state"] = secrets.token_urlsafe(16) session["verifier"] = secrets.token_urlsafe(32) digest = hashlib.sha256(session["verifier"].encode()).digest() challenge = base64.urlsafe_b64encode(digest).rstrip(b"=").decode() return AUTHORIZE_URL + "?" + urlencode({ "response_type": "code", "client_id": os.environ["BLOOMTEXT_CLIENT_ID"], "redirect_uri": REDIRECT_URI, "scope": "messages.read offline_access", "state": session["state"], "code_challenge": challenge, "code_challenge_method": "S256", }) def finish_authorization(session: dict, query: dict) -> dict: """Step 4: exchange the code from the redirect for tokens.""" if "error" in query: raise RuntimeError(f"Not connected: {query.get('error_description', query['error'])}") if query["state"] != session["state"]: raise RuntimeError("State mismatch") response = requests.post( TOKEN_URL, auth=(os.environ["BLOOMTEXT_CLIENT_ID"], os.environ["BLOOMTEXT_CLIENT_SECRET"]), data={ "grant_type": "authorization_code", "code": query["code"], "redirect_uri": REDIRECT_URI, "code_verifier": session["verifier"], }, ) response.raise_for_status() return response.json() # access_token, refresh_token, expires_in, scope, token_type ``` ```json filename="Response · 200 OK" { "access_token": "bt_at_Vq8yG2mN0cT4…", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "bt_rt_k3Jd9Qp1Xw7s…", "scope": "messages.read offline_access" } ``` Store the refresh token against the user, encrypted, the same way you store PHI. ### Call the API Send the access token as a Bearer token. [Retrieve the profile](https://www.bloomtext.com/developers/api/reference/get-profile/) to confirm which user connected. ```bash filename="Request" curl https://api.bloomtext.com/v1/me \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```json filename="Response · 200 OK" { "user": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "admin" }, "organization": { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" }, "app": { "client_id": "bt_client_7Hq2mX9aLk", "name": "Acme EHR Assistant" }, "scopes": ["messages.read", "offline_access"], "expires_at": "2027-09-21T15:04:05Z" } ``` ## What a token can reach An OAuth token acts as the org admin who connected it. It reaches: - the admin's own conversations, whether they were added directly or through a team, including messages sent before they joined, but no one else's staff conversations; - patients, always named by patient ID, phone number, or MRN, with all of that patient's conversations in the organization, like an API key; - the clinic phone numbers of the teams the admin is on. Anything else returns `404`, the same as something that doesn't exist. Access lasts only while the admin has it: removing them from a conversation, or taking away their admin role, cuts off the token on the next request. Messages your app sends appear under the admin's name. Staff also see which app sent them; patients see only the admin. See [Core concepts](https://www.bloomtext.com/developers/api/concepts/#messages-sent-through-the-api). ## Tokens and how long they last | Token | Lifetime | Notes | | --- | --- | --- | | Authorization code | 10 minutes | Works once. | | Access token | 1 hour | Send it with every request. `expires_in` says how many seconds it has left. | | Refresh token | Rotates on every use | Issued only with `offline_access`. Stops working after 90 days unused. | | The connection | 12 months | After 12 months the user must approve your app again, even if you use it every day. [`expires_at`](https://www.bloomtext.com/developers/api/reference/profile-object/) on the profile says when. | The user connects once and your app keeps working for up to a year: refresh the access token when it expires, and ask the user to reconnect when `expires_at` is near. ### Refresh an access token ```bash filename="Request" curl https://app.bloomtext.com/oauth/token \ -u "$BLOOMTEXT_CLIENT_ID:$BLOOMTEXT_CLIENT_SECRET" \ -d grant_type=refresh_token \ -d refresh_token=bt_rt_k3Jd9Qp1Xw7s… ``` ```js filename="refresh.mjs" export async function refresh(refreshToken) { const credentials = Buffer.from(`${process.env.BLOOMTEXT_CLIENT_ID}:${process.env.BLOOMTEXT_CLIENT_SECRET}`).toString('base64') const response = await fetch('https://app.bloomtext.com/oauth/token', { method: 'POST', headers: { Authorization: `Basic ${credentials}` }, body: new URLSearchParams({ grant_type: 'refresh_token', refresh_token: refreshToken }), }) if (response.status === 400) { const { error } = await response.json() if (error === 'invalid_grant') return null // the user must reconnect throw new Error(`Refresh failed: ${error}`) } if (!response.ok) throw new Error(`Refresh failed: ${response.status}`) return response.json() // save the new refresh_token before using the access token } ``` ```python filename="refresh.py" import os import requests def refresh(refresh_token: str) -> dict | None: response = requests.post( "https://app.bloomtext.com/oauth/token", auth=(os.environ["BLOOMTEXT_CLIENT_ID"], os.environ["BLOOMTEXT_CLIENT_SECRET"]), data={"grant_type": "refresh_token", "refresh_token": refresh_token}, ) if response.status_code == 400: error = response.json()["error"] if error == "invalid_grant": return None # the user must reconnect raise RuntimeError(f"Refresh failed: {error}") response.raise_for_status() return response.json() # save the new refresh_token before using the access token ``` Every refresh returns a new refresh token and invalidates the old one. Save the new one before you do anything else. If a refresh request times out and you don't know whether it worked, retry with the same refresh token within 30 seconds. BloomText returns the tokens it issued the first time. > **Warning:** Using an old refresh token after that 30-second window revokes the whole connection, because it usually means the token was copied. If two workers can refresh the same user's token, make them share a lock. ## When a connection ends A connection stops working when: - the user disconnects your app from **Settings → Connected apps** in BloomText; - an admin revokes your app for their organization; - the admin is deactivated, loses their admin role, leaves the organization, or resets their password; - your app goes 90 days without refreshing; - 12 months pass since the user approved your app. After that, API calls return `401` with `code: invalid_token`, and refreshing returns `400` with `error: invalid_grant`. Show the user a "Reconnect BloomText" button that starts the flow again. To disconnect a user from your side, for example when they turn off the integration, revoke the refresh token: ```bash filename="Request" curl https://app.bloomtext.com/oauth/revoke \ -u "$BLOOMTEXT_CLIENT_ID:$BLOOMTEXT_CLIENT_SECRET" \ -d token=bt_rt_k3Jd9Qp1Xw7s… ``` ## Client credentials A server-to-server way to authenticate an existing [API key](https://www.bloomtext.com/developers/api/api-keys/). Instead of sending the long-lived key on every call, your server exchanges the key's client ID and secret for an access token and sends that. The token carries the key's scopes and limits, and messages sent with it come from the key's [API identity](https://www.bloomtext.com/developers/api/api-identity/), exactly as if you'd sent the key. Nothing is ever sent as a person. An Owner or IT person turns on client credentials for a key under **Settings → Account → API keys**, which shows its client ID and secret once. ```bash filename="Request" curl -X POST https://app.bloomtext.com/oauth/token \ -u "$BLOOMTEXT_CLIENT_ID:$BLOOMTEXT_CLIENT_SECRET" \ -d grant_type=client_credentials ``` ```json filename="Response · 200 OK" { "access_token": "…", "token_type": "Bearer", "expires_in": 3600, "scope": "patients.read messages.write" } ``` Send `access_token` as `Authorization: Bearer …`. It lasts an hour; ask for a new one before it expires. There's no refresh token. You can ask for fewer scopes than the key has with `scope`, never more. Revoking the key ends its tokens. ## Token endpoint errors The token endpoint returns standard OAuth errors as JSON: `{"error": "invalid_grant", "error_description": "…"}`. | Error | Status | What to do | | --- | --- | --- | | `invalid_grant` | 400 | The code or refresh token is expired, used, or revoked, or the `code_verifier` or `redirect_uri` doesn't match the authorization request. For an expired or revoked token, send the user through the authorize URL again. | | `invalid_client` | 401 | Check your client ID and secret. | | `invalid_request` | 400 | A required parameter is missing, repeated, or malformed. | | `invalid_scope` | 400 | A refresh asked for a scope the user didn't grant. Refresh with the same or fewer scopes. | | `unauthorized_client` | 400 | Your app isn't allowed to use this grant type. Contact us. | | `unsupported_grant_type` | 400 | Use `authorization_code` or `refresh_token`. | API endpoints use [problem details](https://www.bloomtext.com/developers/api/errors/) instead. `401` and `403` responses also carry a `WWW-Authenticate` header, like `Bearer error="invalid_token", resource_metadata="https://api.bloomtext.com/.well-known/oauth-protected-resource/v1"`. ## Server metadata OAuth libraries can configure themselves from these discovery documents. | Document | URL | | --- | --- | | Authorization server metadata ([RFC 8414](https://www.rfc-editor.org/rfc/rfc8414)) | `https://app.bloomtext.com/.well-known/oauth-authorization-server` | | Protected resource metadata ([RFC 9728](https://www.rfc-editor.org/rfc/rfc9728)) for `https://api.bloomtext.com/v1` | `https://api.bloomtext.com/.well-known/oauth-protected-resource/v1` | --- # Build a daily message digest > Pull an org admin's BloomText messages from the last day with OAuth and turn them into events, follow-ups, and to-dos inside your EHR or EMR. Source: https://www.bloomtext.com/developers/api/guides/daily-digest/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) Build a job that runs each morning, reads everything a clinician received in BloomText since the last run, and turns it into a short list of events, follow-ups, and to-dos in your EHR or EMR. The clinician sees what matters without reading every conversation. > **Note:** This guide uses OAuth, which only org admins can connect for now, so the digest covers an admin's own conversations. For a digest of patient messages instead, use an [API key](https://www.bloomtext.com/developers/api/api-keys/) with [`GET /patient-messages`](https://www.bloomtext.com/developers/api/reference/list-patient-messages/), the same parameters, and `q=from:patient` in place of `q=-from:me`. A key reads every patient conversation in the range. You need a [registered app](https://www.bloomtext.com/developers/api/oauth/#before-you-start) with the `messages.read` and `offline_access` scopes, a place to store each clinician's refresh token, and a model provider covered by a BAA. ```mermaid flowchart LR C[Clinician connects BloomText] --> T[Store refresh token] T --> J[Morning job] J --> M["GET /me/messages?after=last run"] M --> X[Model extracts events, follow-ups, to-dos] X --> E[Show in your EHR] ``` ### Let each clinician connect Add a "Connect BloomText" button to the clinician's settings in your app. It starts the [authorization flow](https://www.bloomtext.com/developers/api/oauth/#the-authorization-flow) with these scopes: ```text scope=messages.read offline_access ``` When the code exchange succeeds, store the refresh token against the clinician, encrypted, with the connection's `expires_at` from [the profile](https://www.bloomtext.com/developers/api/reference/get-profile/). Set their `lastDigestAt` to 24 hours ago so the first digest covers the last day. Read-only is enough: the digest never writes to BloomText, and reading never marks messages as read, so the clinician's unread badges stay as they were. ### Fetch everything since the last run For each connected clinician, refresh the access token, then [list messages](https://www.bloomtext.com/developers/api/read-messages/) sent since the job last ran for them. Use a timestamp in `after` rather than a date so runs never overlap or leave gaps, `group_by=conversation` so each chat comes back whole, and `order=asc` so the model reads each chat in the order it happened. ```text filename="Query" GET /v1/me/messages?after=2026-09-25T13:00:00Z&group_by=conversation&order=asc&page[limit]=100 ``` Follow `next_cursor` until `has_more` is `false`. See [Pagination](https://www.bloomtext.com/developers/api/pagination/). Filter with `q` as needed: `is:unread` for only what the clinician hasn't seen, `-from:me` to leave out their own messages, or `from:patient` to focus on patients. A second request with `q=is:failed` lists texts that didn't reach patients. See [Search messages](https://www.bloomtext.com/developers/api/search/) for every operator. ### Group messages by conversation With `group_by=conversation`, each chat's messages arrive together. Each message carries its `conversation.title` and `sender.name`, so you can build a readable transcript for the model without extra requests. ### Extract the items Ask the model for a small, structured list. Keep the instructions narrow: report what the messages say, and give no clinical advice. ### Show the digest and handle reconnects Show the items in your app, each linked back to its conversation. If refreshing the token fails with `invalid_grant`, or `expires_at` is less than two weeks away, show a "Reconnect BloomText" prompt instead of a digest. ## Example job ```js filename="digest.mjs" import Anthropic from '@anthropic-ai/sdk' const anthropic = new Anthropic() const API = 'https://api.bloomtext.com/v1' const INSTRUCTIONS = 'You summarize a clinician\'s BloomText messages for their morning digest. From the transcript, list every ' + 'scheduled event, every follow-up someone is waiting on, and every to-do for the clinician. Report only what the ' + 'messages say; never add clinical advice. Reply with JSON only: {"items": [{"kind": "event" | "follow_up" | "todo", ' + '"summary": string, "conversation_id": string, "due": string | null}]}' async function listMessagesSince(accessToken, since) { const messages = [] let cursor = null do { const url = new URL(`${API}/me/messages`) url.searchParams.set('after', since) url.searchParams.set('q', '-from:me') url.searchParams.set('group_by', 'conversation') url.searchParams.set('order', 'asc') url.searchParams.set('page[limit]', '100') if (cursor) url.searchParams.set('page[after]', cursor) const response = await fetch(url, { headers: { Authorization: `Bearer ${accessToken}` } }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const { data, pagination } = await response.json() messages.push(...data) cursor = pagination.has_more ? pagination.next_cursor : null } while (cursor) return messages } function transcript(messages) { const byConversation = Object.groupBy(messages, (m) => m.conversation.id) return Object.values(byConversation).map((thread) => [ `## ${thread[0].conversation.title} (conversation ${thread[0].conversation.id})`, ...thread.map((m) => `[${m.created_at}] ${m.sender.name} (${m.sender.kind}): ${m.body ?? `[file: ${m.file?.name}]`}`), ].join('\n')).join('\n\n') } // Run each morning for each connected clinician. export async function buildDigest(clinician, { getAccessToken, saveDigest, markRun }) { const startedAt = new Date().toISOString() const accessToken = await getAccessToken(clinician) // refreshes, or returns null if they must reconnect if (!accessToken) return saveDigest(clinician, { reconnect: true }) const messages = await listMessagesSince(accessToken, clinician.lastDigestAt) if (messages.length === 0) return markRun(clinician, startedAt) const reply = await anthropic.messages.create({ model: 'claude-sonnet-5', max_tokens: 2000, system: INSTRUCTIONS, messages: [{ role: 'user', content: transcript(messages) }], }) const text = reply.content[0].text const { items } = JSON.parse(text.slice(text.indexOf('{'), text.lastIndexOf('}') + 1)) // tolerate code fences await saveDigest(clinician, { items, messageCount: messages.length }) await markRun(clinician, startedAt) } ``` ```python filename="digest.py" import json from datetime import datetime, timezone from itertools import groupby import anthropic import requests client = anthropic.Anthropic() API = "https://api.bloomtext.com/v1" INSTRUCTIONS = ( "You summarize a clinician's BloomText messages for their morning digest. From the transcript, list every " "scheduled event, every follow-up someone is waiting on, and every to-do for the clinician. Report only what the " "messages say; never add clinical advice. Reply with JSON only: " '{"items": [{"kind": "event" | "follow_up" | "todo", "summary": string, "conversation_id": string, "due": string | null}]}' ) def list_messages_since(access_token: str, since: str) -> list[dict]: messages = [] params = {"after": since, "q": "-from:me", "group_by": "conversation", "order": "asc", "page[limit]": 100} while True: response = requests.get(f"{API}/me/messages", headers={"Authorization": f"Bearer {access_token}"}, params=params) response.raise_for_status() page = response.json() messages.extend(page["data"]) if not page["pagination"]["has_more"]: return messages params["page[after]"] = page["pagination"]["next_cursor"] def transcript(messages: list[dict]) -> str: sections = [] ordered = sorted(messages, key=lambda m: (m["conversation"]["id"], m["created_at"])) for conversation_id, thread in groupby(ordered, key=lambda m: m["conversation"]["id"]): thread = list(thread) section = [f"## {thread[0]['conversation']['title']} (conversation {conversation_id})"] for m in thread: text = m["body"] or f"[file: {(m['file'] or {}).get('name')}]" section.append(f"[{m['created_at']}] {m['sender']['name']} ({m['sender']['kind']}): {text}") sections.append("\n".join(section)) return "\n\n".join(sections) def build_digest(clinician, get_access_token, save_digest, mark_run): """Run each morning for each connected clinician.""" started_at = datetime.now(timezone.utc).isoformat() access_token = get_access_token(clinician) # refreshes, or returns None if they must reconnect if access_token is None: return save_digest(clinician, {"reconnect": True}) messages = list_messages_since(access_token, clinician.last_digest_at) if not messages: return mark_run(clinician, started_at) reply = client.messages.create( model="claude-sonnet-5", max_tokens=2000, system=INSTRUCTIONS, messages=[{"role": "user", "content": transcript(messages)}], ) text = reply.content[0].text items = json.loads(text[text.index("{"):text.rindex("}") + 1])["items"] # tolerate code fences save_digest(clinician, {"items": items, "message_count": len(messages)}) mark_run(clinician, started_at) ``` `getAccessToken` refreshes the clinician's token and saves the new refresh token, as shown in [Refresh an access token](https://www.bloomtext.com/developers/api/oauth/#refresh-an-access-token). The job records `startedAt` only after the digest is saved, so a failed run is picked up by the next one. ## Keep it safe - The model sees PHI. Your model provider needs a BAA with your organization, and the transcript should never leave infrastructure your BAA covers. - Store only what you show: the extracted items and links back to BloomText, not a copy of every message. - For anything clinical, link rather than paraphrase. Each item carries its `conversation_id`, so the clinician can open the original conversation before acting. - Stay read-only. The digest doesn't need `messages.write`; if you later add "reply from the digest", request it separately. See [Build an AI agent](https://www.bloomtext.com/developers/api/ai-agents/). - Spread the work out. Running every clinician at 7:00 sharp can hit [rate limits](https://www.bloomtext.com/developers/api/rate-limits/). Stagger jobs over the hour before the clinic opens. --- # Docs for AI agents > Machine-readable BloomText API docs for LLMs and coding agents, including llms.txt, per-page Markdown, the OpenAPI spec, and an agent skill. Source: https://www.bloomtext.com/developers/api/llms/ These docs are also published in machine-readable formats for LLMs and coding agents. Point your agent at any of these resources. | Resource | URL | Use it for | | --- | --- | --- | | `llms.txt` | [`/developers/api/llms.txt`](https://www.bloomtext.com/developers/api/llms.txt) | An index of every page with a one-line summary. | | `llms-full.txt` | [`/developers/api/llms-full.txt`](https://www.bloomtext.com/developers/api/llms-full.txt) | Every page's full text in one file, ready to drop into context. | | Page Markdown | Add `.md` to any page URL, like [`/developers/api/patient-api-quickstart.md`](https://www.bloomtext.com/developers/api/patient-api-quickstart.md) | One page as clean Markdown. | | OpenAPI 3.1 | [`/developers/api/openapi/bloomtext-api.yaml`](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml) | Generating clients, tools, and typed SDKs. Includes the API key scheme and scopes; features BloomText turns on per account are marked `x-status: planned`. Also as [JSON](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.json). | | OpenAPI 3.0 and Swagger 2.0 | [`/developers/api/openapi/bloomtext-api-3.0.yaml`](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-3.0.yaml), [`/developers/api/openapi/bloomtext-api-2.0.yaml`](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-2.0.yaml) | Tools that can't read 3.1, like Okta Workflows (3.0) and Microsoft Power Automate connectors (2.0). Generated from the 3.1 spec. | | Agent skill | [`/developers/api/skills/bloomtext-api/SKILL.md`](https://www.bloomtext.com/developers/api/skills/bloomtext-api/SKILL.md) | Teaching Claude Code, Codex, and other agents the API's rules. See [Agent skill](#agent-skill). | ## Copy any page Use the **Copy page** menu at the top of any page to copy it as Markdown, or to open it in ChatGPT or Claude and ask questions about it. ## Give your agent the whole API **Build a BloomText integration:** ```text Use the BloomText API docs at https://www.bloomtext.com/developers/api/llms-full.txt and the OpenAPI spec at https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml. For patient operations, my server uses an API key from BLOOMTEXT_API_KEY as a Bearer token; every patient operation names its patient by ID, phone number, or MRN. A key that reaches several organizations passes org_id from GET /orgs on every call. Staff provisioning uses /members and /teams. Operations marked x-status: planned are turned on per account and return an error until BloomText turns them on. Send an Idempotency-Key on every POST. Help me build the integration. ``` ## Agent skill The [BloomText API skill](https://www.bloomtext.com/developers/api/skills/bloomtext-api/SKILL.md) teaches a coding agent the API's rules: API keys, scopes and org_id, search syntax, idempotency, pagination, error codes, and what never to send. Agents that support [Agent Skills](https://agentskills.io) load it automatically for tasks that involve BloomText. ```bash filename="Terminal" mkdir -p .claude/skills/bloomtext-api curl -o .claude/skills/bloomtext-api/SKILL.md https://www.bloomtext.com/developers/api/skills/bloomtext-api/SKILL.md ``` ```bash filename="Terminal" mkdir -p ~/.codex/skills/bloomtext-api curl -o ~/.codex/skills/bloomtext-api/SKILL.md https://www.bloomtext.com/developers/api/skills/bloomtext-api/SKILL.md ``` Download [SKILL.md](https://www.bloomtext.com/developers/api/skills/bloomtext-api/SKILL.md) into your agent's skills folder, or paste it into its system instructions. To have an AI agent read and act in BloomText for your users, instead of writing code against the API, see [Build an AI agent](https://www.bloomtext.com/developers/api/ai-agents/). --- # Pagination > Page through BloomText API list endpoints with opaque cursors, page[limit], and page[after]. Source: https://www.bloomtext.com/developers/api/pagination/ List endpoints return results one page at a time, in a stable order, with an opaque cursor for the next page. ```json filename="Response" { "data": [ { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "...": "..." } ], "pagination": { "next_cursor": "eyJpZCI6IjRjYmZkYjUwIn0", "has_more": true } } ``` ## Parameters - `page[limit]` (integer): Number of records to return. Defaults to `50`, maximum `100`. - `page[after]` (string): The `next_cursor` from the previous page. Omit it for the first page. ## Response fields - `data` (array, required): The records on this page, in stable order. - `pagination.next_cursor` (string or null, required): Pass as `page[after]` to get the next page. `null` on the last page. - `pagination.has_more` (boolean, required): Whether another page may exist. A page with no records always has `has_more: false`, except when `partial` is true. - `pagination.partial` (boolean): Only on a filtered message read (`q`) that ran out of time, about 2 seconds, before finding a match. `data` is empty but the range isn't finished: follow `next_cursor`. This is the only case where an empty page isn't the end. Absent otherwise. A filtered read keeps looking until its page has at least one match or the range runs out, so a sparse search doesn't hand you empty pages. A page with matches can still be shorter than `page[limit]`, with `has_more: true`; keep following the cursor. ## Ordering Each list endpoint documents its order. Messages are newest first unless you pass `order=asc`, and `group_by=conversation` groups them by conversation. Conversations are ordered by latest activity, and members by name. Ties break on ID. A cursor keeps the order your first request saw, so you can retry a page safely. You never skip or repeat records, even when new messages arrive while you page. ## Fetch every page ```bash filename="Request" curl -g "https://api.bloomtext.com/v1/patient-messages?after=2026-09-21&page[limit]=100&page[after]=eyJpZCI6IjRjYmZkYjUwIn0" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="paginate.mjs" async function* listAll(path) { let cursor = null do { const url = new URL(`https://api.bloomtext.com/v1${path}`) // path may include ?q=… url.searchParams.set('page[limit]', '100') if (cursor) url.searchParams.set('page[after]', cursor) const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}` }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const { data, pagination } = await response.json() yield* data cursor = pagination.has_more ? pagination.next_cursor : null } while (cursor) } for await (const message of listAll('/patient-messages?after=2026-09-21')) { console.log(message.id) } ``` ```python filename="paginate.py" import os import requests session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['BLOOMTEXT_API_KEY']}" def list_all(path, **query): params = {**query, "page[limit]": 100} while True: response = session.get(f"https://api.bloomtext.com/v1{path}", params=params) response.raise_for_status() page = response.json() yield from page["data"] if not page["pagination"]["has_more"]: return params["page[after]"] = page["pagination"]["next_cursor"] for message in list_all("/patient-messages", after="2026-09-21"): print(message["id"]) ``` ```go filename="paginate.go" type page struct { Data []json.RawMessage `json:"data"` Pagination struct { NextCursor *string `json:"next_cursor"` HasMore bool `json:"has_more"` } `json:"pagination"` } func listAll(path string, params url.Values) ([]json.RawMessage, error) { var all []json.RawMessage params.Set("page[limit]", "100") for { req, _ := http.NewRequest("GET", "https://api.bloomtext.com/v1"+path+"?"+params.Encode(), nil) req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { return nil, err } var p page err = json.NewDecoder(res.Body).Decode(&p) res.Body.Close() if err != nil { return nil, err } all = append(all, p.Data...) if !p.Pagination.HasMore { return all, nil } params.Set("page[after]", *p.Pagination.NextCursor) } } ``` ```ruby filename="paginate.rb" require "net/http" require "json" def list_all(path, query = {}) Enumerator.new do |yielder| params = query.merge("page[limit]" => 100) loop do uri = URI("https://api.bloomtext.com/v1#{path}") uri.query = URI.encode_www_form(params) request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) } page = JSON.parse(response.body) page["data"].each { |record| yielder << record } break unless page["pagination"]["has_more"] params["page[after]"] = page["pagination"]["next_cursor"] end end end list_all("/patient-messages", "after" => "2026-09-21").each { |message| puts message["id"] } ``` ## Tips - **Treat cursors as opaque.** Don't parse, build, or store them long-term. A cursor is valid for 24 hours. - **Request large pages.** `page[limit]=100` uses fewer requests against your [rate limit](https://www.bloomtext.com/developers/api/rate-limits/). - **Follow new messages with `after`, not cursors.** Request again with `after` set to the newest message you've seen. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages). --- # Idempotency > Retry BloomText API writes safely with the Idempotency-Key header, without sending a message or creating a record twice. Source: https://www.bloomtext.com/developers/api/idempotency/ An idempotency key lets you retry a write without performing it twice. If a request times out after BloomText has already sent your message, the retry returns the original result instead of sending again. Every `POST` request requires an `Idempotency-Key` header. Generate a new UUID for each logical write, and reuse it when you retry that write. ```http filename="Header" Idempotency-Key: 9f1c2b3a-7d4e-4f5a-8b6c-1d2e3f4a5b6c ``` > **Warning:** **Every retry must reuse its `Idempotency-Key`. A new key is a new message.** If your integration sends a retry with a freshly generated key, BloomText treats it as a separate request and texts the patient again. That duplicate is a bug in the integration, and BloomText can't detect it. Store the key with the job before the first attempt, and send the same key on every retry, including after timeouts, `429`, and `5xx` responses. ## How it works | You send | BloomText returns | | --- | --- | | A new key | Processes the request normally and remembers the result for 24 hours. | | The same key, method, path, and body within 24 hours | The original response, without running the write again. It carries `Idempotent-Replayed: true` and the original request's `X-Request-Id`, so it matches what you logged the first time. | | The same key with a different method, path, or body | `409 Conflict` with `code: idempotency_key_reused`. | | The same key while the first request is still running | `409 Conflict` with `code: idempotency_request_in_progress`. Retry shortly. | `PATCH` requests set fields to the values you send, so repeating one is safe and they don't take a key. `DELETE` requests are identified by their path, so they don't take a key either. A second delete of the same resource returns `404`, which you can treat as success. ## Retry safely ```js filename="send-with-retry.mjs" async function sendMessage(patientId, body) { const idempotencyKey = crypto.randomUUID() // one key per logical send for (let attempt = 1; attempt <= 4; attempt++) { try { const response = await fetch('https://api.bloomtext.com/v1/patient-messages', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': idempotencyKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ to: { patient_id: patientId }, body, channel: 'sms' }), }) if (response.status < 500 && response.status !== 429) return await response.json() } catch { // Network error: safe to retry with the same key. } await new Promise((resolve) => setTimeout(resolve, 2 ** attempt * 250)) } throw new Error('Message not sent after 4 attempts') } ``` ```python filename="send_with_retry.py" import os import time import uuid import requests def send_message(patient_id: str, body: str) -> dict: idempotency_key = str(uuid.uuid4()) # one key per logical send for attempt in range(1, 5): try: response = requests.post( "https://api.bloomtext.com/v1/patient-messages", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": idempotency_key, }, json={"to": {"patient_id": patient_id}, "body": body, "channel": "sms"}, timeout=10, ) if response.status_code < 500 and response.status_code != 429: return response.json() except requests.RequestException: pass # Network error: safe to retry with the same key. time.sleep(2**attempt * 0.25) raise RuntimeError("Message not sent after 4 attempts") ``` ```go filename="retry.go" func sendMessage(patientID, text string) (*http.Response, error) { idempotencyKey := uuid.NewString() // one key per logical send payload, _ := json.Marshal(map[string]any{ "to": map[string]string{"patient_id": patientID}, "body": text, "channel": "sms", }) url := "https://api.bloomtext.com/v1/patient-messages" for attempt := 1; attempt <= 4; attempt++ { req, _ := http.NewRequest("POST", url, bytes.NewReader(payload)) req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", idempotencyKey) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err == nil && res.StatusCode < 500 && res.StatusCode != 429 { return res, nil } if err == nil { res.Body.Close() } time.Sleep(time.Duration(1< How the BloomText API reports errors, with HTTP status codes, problem details, and machine-readable error codes. Source: https://www.bloomtext.com/developers/api/errors/ Failed requests return a standard HTTP status code and an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details body with `Content-Type: application/problem+json`. Branch on the `code` field, not the human-readable text. ```json filename="Response · 403 Forbidden" { "type": "https://www.bloomtext.com/developers/api/errors/#insufficient_scope", "title": "Forbidden", "status": 403, "code": "insufficient_scope", "detail": "This endpoint needs the messages.write scope, and the user didn't grant it.", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [] } ``` ## The problem object - `type` (URL, required): Link to the documentation for this error. - `title` (string, required): Short, human-readable summary of the status. - `status` (integer, required): The HTTP status code, repeated for convenience. - `code` (string, required): Machine-readable error code. See [Error codes](#error-codes). - `detail` (string): Explanation of this specific occurrence. - `request_id` (UUID, required): Unique ID for the request. Include it when you contact support. - `field_errors` (array of FieldError, required): Per-field problems for `422` responses. Empty otherwise. Child attributes: - `path` (string, required): JSON pointer to the field, like `/body`, or the query parameter or header name. - `code` (string, required): Machine-readable validation code, like `too_long` or `required`. - `message` (string, required): Human-readable explanation. ## HTTP status codes | Status | Meaning | Retry? | | --- | --- | --- | | `200`, `201`, `202`, `204` | Success. A `202` send waits for the patient's consent to texting. | No | | `400` | The request is malformed. | No, fix the request. | | `401` | The API key is missing, expired, or revoked (or, with OAuth, the access token is). | No; with OAuth, after refreshing the token. | | `403` | The credential lacks the scope, an API key called an OAuth-only endpoint, or API access isn't turned on for the organization. | No | | `404` | The resource doesn't exist, or the key can't see it. | No | | `405` | The path exists but doesn't take that method. The `Allow` header lists the ones it does. | No | | `409` | An idempotency or state conflict. | Sometimes. See the code. | | `422` | A field failed validation. | No, fix the fields. | | `429` | Rate limited. | Yes, after `Retry-After` seconds. | | `500`, `503` | A temporary problem on our side. | Yes, with backoff and the same `Idempotency-Key`. | ## Error codes | Code | Status | What to do | | --- | --- | --- | | `invalid_request` | 400 | Check the JSON syntax and query string. | | `range_required` | 400 | With an API key, List messages needs `after`, `patient_id`, or `conversation_id`. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#choose-the-range). | | `patient_filter_required` | 400 | Look patients up by `phone` or `mrn`. Bulk listing isn't available; [contact BloomText](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access) if you need a sync. See [Patients](https://www.bloomtext.com/developers/api/patients/#find-a-patient). | | `org_id_required` | 400 | The API key reaches more than one organization. Pass `org_id`, from [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/). See [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). | | `invalid_query` | 400 | The `q` search query can't be parsed. `detail` points at the problem. See [Search](https://www.bloomtext.com/developers/api/search/). | | `invalid_token` | 401 | API key: check you're sending the whole key. With [OAuth](https://www.bloomtext.com/developers/api/oauth/): refresh the access token. If the refresh fails with `invalid_grant`, the admin must reconnect your app. See [When a connection ends](https://www.bloomtext.com/developers/api/oauth/#when-a-connection-ends). | | `key_revoked` | 401 | An Owner or IT person revoked this API key. Ask them for a new one. See [API keys](https://www.bloomtext.com/developers/api/api-keys/#rotate-or-revoke-a-key). | | `key_expired` | 401 | The API key's expiry has passed. An Owner or IT person can extend it under **Settings → Account → API keys**, or you can ask for a new one. See [Expiry](https://www.bloomtext.com/developers/api/api-keys/#expiry). | | `insufficient_scope` | 403 | The credential lacks the scope listed on the endpoint's reference page. Create a key with that scope. | | `api_access_disabled` | 403 | API access isn't turned on for your organization. It's turned on once a BAA is signed. See [API keys](https://www.bloomtext.com/developers/api/api-keys/) to request access. | | `plan_required` | 403 | The organization's plan doesn't include patient messaging, so it can't send to patients. Contact BloomText to add it. Everything else, like patient lookups, still works. | | `org_not_reachable` | 403 | The API key can't reach the organization in `org_id`. [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/) lists the ones it can. | | `accounts_not_enabled` | 403 | The members, teams, and organizations endpoints work once BloomText turns on accounts for your account. [Contact BloomText](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access). | | `oauth_required` | 403 | API keys can't call this endpoint. Everything under `/me`, and the staff directory, requires an [OAuth](https://www.bloomtext.com/developers/api/oauth/) token. | | `not_found` | 404 | Check the ID, and that the key reaches its organization. | | `method_not_allowed` | 405 | Use a method from the `Allow` header. | | `idempotency_key_reused` | 409 | Use a new `Idempotency-Key` for a different request. | | `idempotency_request_in_progress` | 409 | The original request is still running. Retry shortly. | | `ambiguous_recipient` | 409 | The phone number belongs to several patients. Pick one from `candidates` and send with `patient_id`. See [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/#who-gets-it). | | `recipient_mismatch` | 409 | `patient.mrn` belongs to a patient with a different phone number, or the number's only patient has a different MRN. Nothing was sent. Update the patient in `candidates`, or send with `patient_id`. See [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/#who-gets-it). | | `already_member` | 409 | The person is already a member of that organization. | | `patient_account` | 409 | The email belongs to a patient's BloomText account, which can't be a staff member. | | `managed_by_admin` | 409 | People in BloomText manage this membership or put this person on the team, so the API can't change it. See [Who manages a membership](https://www.bloomtext.com/developers/api/members-api/#who-manages-a-membership). | | `managed_by_account` | 409 | This is an Owner or IT person's membership, set on the Account page in BloomText. | | `managed_by_identity_provider` | 409 | The account's Okta rules manage this membership or team placement. Change it in Okta or in the rules. See [SSO and Directory Sync](https://www.bloomtext.com/developers/api/identity-and-sso/). | | `confirmation_required` | 409 | With `reason: would_delete_user`: removing this person deletes their BloomText user. Repeat with `confirm_delete_user=true` to do that. See [Remove a member](https://www.bloomtext.com/developers/api/members-api/#remove-a-member). | | `campaign_not_editable` | 409 | The campaign's status doesn't allow that change. See [Campaigns](https://www.bloomtext.com/developers/api/campaigns/#change-a-campaign). | | `campaign_not_startable` | 409 | The campaign is already running, completed, stopped, or archived. | | `campaign_not_running` | 409 | Only a running campaign can be paused. Only a running or paused campaign can be stopped. | | `campaign_not_deletable` | 409 | Only a draft campaign can be deleted. Archive a started one instead. | | `validation_failed` | 422 | Fix each field listed in `field_errors`. | | `unknown_field` | 422 | The body has a field the endpoint doesn't take. Each one is in `field_errors`, and the message says where it goes when it belongs elsewhere. See [Unknown fields are rejected](#unknown-fields-are-rejected). | | `campaign_empty` | 422 | Add recipients before starting the campaign. | | `from_required` | 422 | The organization has several phone numbers and no default. `detail` and `numbers` list them; set `from` to one. See [Which number it comes from](https://www.bloomtext.com/developers/api/send-messages/#which-number-it-comes-from). | | `channel_required` | 422 | Set `channel` to `sms` or `secure`. There's no default. See [Secure or plain text](https://www.bloomtext.com/developers/api/send-messages/#secure-or-plain-text). | | `too_long` | 422 | The body is over `max` characters (1,600 for SMS). `length` says how long it was. Shorten it, split it yourself, or send it `secure`. | | `patient_has_no_phone` | 422 | An SMS to a patient with no phone number. Add one, or send `secure` if they have an email address. | | `no_contact_method` | 422 | A secure message to a patient with neither phone nor email. Update the patient. | | `contact_cap_reached` | 422 | The organization has texted as many new patients as it can this billing period until BloomText verifies it. Contact support to get verified. | | `patient_opted_out` | 422 | The patient replied STOP to your organization, or staff recorded their opt-out (`since` says when), so no number can text them until they reply START. Stop texting them; a `secure` message still reaches them by email. See [Opt-outs and blocked numbers](https://www.bloomtext.com/developers/api/send-messages/#opt-outs-and-blocked-numbers). | | `carrier_blocked` | 422 | The carrier refused an earlier text to the patient, so none of your organization's numbers text them. Stop texting them; they can text START to one of your numbers. | | `number_blocked` | 422 | An admin in your organization blocked the patient's number, so none of its numbers text them. Stop texting them; only an admin can unblock it, in the app. | | `number_unreachable` | 422 | An earlier text failed because the patient's number can't receive texts: a landline, or a carrier that couldn't be reached. None of your organization's numbers text it until the patient texts one of your numbers, their phone number is changed, or an admin clears it in the app. Update the patient's mobile number, or send `secure`. | | `rate_limited` | 429 | Wait `Retry-After` seconds, then retry. | | `internal_error` | 500 | Retry with backoff. If it persists, contact support with the `request_id`. | | `service_unavailable` | 503 | Retry with backoff. | ## Unknown fields are rejected A `POST` or `PATCH` body may only contain the fields its reference page lists. Any other field, such as a typo or a field in the wrong place, returns `422 unknown_field` before anything runs. Nothing is sent or changed, and the `Idempotency-Key` isn't used up, so fix the body and send it again with the same key. Each unknown field gets an entry in `field_errors`, with its JSON pointer and where it belongs, if anywhere: ```json filename="Response · 422 Unprocessable Entity" { "type": "https://www.bloomtext.com/developers/api/errors/#unknown_field", "title": "Unprocessable Entity", "status": 422, "code": "unknown_field", "detail": "The body has fields this endpoint doesn't take. Unknown fields are rejected rather than ignored, so a typo or a misplaced field never goes unnoticed. Fix each one in field_errors.", "request_id": "0b6c2d1e-5f4a-4c3b-9a8d-7e6f5a4b3c2d", "field_errors": [ { "path": "/patient", "code": "unknown_field", "message": "'patient' isn't a top-level field; put it under 'to'." } ] } ``` Responses work the other way: they may gain new fields within `v1`, so ignore fields you don't recognize. See the [Changelog](https://www.bloomtext.com/developers/api/changelog/). ## Handle errors ```js const response = await fetch(url, options) if (!response.ok) { const problem = await response.json() switch (problem.code) { case 'invalid_token': // Refresh the access token and retry once. If refreshing fails, ask the user to reconnect. break case 'rate_limited': await new Promise((r) => setTimeout(r, Number(response.headers.get('Retry-After')) * 1000)) break default: throw new Error(`${problem.status} ${problem.code}: ${problem.detail} (request ${problem.request_id})`) } } ``` ```python response = session.post(url, json=payload, headers=headers) if not response.ok: problem = response.json() if problem["code"] == "invalid_token": ... # Refresh the access token and retry once. If refreshing fails, ask the user to reconnect. elif problem["code"] == "rate_limited": time.sleep(int(response.headers["Retry-After"])) else: raise RuntimeError(f"{problem['status']} {problem['code']}: {problem.get('detail')} (request {problem['request_id']})") ``` ```go type Problem struct { Status int `json:"status"` Code string `json:"code"` Detail string `json:"detail"` RequestID string `json:"request_id"` } if res.StatusCode >= 400 { var p Problem json.NewDecoder(res.Body).Decode(&p) switch p.Code { case "rate_limited": wait, _ := strconv.Atoi(res.Header.Get("Retry-After")) time.Sleep(time.Duration(wait) * time.Second) default: return fmt.Errorf("%d %s: %s (request %s)", p.Status, p.Code, p.Detail, p.RequestID) } } ``` ```ruby unless response.is_a?(Net::HTTPSuccess) problem = JSON.parse(response.body) case problem["code"] when "rate_limited" sleep response["Retry-After"].to_i else raise "#{problem["status"]} #{problem["code"]}: #{problem["detail"]} (request #{problem["request_id"]})" end end ``` The OAuth token endpoint, `https://app.bloomtext.com/oauth/token`, is the one exception. It returns standard OAuth errors like `invalid_grant` instead of problem details. See [Token endpoint errors](https://www.bloomtext.com/developers/api/oauth/#token-endpoint-errors). > **Note:** Every response, success or error, includes an `X-Request-Id` header with the same value as `request_id`. Log it alongside your own request logs. --- # Rate limits > BloomText API rate limits, rate limit headers, and how to stay under them. Source: https://www.bloomtext.com/developers/api/rate-limits/ API key limits apply to each organization. All of an organization's API keys share them, so a second key doesn't add to them. A key that reaches several organizations counts each call against the organization it names with `org_id`; a call that names none, like [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/), counts against the key itself. - **Requests from an organization's API keys:** 300 per minute, with bursts of up to 10 requests per second. [Imports](https://www.bloomtext.com/developers/api/patients/#import-patients) and [campaigns](https://www.bloomtext.com/developers/api/campaigns/) count as one request each, however many patients they cover. - **Messages from an organization's API keys:** 60 per minute. Every message you send counts, one by one or in a [batch](https://www.bloomtext.com/developers/api/send-messages/#sending-to-many-patients). A batch of up to 60 messages counts as one request. A request whose messages don't fit in what's left of the minute is refused whole with `429`, and none of its messages are sent. - **Each [OAuth](https://www.bloomtext.com/developers/api/oauth/) connection** (one admin connected to one app): 60 requests per minute, with bursts of up to 10 requests per second. Your app also has an overall limit, set when we register it. ## Rate limit headers Every response to a valid API key includes these headers, errors included. A request with a missing or invalid key gets `401` without them. | Header | Meaning | | --- | --- | | `RateLimit-Limit` | Requests allowed per minute. On a `429`, the limit that was hit: requests per minute, requests per second, or messages per minute. | | `RateLimit-Remaining` | What's left in that window. | | `RateLimit-Reset` | Seconds until that window resets. | | `Retry-After` | On `429` responses only: whole seconds to wait before retrying. | ```http filename="Response · 429 Too Many Requests" HTTP/1.1 429 Too Many Requests Content-Type: application/problem+json Retry-After: 12 RateLimit-Limit: 60 RateLimit-Remaining: 0 RateLimit-Reset: 12 ``` ## Handle a 429 1. Wait the number of seconds in `Retry-After`. 2. Send the same request again **with the same `Idempotency-Key`**. A request refused with `429` was never run, so retrying it can't send anything twice. A new key would be a new request; see [Idempotency](https://www.bloomtext.com/developers/api/idempotency/#retry-safely). 3. If you get `429` again, keep waiting `Retry-After`, and back off further each time. ## Stay under the limit - **Read only what's new.** Request messages with `after` set to the newest one you've seen instead of re-reading a whole range. Polling every 1 to 5 minutes is enough. See [Read messages](https://www.bloomtext.com/developers/api/read-messages/#keep-up-with-new-messages). - **Read across conversations at once.** One [List messages](https://www.bloomtext.com/developers/api/read-messages/) request with a time range replaces a request per conversation. - **Page with `page[limit]=100`.** Larger pages mean fewer requests. See [Pagination](https://www.bloomtext.com/developers/api/pagination/). - **Back off exponentially** after a `429` or `503`, starting from `Retry-After` when it's present. - **Spread out batch jobs.** Digests for 300 clinicians that all run at 7:00 sharp hit your app's overall limit. Stagger them over the hour before the clinic opens. > **Note:** Need higher limits? BloomText can raise them for your organization on request. Mention it when you [request API access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access), or ask your BloomText contact. --- # Changelog > Dated changes to the BloomText API and these docs, including new endpoints, fields, authentication, and behavior changes. Source: https://www.bloomtext.com/developers/api/changelog/ This page lists changes to the BloomText API and these docs. The API is versioned in the URL (`/v1`). Additive changes, such as new endpoints, fields, or search operators, ship within `v1`, so build clients that ignore fields they don't recognize. Breaking changes ship as a new version, announced here first. ## November 1, 2026 ### Request access, API identities, and the docs for IT - Features BloomText turns on per account now have a **Request access** button that books a call: OAuth (client credentials and authorization code, everything under `/me` and `/users`), [webhooks](https://www.bloomtext.com/developers/api/webhooks/), [API identities](https://www.bloomtext.com/developers/api/api-identity/), [phone-number limits on keys](https://www.bloomtext.com/developers/api/api-keys/#limit-a-key-to-phone-numbers), [campaigns](https://www.bloomtext.com/developers/api/campaigns/), [patient imports](https://www.bloomtext.com/developers/api/patients/#import-patients), and the [audit events API](https://www.bloomtext.com/developers/api/reporting-and-audit/#audit-events-api). They replace the earlier banners. The [OpenAPI spec](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml) still marks them `x-status: planned`. - [API identities](https://www.bloomtext.com/developers/api/api-identity/): sending keys belong to an automated sender with its own name, avatar, teams and numbers. - New pages: [SSO and Directory Sync](https://www.bloomtext.com/developers/api/identity-and-sso/), on Okta single sign-on and provisioning alongside the members API, and [Reporting and audit data](https://www.bloomtext.com/developers/api/reporting-and-audit/). - Members managed by the account's Okta rules show `managed_by: okta`, and changing them through the API returns `409 managed_by_identity_provider`. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). - The OpenAPI spec is also published as [JSON](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.json), alongside the 3.0 and 2.0 copies, with a Postman collection generated from it. See the [API reference](https://www.bloomtext.com/developers/api/reference/). - The API keys tab is **Settings → Account → API keys**. ## October 31, 2026 ### Account keys and the members API - API keys belong to your account. An Owner or IT person creates them under **Settings → Account → API keys**, for every organization on the account or only some. Organizations no longer have an API keys tab. See [API keys](https://www.bloomtext.com/developers/api/api-keys/). - A key that reaches several organizations passes `org_id` on every call, or gets `400 org_id_required`; an `org_id` it can't reach returns `403 org_not_reachable`. Keys made before keep working with no `org_id`. See [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). - New endpoints: [`GET /orgs`](https://www.bloomtext.com/developers/api/reference/list-orgs/), [`/members`](https://www.bloomtext.com/developers/api/reference/list-members/), [`/teams`](https://www.bloomtext.com/developers/api/reference/list-teams/), [`/teams/{teamId}/members`](https://www.bloomtext.com/developers/api/reference/add-team-member/), and [`/member-events`](https://www.bloomtext.com/developers/api/reference/list-member-events/), with the new scopes `members.read`, `members.write`, and `teams.write`. They return `403 accounts_not_enabled` until BloomText turns on accounts for your account. See [Manage members](https://www.bloomtext.com/developers/api/members-api/). ### Sends that wait for consent to text - When your organization requires consent before texting and the patient's phone hasn't agreed yet, [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) returns `202 Accepted` instead of `201`. The message is in the conversation with `delivery.status` `consent_requested`, and BloomText texts the patient a consent request. The text goes out when they reply YES or staff record their consent. See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status). - [Send messages in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) reports these messages with `status: consent_requested`. - A retry with the same `Idempotency-Key` returns the stored result and sends nothing new. - A message BloomText didn't send for lack of consent becomes `rejected` with `delivery.error_code` `consent_required` (the patient hasn't given consent) or `consent_not_sent` (the text waited for consent and wasn't sent). See [Delivery status](https://www.bloomtext.com/developers/api/send-messages/#delivery-status). ## October 20, 2026 ### Org admins create API keys - Once BloomText turns on API access for your organization, an org admin creates keys under **Settings → API keys → Create API key**, choosing the name, scopes, and expiry. See [API keys](https://www.bloomtext.com/developers/api/api-keys/). ## October 15, 2026 ### Sends to a phone number never switch patients - A send to `to.phone` with a `patient.mrn` that belongs to a patient with a different number now returns `409 recipient_mismatch` instead of texting the number on file. So does a number whose only patient has a different MRN. Nothing is sent; update the patient, or send with `patient_id`. See [Who gets it](https://www.bloomtext.com/developers/api/send-messages/#who-gets-it). - A phone number check that fails on BloomText's side now returns `500 internal_error`, which you can retry with the same `Idempotency-Key`, instead of `422 validation_failed`. - An API key's default number that's no longer one of the organization's numbers is ignored, so a one-number organization still sends without `from`. ## October 14, 2026 ### Numbers that can't receive texts - When a text fails with carrier error 30006 (a landline, or a carrier that couldn't be reached), BloomText stops texting that number from all of your organization's numbers. Later sends return `422 number_unreachable`, with `number` and `since`, and a text already queued becomes `rejected` with `delivery.error_code` `number_unreachable`. See [Opt-outs and blocked numbers](https://www.bloomtext.com/developers/api/send-messages/#opt-outs-and-blocked-numbers). - [Patients](https://www.bloomtext.com/developers/api/reference/patient-object/) list it in `sms_undeliverable_reasons` as `unreachable`, after the other reasons. - It clears when the patient texts one of your numbers, when their phone number is changed, or when an admin clears it in the app. ## October 13, 2026 ### Rate limits per organization - API key rate limits now apply to the organization, shared by all its keys, instead of to each key. A second key no longer adds to them. - The limits are now 300 requests per minute, with bursts of 10 per second, and 60 messages per minute. A text number can only send so fast; a faster API backs texts up at the carrier, which delays every text from that number, including staff replies. - [Send messages in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) takes up to 60 messages (was 500). A larger batch returns `422 validation_failed`. - BloomText can raise the limits for an organization on request. See [Rate limits](https://www.bloomtext.com/developers/api/rate-limits/). ## October 12, 2026 ### Batch sends and higher limits - [Send messages in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/): `POST /v1/messages:batch` sends up to 500 messages in one request and returns `207 Multi-Status` with a result per message. - API keys get 600 requests per minute (was 300), with bursts of 20 per second, and a new limit of 5,000 messages per minute. See [Rate limits](https://www.bloomtext.com/developers/api/rate-limits/). - [Idempotency](https://www.bloomtext.com/developers/api/idempotency/) now says it plainly: every retry must reuse its `Idempotency-Key`. A new key is a new message. ### Clearer send errors - `channel` is now required on every send: `422 channel_required` without it. - A text that can't be sent fails before it's queued, with `422 patient_opted_out`, `carrier_blocked`, `number_blocked` (an admin blocked the patient's number), or `patient_has_no_phone`. See [Opt-outs and blocked numbers](https://www.bloomtext.com/developers/api/send-messages/#opt-outs-and-blocked-numbers). - A text over 1,600 characters returns `422 too_long` with `length` and `max`. See [Long texts](https://www.bloomtext.com/developers/api/send-messages/#long-texts). - A send without `from`, when the organization has several numbers and no default, returns `422 from_required` with the numbers to choose from. ### Sends need the patient messaging plan - Sending to patients (`POST /v1/patient-messages` and `POST /v1/messages:batch`) now needs the organization's plan to include patient messaging, as in the app. Without it, the request returns `403 plan_required`, a batch as a whole, and nothing is sent. ### Unknown fields are rejected - A `POST` or `PATCH` body with a field the endpoint doesn't take now returns `422 unknown_field`, instead of the field being ignored. `field_errors` names each one and, for a field in the wrong place, where it goes, like `'patient' isn't a top-level field; put it under 'to'.` Nothing runs, and the `Idempotency-Key` can be reused with the fixed body. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### API keys expire and can be revoked - Every [API key](https://www.bloomtext.com/developers/api/api-keys/) has an expiry: 1 day, 7 days, 30 days, 90 days (the default for new keys), 1 year, or never. Keys created before today never expire. Requests with an expired key return `401` with the new code `key_expired`. - Org admins can see, extend, and revoke their organization's keys under **Settings → API keys**. Requests with a revoked key return `401` with the new code `key_revoked`. - `invalid_token` now only means the key is missing, malformed, or not a BloomText key. ### Opt-out state on patients, and what isn't served - [Patients](https://www.bloomtext.com/developers/api/reference/patient-object/) now report whether your organization can text them. `sms_opted_out` was always `false` before; it's now `true` when the patient can't be texted for any reason. The new `sms_undeliverable_reasons` says why: `opted_out`, `carrier_blocked`, or `admin_blocked`. Each one blocks all of your organization's numbers. - [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) is served: `GET /v1/patient-messages/{messageId}` returns one message, with its delivery status, under the same rules as the list. - Endpoints that are documented but not served are marked in the docs: campaigns, patient imports, and OAuth (everything under `/me` and `/users`). The [OpenAPI spec](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml) marks them `x-status: planned`. Since November 1, 2026 their pages have a **Request access** button. ## September 26, 2026 ### BloomText API v1 The first version of the BloomText API, with two ways in: the Patient API for servers, and OAuth for an org admin's own conversations. > **Note:** Correction, November 1, 2026: OAuth (everything under `/me` and `/users`), campaigns and patient imports were documented in this release but not served. BloomText now turns them on for an account that asks; see [OAuth](https://www.bloomtext.com/developers/api/authentication/#oauth). The API key, patients, patient messages, phone numbers, search on `/patient-messages`, and the conventions below shipped as described. **Authentication** - [API keys](https://www.bloomtext.com/developers/api/api-keys/) belong to the organization and reach patient operations. - [OAuth 2.0](https://www.bloomtext.com/developers/api/oauth/), using the authorization code flow with PKCE, for an org admin's own conversations. - [Scopes](https://www.bloomtext.com/developers/api/authentication/#scopes): `messages.read`, `messages.write`, `patients.read`, and `patients.write`, shared by keys and OAuth, plus `offline_access` for OAuth. **Patient API** - [Send messages to patients](https://www.bloomtext.com/developers/api/send-messages/) by patient ID or phone number. Messages go by secure link unless you ask for SMS, and report delivery status. - [Patients](https://www.bloomtext.com/developers/api/patients/): find by phone or MRN; create, update, and delete. BloomText turns imports on for an account that asks. - [Campaigns](https://www.bloomtext.com/developers/api/campaigns/): one message to many patients from a clinic phone number. - [Phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/): the clinic numbers messages come from. **Reading and search** - [Read messages](https://www.bloomtext.com/developers/api/read-messages/) in a time range with `GET /patient-messages`, or `GET /me/messages` with OAuth, one by one or grouped by conversation. - [Search](https://www.bloomtext.com/developers/api/search/) with `q`, including operators like `from:patient`, `mrn:`, and `is:unread`. **Conventions** - [Idempotency keys](https://www.bloomtext.com/developers/api/idempotency/) on every `POST`, [cursor pagination](https://www.bloomtext.com/developers/api/pagination/), and [problem details errors](https://www.bloomtext.com/developers/api/errors/). - The [OpenAPI 3.1 spec](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml) and [docs for AI agents](https://www.bloomtext.com/developers/api/llms/). --- # API reference > Every BloomText API endpoint and object, with parameters, scopes, example requests, and responses, and the OpenAPI spec to download. Source: https://www.bloomtext.com/developers/api/reference/ The BloomText API is a REST API with JSON request and response bodies, standard HTTP status codes, and bearer authentication with an API key. Everything on these pages is generated from the OpenAPI spec below, which you can also import into Postman, Okta Workflows, or any client generator. Download the OpenAPI spec: [OpenAPI 3.1 (YAML)](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.yaml), [OpenAPI 3.1 (JSON)](https://www.bloomtext.com/developers/api/openapi/bloomtext-api.json), [OpenAPI 3.0](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-3.0.yaml) (Okta Workflows), [Swagger 2.0](https://www.bloomtext.com/developers/api/openapi/bloomtext-api-2.0.yaml) (Power Automate), and a [Postman collection](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json). ```text filename="Base URL" https://api.bloomtext.com/v1 ``` > **Note:** New to the API? Start with the [Patient API quickstart](https://www.bloomtext.com/developers/api/patient-api-quickstart/), then read [Authentication](https://www.bloomtext.com/developers/api/authentication/) for API keys and scopes. To provision staff, see [Manage members](https://www.bloomtext.com/developers/api/members-api/). ## Endpoints by credential - [All Patient API endpoints](https://www.bloomtext.com/developers/api/reference/patient-api-endpoints/) - [All account endpoints](https://www.bloomtext.com/developers/api/reference/account-endpoints/) - [All OAuth endpoints](https://www.bloomtext.com/developers/api/reference/oauth-endpoints/) ## Resources - [Organization](https://www.bloomtext.com/developers/api/reference/organization-object/) - [Patients](https://www.bloomtext.com/developers/api/reference/patient-object/) - [Patient imports](https://www.bloomtext.com/developers/api/reference/patient-import-object/) - [Patient messages](https://www.bloomtext.com/developers/api/reference/message-object/) - [Patient conversations](https://www.bloomtext.com/developers/api/reference/conversation-object/) - [Phone numbers](https://www.bloomtext.com/developers/api/reference/phone-number-object/) - [Campaigns](https://www.bloomtext.com/developers/api/reference/campaign-object/) - [Profile](https://www.bloomtext.com/developers/api/reference/profile-object/) - [Messages](https://www.bloomtext.com/developers/api/reference/message-object/) - [Reactions](https://www.bloomtext.com/developers/api/reference/reaction-object/) - [Conversations](https://www.bloomtext.com/developers/api/reference/conversation-object/) - [Participants](https://www.bloomtext.com/developers/api/reference/participant-object/) - [Users](https://www.bloomtext.com/developers/api/reference/user-object/) - [Organizations](https://www.bloomtext.com/developers/api/reference/org-object/) - [Members](https://www.bloomtext.com/developers/api/reference/member-object/) - [Teams](https://www.bloomtext.com/developers/api/reference/team-object/) - [Member events](https://www.bloomtext.com/developers/api/reference/member-event-object/) - [Audit events](https://www.bloomtext.com/developers/api/reference/audit-event-object/) ## Conventions - **Authentication:** send an API key as `Authorization: Bearer …`. See [Authentication](https://www.bloomtext.com/developers/api/authentication/). - **Access:** an API key reaches the Patient API: patient records by ID, phone, or MRN, and bounded reads of patient messages. With member scopes it also reaches the account endpoints for organizations, members and teams. - **Turned on per account:** some endpoints, including OAuth, which reaches a person's own conversations under `/me`, are turned on for an account that asks; their pages have a **Request access** button. - **Organizations:** a key that reaches more than one organization names one with `org_id` on every call. See [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). - **Search:** message lists take a `q` of words and operators, like `refill from:patient`. See [Search](https://www.bloomtext.com/developers/api/search/). - **IDs:** objects have a stable `id`, usually a UUID. - **Timestamps:** RFC 3339 strings in UTC, like `2026-09-21T12:00:00Z`. - **Lists:** cursor-paginated with `page[limit]` and `page[after]`. See [Pagination](https://www.bloomtext.com/developers/api/pagination/). - **Writes:** every `POST` takes an `Idempotency-Key`. See [Idempotency](https://www.bloomtext.com/developers/api/idempotency/). - **Errors:** RFC 9457 problem details. See [Errors](https://www.bloomtext.com/developers/api/errors/). ## All endpoints ### Organization | Method | Path | Endpoint | | --- | --- | --- | | GET | `/organization` | [Retrieve the organization](https://www.bloomtext.com/developers/api/reference/get-organization/) | ### Patients | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patients` | [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) | | POST | `/patients` | [Create a patient](https://www.bloomtext.com/developers/api/reference/create-patient/) | | GET | `/patients/{patientId}` | [Retrieve a patient](https://www.bloomtext.com/developers/api/reference/get-patient/) | | PATCH | `/patients/{patientId}` | [Update a patient](https://www.bloomtext.com/developers/api/reference/update-patient/) | | DELETE | `/patients/{patientId}` | [Delete a patient](https://www.bloomtext.com/developers/api/reference/delete-patient/) | ### Patient imports | Method | Path | Endpoint | | --- | --- | --- | | POST | `/patient-imports` | [Import patients](https://www.bloomtext.com/developers/api/reference/create-patient-import/) | | GET | `/patient-imports/{importId}` | [Retrieve an import](https://www.bloomtext.com/developers/api/reference/get-patient-import/) | ### Patient messages | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patient-messages` | [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) | | POST | `/patient-messages` | [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) | | POST | `/messages:batch` | [Send messages to patients in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) | | GET | `/patient-messages/{messageId}` | [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) | ### Patient conversations | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patient-conversations` | [List patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) | | GET | `/patient-conversations/{conversationId}` | [Retrieve a patient conversation](https://www.bloomtext.com/developers/api/reference/get-patient-conversation/) | ### Phone numbers | Method | Path | Endpoint | | --- | --- | --- | | GET | `/phone-numbers` | [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | ### Campaigns | Method | Path | Endpoint | | --- | --- | --- | | GET | `/campaigns` | [List campaigns](https://www.bloomtext.com/developers/api/reference/list-campaigns/) | | POST | `/campaigns` | [Create a campaign](https://www.bloomtext.com/developers/api/reference/create-campaign/) | | GET | `/campaigns/{campaignId}` | [Retrieve a campaign](https://www.bloomtext.com/developers/api/reference/get-campaign/) | | PATCH | `/campaigns/{campaignId}` | [Update a campaign](https://www.bloomtext.com/developers/api/reference/update-campaign/) | | DELETE | `/campaigns/{campaignId}` | [Delete a campaign](https://www.bloomtext.com/developers/api/reference/delete-campaign/) | | GET | `/campaigns/{campaignId}/recipients` | [List campaign recipients](https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/) | | POST | `/campaigns/{campaignId}/recipients` | [Add campaign recipients](https://www.bloomtext.com/developers/api/reference/add-campaign-recipients/) | | POST | `/campaigns/{campaignId}/recipients/remove` | [Remove campaign recipients](https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/) | | POST | `/campaigns/{campaignId}/start` | [Start a campaign](https://www.bloomtext.com/developers/api/reference/start-campaign/) | | POST | `/campaigns/{campaignId}/pause` | [Pause a campaign](https://www.bloomtext.com/developers/api/reference/pause-campaign/) | | POST | `/campaigns/{campaignId}/stop` | [Stop a campaign](https://www.bloomtext.com/developers/api/reference/stop-campaign/) | ### Profile | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me` | [Retrieve the profile](https://www.bloomtext.com/developers/api/reference/get-profile/) | ### Messages | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/messages` | [List messages](https://www.bloomtext.com/developers/api/reference/list-messages/) | | GET | `/me/messages/{messageId}` | [Retrieve a message](https://www.bloomtext.com/developers/api/reference/get-message/) | | POST | `/me/conversations/{conversationId}/messages` | [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) | ### Reactions | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/messages/{messageId}/reactions` | [List reactions](https://www.bloomtext.com/developers/api/reference/list-reactions/) | | POST | `/me/messages/{messageId}/reactions` | [Add a reaction](https://www.bloomtext.com/developers/api/reference/create-reaction/) | | DELETE | `/me/messages/{messageId}/reactions` | [Remove a reaction](https://www.bloomtext.com/developers/api/reference/delete-reaction/) | ### Conversations | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/conversations` | [List conversations](https://www.bloomtext.com/developers/api/reference/list-conversations/) | | GET | `/me/conversations/{conversationId}` | [Retrieve a conversation](https://www.bloomtext.com/developers/api/reference/get-conversation/) | ### Participants | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/conversations/{conversationId}/participants` | [List participants](https://www.bloomtext.com/developers/api/reference/list-participants/) | ### Users | Method | Path | Endpoint | | --- | --- | --- | | GET | `/users` | [List users](https://www.bloomtext.com/developers/api/reference/list-users/) | | GET | `/users/{userId}` | [Retrieve a user](https://www.bloomtext.com/developers/api/reference/get-user/) | ### Organizations | Method | Path | Endpoint | | --- | --- | --- | | GET | `/orgs` | [List organizations](https://www.bloomtext.com/developers/api/reference/list-orgs/) | ### Members | Method | Path | Endpoint | | --- | --- | --- | | GET | `/members` | [List members](https://www.bloomtext.com/developers/api/reference/list-members/) | | POST | `/members` | [Add a member](https://www.bloomtext.com/developers/api/reference/create-member/) | | GET | `/members/{memberId}` | [Retrieve a member](https://www.bloomtext.com/developers/api/reference/get-member/) | | PATCH | `/members/{memberId}` | [Update a member](https://www.bloomtext.com/developers/api/reference/update-member/) | | DELETE | `/members/{memberId}` | [Remove a member](https://www.bloomtext.com/developers/api/reference/delete-member/) | ### Teams | Method | Path | Endpoint | | --- | --- | --- | | GET | `/teams` | [List teams](https://www.bloomtext.com/developers/api/reference/list-teams/) | | POST | `/teams/{teamId}/members` | [Add a member to a team](https://www.bloomtext.com/developers/api/reference/add-team-member/) | | DELETE | `/teams/{teamId}/members/{memberId}` | [Remove a member from a team](https://www.bloomtext.com/developers/api/reference/remove-team-member/) | ### Member events | Method | Path | Endpoint | | --- | --- | --- | | GET | `/member-events` | [List member events](https://www.bloomtext.com/developers/api/reference/list-member-events/) | ### Audit events | Method | Path | Endpoint | | --- | --- | --- | | GET | `/audit-events` | [List audit events](https://www.bloomtext.com/developers/api/reference/list-audit-events/) | --- # Patient API endpoints > Every endpoint an API key can call in the BloomText Patient API, grouped by resource, with the scope each one needs. Source: https://www.bloomtext.com/developers/api/reference/patient-api-endpoints/ All 26 Patient API endpoints an [API key](https://www.bloomtext.com/developers/api/api-keys/) can call, grouped by resource. Each links to its full reference page, with parameters, errors, and code samples. ```text filename="Base URL" https://api.bloomtext.com/v1 ``` Send the key as `Authorization: Bearer $BLOOMTEXT_API_KEY`. The scope column is what the key needs; see [Scopes](https://www.bloomtext.com/developers/api/authentication/#scopes). A key that reaches more than one organization names one with `org_id` on every call; see [Organizations a key reaches](https://www.bloomtext.com/developers/api/api-keys/#organizations-a-key-reaches). Anything under `/me` or `/users` needs OAuth, which BloomText turns on per account; an API key gets `403` with `code: oauth_required`. See [OAuth endpoints](https://www.bloomtext.com/developers/api/reference/oauth-endpoints/). An account key also calls the [account endpoints](https://www.bloomtext.com/developers/api/reference/account-endpoints/). ## Organization The organization an API key acts on. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/organization` | [Retrieve the organization](https://www.bloomtext.com/developers/api/reference/get-organization/) | Any | ## Patients Patient records, always found by patient ID, phone number, or MRN. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patients` | [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) | `patients.read` | | POST | `/patients` | [Create a patient](https://www.bloomtext.com/developers/api/reference/create-patient/) | `patients.write` | | GET | `/patients/{patientId}` | [Retrieve a patient](https://www.bloomtext.com/developers/api/reference/get-patient/) | `patients.read` | | PATCH | `/patients/{patientId}` | [Update a patient](https://www.bloomtext.com/developers/api/reference/update-patient/) | `patients.write` | | DELETE | `/patients/{patientId}` | [Delete a patient](https://www.bloomtext.com/developers/api/reference/delete-patient/) | `patients.write` | ## Patient imports Bulk imports of patient records. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | POST | `/patient-imports` | [Import patients](https://www.bloomtext.com/developers/api/reference/create-patient-import/) | `patients.write` | | GET | `/patient-imports/{importId}` | [Retrieve an import](https://www.bloomtext.com/developers/api/reference/get-patient-import/) | `patients.write` | ## Patient messages Messages with patients: send to a patient by ID or phone number, read patient messages by time range, and check delivery. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patient-messages` | [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) | `messages.read` | | POST | `/patient-messages` | [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) | `messages.write` | | POST | `/messages:batch` | [Send messages to patients in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) | `messages.write` | | GET | `/patient-messages/{messageId}` | [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) | `messages.read` | ## Patient conversations Conversations with patients, one per patient and clinic phone number. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patient-conversations` | [List patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) | `messages.read` | | GET | `/patient-conversations/{conversationId}` | [Retrieve a patient conversation](https://www.bloomtext.com/developers/api/reference/get-patient-conversation/) | `messages.read` | ## Phone numbers The clinic phone numbers messages to patients come from, and the team each belongs to. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/phone-numbers` | [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | `messages.read` | ## Campaigns One message sent to many patients from a clinic phone number, with per-patient delivery. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/campaigns` | [List campaigns](https://www.bloomtext.com/developers/api/reference/list-campaigns/) | `messages.read` | | POST | `/campaigns` | [Create a campaign](https://www.bloomtext.com/developers/api/reference/create-campaign/) | `messages.write` | | GET | `/campaigns/{campaignId}` | [Retrieve a campaign](https://www.bloomtext.com/developers/api/reference/get-campaign/) | `messages.read` | | PATCH | `/campaigns/{campaignId}` | [Update a campaign](https://www.bloomtext.com/developers/api/reference/update-campaign/) | `messages.write` | | DELETE | `/campaigns/{campaignId}` | [Delete a campaign](https://www.bloomtext.com/developers/api/reference/delete-campaign/) | `messages.write` | | GET | `/campaigns/{campaignId}/recipients` | [List campaign recipients](https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/) | `messages.read` | | POST | `/campaigns/{campaignId}/recipients` | [Add campaign recipients](https://www.bloomtext.com/developers/api/reference/add-campaign-recipients/) | `messages.write` | | POST | `/campaigns/{campaignId}/recipients/remove` | [Remove campaign recipients](https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/) | `messages.write` | | POST | `/campaigns/{campaignId}/start` | [Start a campaign](https://www.bloomtext.com/developers/api/reference/start-campaign/) | `messages.write` | | POST | `/campaigns/{campaignId}/pause` | [Pause a campaign](https://www.bloomtext.com/developers/api/reference/pause-campaign/) | `messages.write` | | POST | `/campaigns/{campaignId}/stop` | [Stop a campaign](https://www.bloomtext.com/developers/api/reference/stop-campaign/) | `messages.write` | --- # The Organization object > Attributes of a BloomText Organization and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/organization-object/ The organization an API key acts on. ### Attributes - `id` (UUID, required): Stable organization UUID. - `name` (string, required): Organization display name. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/organization` | [Retrieve the organization](https://www.bloomtext.com/developers/api/reference/get-organization/) | ```json filename="The Organization object" { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" } ``` --- # Retrieve the organization > Returns the organization the API key or access token belongs to. Works with any valid credential and scope, so it's a quick way to check a key or token. Source: https://www.bloomtext.com/developers/api/reference/get-organization/ `GET /organization` Returns the organization the API key or access token belongs to. Works with any valid credential and scope, so it's a quick way to check a key or token. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** Any [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Organization object](https://www.bloomtext.com/developers/api/reference/organization-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/organization" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/organization', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/organization", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/organization", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/organization") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" } ``` --- # The Patient object > Attributes of a BloomText Patient and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/patient-object/ Patient records, always found by patient ID, phone number, or MRN. Patient API. ### Attributes - `id` (UUID, required): Unique ID of the patient. - `first_name` (string or null, required): First name. Null for a patient created from an unknown phone number. - `last_name` (string or null, required): Last name. - `date_of_birth` (date or null, required): Date of birth. - `phone` (string or null, required): Mobile number in E.164 format. - `email` (string or null, required): Email address. - `mrn` (string or null, required): The patient's ID in your system, such as an MRN. Up to 36 characters, unique in the organization. - `sms_opted_out` (boolean, required): Whether your organization's numbers can't text the patient, for any reason: true exactly when sms_undeliverable_reasons isn't empty. Secure-link messages by email still work. - `sms_undeliverable_reasons` (array of opted_out, carrier_blocked, admin_blocked, unreachable, required): Why your organization's numbers can't text the patient, most important first: opted_out (the patient replied STOP to one of your numbers, or staff recorded their opt-out; the patient lifts it by texting START), carrier_blocked (the carrier refused a text because the patient replied STOP to that number; they lift it by texting START to one of your numbers), admin_blocked (an admin blocked the number; only an admin can unblock it), unreachable (an earlier text failed because the number is a landline or its carrier can't be reached; it clears when the patient texts one of your numbers, their phone number is changed, or an admin clears it). Each reason blocks every one of your numbers. Empty when the patient can be texted. - `conversation_count` (integer, required): How many conversations the patient has in the organization, on any phone number. - `created_at` (timestamp, required): When the patient was created. - `matched_by` (mrn, phone, email, null): On Create a patient: which field matched an existing patient. Null when the patient was just created. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patients` | [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) | | POST | `/patients` | [Create a patient](https://www.bloomtext.com/developers/api/reference/create-patient/) | | GET | `/patients/{patientId}` | [Retrieve a patient](https://www.bloomtext.com/developers/api/reference/get-patient/) | | PATCH | `/patients/{patientId}` | [Update a patient](https://www.bloomtext.com/developers/api/reference/update-patient/) | | DELETE | `/patients/{patientId}` | [Delete a patient](https://www.bloomtext.com/developers/api/reference/delete-patient/) | ```json filename="The Patient object" { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "first_name": "Jane", "last_name": "Doe", "date_of_birth": "1986-04-12", "phone": "+15125550143", "email": "jane.doe@example.com", "mrn": "MRN-20931", "sms_opted_out": false, "sms_undeliverable_reasons": [], "conversation_count": 2, "created_at": "2026-02-03T17:22:10Z", "matched_by": null } ``` --- # Find patients > Finds the patients with a phone number or MRN. Pass at least one of phone or mrn; there's no way to list the whole directory. A phone number can match several patients, like a shared family phone. Source: https://www.bloomtext.com/developers/api/reference/list-patients/ `GET /patients` Finds the patients with a phone number or MRN. Pass at least one of `phone` or `mrn`; there's no way to list the whole directory. A phone number can match several patients, like a shared family phone. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `phone` (string): A phone number, in any common format. - `mrn` (string): The patient's ID in your system. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Patient object](https://www.bloomtext.com/developers/api/reference/patient-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 400 | `patient_filter_required` | Look patients up by `phone` or `mrn`. Bulk listing isn't available; contact BloomText if you need a sync. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patients?phone=%2B15125550143" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patients?phone=%2B15125550143', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patients?phone=%2B15125550143", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patients?phone=%2B15125550143", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patients?phone=%2B15125550143") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "first_name": "Jane", "last_name": "Doe", "date_of_birth": "1986-04-12", "phone": "+15125550143", "email": "jane.doe@example.com", "mrn": "MRN-20931", "sms_opted_out": false, "sms_undeliverable_reasons": [], "conversation_count": 2, "created_at": "2026-02-03T17:22:10Z", "matched_by": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Create a patient > Creates a patient, or returns the existing one that matches by MRN, then phone, then email. A new patient returns 201; a match returns 200 with matched_by and doesn't change the existing record. Source: https://www.bloomtext.com/developers/api/reference/create-patient/ `POST /patients` Creates a patient, or returns the existing one that matches by MRN, then phone, then email. A new patient returns `201`; a match returns `200` with `matched_by` and doesn't change the existing record. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 Provide a phone number, an email address, or both. - `first_name` (string): First name. - `last_name` (string): Last name. - `date_of_birth` (date): Date of birth. - `phone` (string): Mobile number. Any common format; BloomText stores it as E.164. - `email` (string): Email address. - `mrn` (string): The patient's ID in your system. Matched first. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with the [Patient object](https://www.bloomtext.com/developers/api/reference/patient-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/patients" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patients', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/patients", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/patients", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/patients") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { first_name: "Jane", last_name: "Doe", date_of_birth: "1986-04-12", phone: "(512) 555-0143", mrn: "MRN-20931" }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "first_name": "Jane", "last_name": "Doe", "date_of_birth": "1986-04-12", "phone": "+15125550143", "email": "jane.doe@example.com", "mrn": "MRN-20931", "sms_opted_out": false, "sms_undeliverable_reasons": [], "conversation_count": 2, "created_at": "2026-02-03T17:22:10Z", "matched_by": null } ``` --- # Retrieve a patient > Returns a patient. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/get-patient/ `GET /patients/{patientId}` Returns a patient. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `patientId` (UUID, required): ID of the patient. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Patient object](https://www.bloomtext.com/developers/api/reference/patient-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "first_name": "Jane", "last_name": "Doe", "date_of_birth": "1986-04-12", "phone": "+15125550143", "email": "jane.doe@example.com", "mrn": "MRN-20931", "sms_opted_out": false, "sms_undeliverable_reasons": [], "conversation_count": 2, "created_at": "2026-02-03T17:22:10Z", "matched_by": null } ``` --- # Update a patient > Updates the fields you send and leaves the rest unchanged. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/update-patient/ `PATCH /patients/{patientId}` Updates the fields you send and leaves the rest unchanged. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `patientId` (UUID, required): ID of the patient. ### Query parameters - `org_id` (UUID): 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. ### Body parameters Only the fields you send change. Send null to clear a field. - `first_name` (string): First name. - `last_name` (string): Last name. - `date_of_birth` (date or null): Date of birth. - `phone` (string or null): Mobile number. - `email` (string or null): Email address. - `mrn` (string or null): The patient's ID in your system. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with the [Patient object](https://www.bloomtext.com/developers/api/reference/patient-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X PATCH "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"phone":"+15125550177"}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77', { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({"phone":"+15125550177"}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.patch( "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, json={"phone":"+15125550177"}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" ) func main() { body := bytes.NewBufferString(`{"phone":"+15125550177"}`) req, err := http.NewRequest("PATCH", "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77") request = Net::HTTP::Patch.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Content-Type"] = "application/json" request.body = { phone: "+15125550177" }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "first_name": "Jane", "last_name": "Doe", "date_of_birth": "1986-04-12", "phone": "+15125550177", "email": "jane.doe@example.com", "mrn": "MRN-20931", "sms_opted_out": false, "sms_undeliverable_reasons": [], "conversation_count": 2, "created_at": "2026-02-03T17:22:10Z", "matched_by": null } ``` --- # Delete a patient > Deletes a patient record, as deleting a patient in BloomText does. Their conversations stay in BloomText for your records and for the staff in them. Pending campaign messages to the patient are cancelled. Source: https://www.bloomtext.com/developers/api/reference/delete-patient/ `DELETE /patients/{patientId}` Deletes a patient record, as deleting a patient in BloomText does. Their conversations stay in BloomText for your records and for the staff in them. Pending campaign messages to the patient are cancelled. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `patientId` (UUID, required): ID of the patient. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `204 No Content` with an empty body. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) ``` ```python filename="Request" import os import requests response = requests.delete( "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("DELETE", "https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patients/5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77") request = Net::HTTP::Delete.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code ``` ```text filename="Response" HTTP/1.1 204 No Content ``` --- # The Patient import object > Attributes of a BloomText Patient import and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/patient-import-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=patient-imports) Bulk imports of patient records. Patient API. ### Attributes - `id` (string, required): Unique ID of the import. - `status` (running, completed, failed, required): Progress of the import. - `rows` (integer, required): Rows received. - `created` (integer, required): Rows that created a new patient. - `matched` (integer, required): Rows that matched an existing patient. - `failed` (integer, required): Rows that couldn't be imported. - `results` (array of PatientImportRow or null): One result per row, once the import finishes. Null while it's running. Child attributes: - `row` (integer, required): Row number, starting at 1. - `outcome` (created, matched, failed, required): What happened to the row. - `matched_by` (mrn, phone, email, null): Which field matched, for `matched` rows. - `patient_id` (UUID or null): The created or matched patient. - `error` (string or null): Why the row failed, like `phone_or_email_required`. - `created_at` (timestamp, required): When the import started. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | POST | `/patient-imports` | [Import patients](https://www.bloomtext.com/developers/api/reference/create-patient-import/) | | GET | `/patient-imports/{importId}` | [Retrieve an import](https://www.bloomtext.com/developers/api/reference/get-patient-import/) | ```json filename="The Patient import object" { "id": "imp_71c2", "status": "running", "rows": 2, "created": 0, "matched": 0, "failed": 0, "results": null, "created_at": "2026-09-21T15:04:05Z" } ``` --- # Import patients > Starts importing up to 10,000 patients in the background. Send JSON, or CSV with Content-Type text/csv and the columns first_name, last_name, dob, mrn, phone, email. Each row is matched like Create a patient. Source: https://www.bloomtext.com/developers/api/reference/create-patient-import/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=patient-imports) `POST /patient-imports` Starts importing up to 10,000 patients in the background. Send JSON, or CSV with `Content-Type text/csv` and the columns first_name, last_name, dob, mrn, phone, email. Each row is matched like Create a patient. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 Patients to import. To send CSV instead, use `Content-Type: text/csv`. - `patients` (array of PatientCreate, required): Up to 10,000 patients. Child attributes: - `first_name` (string): First name. - `last_name` (string): Last name. - `date_of_birth` (date): Date of birth. - `phone` (string): Mobile number. Any common format; BloomText stores it as E.164. - `email` (string): Email address. - `mrn` (string): The patient's ID in your system. Matched first. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `202 Accepted` with the [Patient import object](https://www.bloomtext.com/developers/api/reference/patient-import-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/patient-imports" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"patients":[{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"},{"first_name":"John","last_name":"Doe","phone":"512-555-0188","mrn":"MRN-20932"}]}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-imports', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"patients":[{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"},{"first_name":"John","last_name":"Doe","phone":"512-555-0188","mrn":"MRN-20932"}]}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/patient-imports", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"patients":[{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"},{"first_name":"John","last_name":"Doe","phone":"512-555-0188","mrn":"MRN-20932"}]}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"patients":[{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"},{"first_name":"John","last_name":"Doe","phone":"512-555-0188","mrn":"MRN-20932"}]}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/patient-imports", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/patient-imports") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { patients: [{"first_name":"Jane","last_name":"Doe","date_of_birth":"1986-04-12","phone":"(512) 555-0143","mrn":"MRN-20931"},{"first_name":"John","last_name":"Doe","phone":"512-555-0188","mrn":"MRN-20932"}] }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 202 Accepted" { "id": "imp_71c2", "status": "running", "rows": 2, "created": 0, "matched": 0, "failed": 0, "results": null, "created_at": "2026-09-21T15:04:05Z" } ``` --- # Retrieve an import > Returns an import's progress and, once it finishes, the outcome of every row. Source: https://www.bloomtext.com/developers/api/reference/get-patient-import/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=patient-imports) `GET /patient-imports/{importId}` Returns an import's progress and, once it finishes, the outcome of every row. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `patients.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `importId` (string, required): ID of the import. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Patient import object](https://www.bloomtext.com/developers/api/reference/patient-import-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patient-imports/imp_71c2" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-imports/imp_71c2', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patient-imports/imp_71c2", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patient-imports/imp_71c2", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patient-imports/imp_71c2") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "imp_71c2", "status": "running", "rows": 2, "created": 0, "matched": 0, "failed": 0, "results": null, "created_at": "2026-09-21T15:04:05Z" } ``` --- # The Message object > Attributes of a BloomText Message and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/message-object/ Messages with patients: send to a patient by ID or phone number, read patient messages by time range, and check delivery. Patient API. ### Attributes - `id` (UUID, required): Unique ID of the message. - `conversation` (ConversationRef, required): The conversation a message belongs to. Child attributes: - `id` (UUID, required): ID of the conversation. - `title` (string, required): The conversation's name as the user sees it. - `sender` (Sender, required): Who sent a message. Child attributes: - `id` (UUID, required): ID of the sender. - `name` (string, required): The sender's display name. - `kind` (staff, patient, api_key, api_identity, required): A staff member, a patient, an API key (`name` is the key's name, like "Reminder service"), or an API identity (the automated sender the key belongs to, like "Appointment reminders"; not a staff member). - `patient` (PatientRef or null, required): The patient in the conversation, for patient conversations. Null otherwise. Child attributes: - `id` (UUID, required): ID of the patient. - `name` (string, required): The patient's name, or their phone number if they have no name yet. - `channel` (app, secure, sms, required): How the message traveled: inside BloomText (`app`), by secure link, or by plain SMS. - `phone_number` (PhoneNumberRef or null): The clinic phone number, for SMS messages. Null otherwise. Child attributes: - `number` (string, required): The phone number. - `team` (string, required): The team it belongs to. - `delivery` (Delivery or null): Delivery status, for messages sent to a patient. Null otherwise. Child attributes: - `status` (queued, sent, delivered, failed, undelivered, rejected, consent_requested, required): Where the message is: `queued` (accepted, not yet with the carrier), `sent` (with the carrier, or a secure message sent), `delivered` (the carrier confirmed it), `failed` or `undelivered` (it didn't reach the patient), `rejected` (BloomText didn't send it, because the patient opted out, the carrier blocks texts to them, an admin blocked the number, the number can't receive texts, the organization requires consent and the patient hasn't given it, or the text waited for consent and wasn't sent), or `consent_requested` (the organization requires consent before texting: BloomText asked the patient, and the message goes when they reply YES). For a message to several patients, the worst of theirs: `failed` if any failed, `delivered` only when all were. - `error_code` (string or null): Why it wasn't delivered: the carrier's code, like `30005`, or BloomText's reason: `patient_opted_out`, `carrier_blocked`, `number_blocked`, `number_unreachable`, `consent_required` (the organization requires consent and the patient hasn't given it) or `consent_not_sent` (the text waited for consent and wasn't sent). Null otherwise. - `detail` (string or null): What `error_code` means, in plain English. Null when there's no error. - `updated_at` (timestamp, required): When the status last changed. Carrier reports arrive within minutes. - `recipients` (array of object): For a message to several patients (a group conversation), each one's delivery. Absent for one patient. - `campaign_id` (UUID or null): The campaign that sent this message. Null otherwise. - `created_at` (timestamp, required): When the message was sent. - `edited_at` (timestamp or null): When the message was last edited. Null if it never was. - `type` (text, file, required): Whether the message carries text or a file. - `body` (string or null): Message text. Null for file messages. - `file` (FileReference or null): File metadata. Null for text messages. Child attributes: - `id` (UUID, required): Unique ID of the file. - `name` (string, required): Original file name. - `mime` (string or null): MIME type, such as `application/pdf`. - `size_bytes` (integer or null): File size in bytes. - `reply_to_message_id` (UUID or null): Message this is a reply to. Null for top-level messages. - `unread` (boolean, required): Always false with an API key, which has no read state. With OAuth, whether the connected person hasn't read it. - `sent_via` (App or null): Null for messages sent in BloomText or with an API key. With OAuth, the app that sent it for the connected person; staff see this, patients don't. Child attributes: - `client_id` (string, required): Your app's OAuth client ID. - `name` (string, required): Your app's name as users and staff see it. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patient-messages` | [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) | | POST | `/patient-messages` | [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) | | POST | `/messages:batch` | [Send messages to patients in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) | | GET | `/patient-messages/{messageId}` | [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) | | GET | `/me/messages` | [List messages](https://www.bloomtext.com/developers/api/reference/list-messages/) | | GET | `/me/messages/{messageId}` | [Retrieve a message](https://www.bloomtext.com/developers/api/reference/get-message/) | | POST | `/me/conversations/{conversationId}/messages` | [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) | ```json filename="The Message object" { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": null, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi, can I move my Thursday appointment to Friday morning?", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null } ``` --- # List patient messages > Lists messages in patient conversations in a time range, newest first, with a cursor. group_by=message (the default) returns them one by one; group_by=conversation returns every message in the range from one conversation before moving to the next. Narrow to one patient or conversation, or search with q. Messages include everyone's in each conversation: the patient, staff, and API keys. With an API key, pass after, patient_id, or conversation_id. Source: https://www.bloomtext.com/developers/api/reference/list-patient-messages/ `GET /patient-messages` Lists messages in patient conversations in a time range, newest first, with a cursor. `group_by=message` (the default) returns them one by one; `group_by=conversation` returns every message in the range from one conversation before moving to the next. Narrow to one patient or conversation, or search with `q`. Messages include everyone's in each conversation: the patient, staff, and API keys. With an API key, pass `after`, `patient_id`, or `conversation_id`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `after` (string): Only messages sent at or after this time. An RFC 3339 timestamp, or a date for midnight in the organization's time zone. - `before` (string): Only messages sent before this time. Same format as `after`. - `group_by` (message, conversation): `message` (the default) lists messages one by one across conversations. `conversation` lists every message in the range from one conversation, then the next. - `order` (desc, asc): `desc` for newest first (the default) or `asc` for oldest first. With `group_by=conversation`, it orders the conversations by their latest message and the messages within each. - `patient_id` (UUID): Only conversations with this patient, on any phone number. - `conversation_id` (UUID): Only messages in this conversation. - `q` (string): Words and operators to search for, like `refill from:patient is:failed`. Supports free text, `"exact phrases"`, `from:`, `patient:`, `mrn:`, `phone:`, `is:failed`, `-` to negate, and `OR`; with OAuth, also `is:unread`. Use `after` and `before` for time ranges. See Search. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Message object](https://www.bloomtext.com/developers/api/reference/message-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `invalid_query` | The `q` query can’t be parsed. See [Search](https://www.bloomtext.com/developers/api/search/). | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 400 | `range_required` | An API key must pass `after`, `patient_id`, or `conversation_id`, so every read is bounded. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patient-messages?after=2026-09-21T00:00:00Z&q=from:patient" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-messages?after=2026-09-21T00:00:00Z&q=from:patient', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patient-messages?after=2026-09-21T00:00:00Z&q=from:patient", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patient-messages?after=2026-09-21T00:00:00Z&q=from:patient", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patient-messages?after=2026-09-21T00:00:00Z&q=from:patient") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": null, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi, can I move my Thursday appointment to Friday morning?", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Send a message to a patient > Sends a message to a patient by patient_id or phone number, from one of the organization's numbers: from, else the key's default number, else the organization's only number. An organization with several numbers and no default answers 422 from_required. The message goes in that number's team's conversation with the patient, and comes from the API identity the key belongs to (an automated sender on the account, never a staff member); until identities are on for the account, it shows the key's name with an API marker. BloomText finds the patient (or creates one for a new phone number), finds or starts the conversation, and sends. Messages go by secure link unless channel is sms. Source: https://www.bloomtext.com/developers/api/reference/send-message/ `POST /patient-messages` Sends a message to a patient by `patient_id` or phone number, from one of the organization's numbers: `from`, else the key's default number, else the organization's only number. An organization with several numbers and no default answers 422 `from_required`. The message goes in that number's team's conversation with the patient, and comes from the API identity the key belongs to (an automated sender on the account, never a staff member); until identities are on for the account, it shows the key's name with an API marker. BloomText finds the patient (or creates one for a new phone number), finds or starts the conversation, and sends. Messages go by secure link unless `channel` is `sms`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 A message to a patient. - `to` (Recipient, required): Who to message. Provide exactly one of patient_id or phone. Child attributes: - `patient_id` (UUID): The patient to message. - `phone` (string): A mobile number. BloomText finds the patient with this number, or creates one. - `patient` (PatientDetails): Details for a patient BloomText creates while sending. Ignored when the phone number matches an existing patient. Child attributes: - `first_name` (string): First name. - `last_name` (string): Last name. - `date_of_birth` (date): Date of birth. - `email` (string): Email address. - `mrn` (string): The patient's ID in your system. - `body` (string, required): Message text: up to 1,600 characters for `sms`, or 40,000 for `secure`. A longer one returns `422 too_long`. - `channel` (secure, sms, required): 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. - `from` (string): 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](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the sent [Message object](https://www.bloomtext.com/developers/api/reference/message-object/) in `message`, plus `patient_created` and `conversation_created` to say whether BloomText created either one. Returns `202 Accepted` with the same body when the message waits for the patient's consent to texting, with `delivery.status` `consent_requested`. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `plan_required` | The organization's plan doesn't include patient messaging. | | 404 | `not_found` | The `patient_id` doesn't exist in the organization, or `from` isn't one of its phone numbers. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `ambiguous_recipient` | The phone number belongs to more than one patient. `candidates` lists them; send again with a `patient_id`, or add `patient.mrn`. | | 409 | `recipient_mismatch` | `patient.mrn` belongs to a patient with a different phone number, or the number's only patient has a different MRN. Nothing is sent. `candidates` lists that patient; update their phone, or send with their `patient_id`. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 422 | `from_required` | The organization has several phone numbers and no default. `detail` and `numbers` list them; set `from` to one. | | 422 | `channel_required` | `channel` is missing. Set it to `sms` or `secure`; there's no default. | | 422 | `too_long` | The body is over `max` characters (1,600 for `sms`, 40,000 for `secure`). `length` and `max` say by how much. | | 422 | `patient_has_no_phone` | An `sms` send to a patient with no phone number. | | 422 | `no_contact_method` | A `secure` send to a patient with neither phone nor email. | | 422 | `patient_opted_out` | The patient opted out: they replied STOP to one of the organization's numbers, or staff recorded their opt-out. No number can text them until they reply START. `number` and `since` say which number the text would have come from and since when. | | 422 | `carrier_blocked` | The carrier refused an earlier text to the patient because they replied STOP to that number, so the organization's numbers don't text them until they text START to one of them. `number` and `since` as above. | | 422 | `number_blocked` | An admin in your organization blocked the patient's number. Only an admin can unblock it, in the app. `number` and `since` as above. | | 422 | `number_unreachable` | An earlier text failed because the patient's number can't receive texts: it's a landline, or its carrier couldn't be reached. It clears when the patient texts one of the organization's numbers, when their phone number is changed, or when an admin clears it in the app. `number` and `since` as above. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/patient-messages" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"to":{"patient_id":"5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"},"body":"Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.","channel":"secure"}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-messages', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"to":{"patient_id":"5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"},"body":"Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.","channel":"secure"}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/patient-messages", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"to":{"patient_id":"5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"},"body":"Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.","channel":"secure"}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"to":{"patient_id":"5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"},"body":"Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.","channel":"secure"}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/patient-messages", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/patient-messages") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { to: {"patient_id":"5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77"}, body: "Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.", channel: "secure" }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "message": { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "secure", "phone_number": null, "delivery": { "status": "queued", "error": null, "updated_at": "2026-09-21T15:04:05Z" }, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi Jane, Dr. Example moved your appointment to Friday at 9:00. Reply here with any questions.", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null }, "patient_created": false, "conversation_created": false } ``` --- # Send messages to patients in a 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. Source: https://www.bloomtext.com/developers/api/reference/send-message-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](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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. - `messages` (array of MessageSend, required): Up to 60 messages, each the body of a single send. Child attributes: - `to` (Recipient, required): Who to message. Provide exactly one of patient_id or phone. Child attributes: - `patient_id` (UUID): The patient to message. - `phone` (string): A mobile number. BloomText finds the patient with this number, or creates one. - `patient` (PatientDetails): Details for a patient BloomText creates while sending. Ignored when the phone number matches an existing patient. - `body` (string, required): Message text: up to 1,600 characters for `sms`, or 40,000 for `secure`. A longer one returns `422 too_long`. - `channel` (secure, sms, required): 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. - `from` (string): 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](https://www.bloomtext.com/developers/api/errors/#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](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `plan_required` | The organization's plan doesn't include patient messaging. The whole batch is refused and nothing is sent. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | `messages` is empty or holds more than 60 messages. Errors in individual messages come back in their results instead. | | 422 | `unknown_field` | A message has a field the API doesn't take. The whole batch is refused, naming the message (`/messages/3/...`), and nothing is sent. | | 429 | `rate_limited` | The 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`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/messages:batch" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/messages:batch', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/messages:batch", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/messages:batch", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/messages:batch") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 207 undefined" { "results": [ { "index": 0, "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "status": "queued", "error": { "type": "string", "title": "string", "status": 400, "code": "string", "detail": "string", "request_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "field_errors": [ { "path": "string", "code": "string", "message": "string" } ], "candidates": [ { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" } ], "numbers": [ { "number": "+15125550100", "team": "Front desk" } ], "number": "string", "since": "2026-09-21T15:04:05Z", "length": 0, "max": 0, "reason": "would_delete_user" } } ] } ``` --- # Retrieve a patient message > Returns one message in a patient conversation, with its delivery status. Use it to check whether a text reached the patient. Source: https://www.bloomtext.com/developers/api/reference/get-patient-message/ `GET /patient-messages/{messageId}` Returns one message in a patient conversation, with its delivery status. Use it to check whether a text reached the patient. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `messageId` (UUID, required): ID of the message. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Message object](https://www.bloomtext.com/developers/api/reference/message-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patient-messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": null, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi, can I move my Thursday appointment to Friday morning?", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null } ``` --- # The Conversation object > Attributes of a BloomText Conversation and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/conversation-object/ Conversations with patients, one per patient and clinic phone number. Patient API. ### Attributes - `id` (UUID, required): Unique ID of the conversation. - `organization_id` (UUID, required): Organization the conversation belongs to. - `type` (patient, direct, group, broadcast, required): A conversation with a patient, or a staff direct message, group, or broadcast. API keys see only `patient`. - `title` (string, required): The conversation's name as the user sees it in BloomText. - `patient` (PatientRef or null): The patient, for patient conversations. Null otherwise. Child attributes: - `id` (UUID, required): ID of the patient. - `name` (string, required): The patient's name, or their phone number if they have no name yet. - `phone_number` (PhoneNumberRef or null): The clinic phone number, for patient conversations by SMS. Null otherwise. Child attributes: - `number` (string, required): The phone number. - `team` (string, required): The team it belongs to. - `channel` (secure, sms, null): How the patient receives messages, for patient conversations. Null otherwise. - `created_at` (timestamp, required): When the conversation was created. - `last_message_at` (timestamp or null, required): When the latest message was sent. Null for a conversation with no messages. - `unread_count` (integer, required): Always 0 with an API key, which has no read state. With OAuth, messages the person hasn't read. - `seen_at` (timestamp or null, required): Always null with an API key. With OAuth, when the person last read the conversation. - `messages_in_range` (integer or null): On List conversations with `after` or `before`: how many of its messages fell in the range. Null otherwise. - `latest_message` (Message or null): On List conversations: the conversation's latest message in the range. Null otherwise. Child attributes: - `id` (UUID, required): Unique ID of the message. - `conversation` (ConversationRef, required): The conversation a message belongs to. Child attributes: - `id` (UUID, required): ID of the conversation. - `title` (string, required): The conversation's name as the user sees it. - `sender` (Sender, required): Who sent a message. Child attributes: - `id` (UUID, required): ID of the sender. - `name` (string, required): The sender's display name. - `kind` (staff, patient, api_key, api_identity, required): A staff member, a patient, an API key (`name` is the key's name, like "Reminder service"), or an API identity (the automated sender the key belongs to, like "Appointment reminders"; not a staff member). - `patient` (PatientRef or null, required): The patient in the conversation, for patient conversations. Null otherwise. Child attributes: - `id` (UUID, required): ID of the patient. - `name` (string, required): The patient's name, or their phone number if they have no name yet. - `channel` (app, secure, sms, required): How the message traveled: inside BloomText (`app`), by secure link, or by plain SMS. - `phone_number` (PhoneNumberRef or null): The clinic phone number, for SMS messages. Null otherwise. Child attributes: - `number` (string, required): The phone number. - `team` (string, required): The team it belongs to. - `delivery` (Delivery or null): Delivery status, for messages sent to a patient. Null otherwise. Child attributes: - `status` (queued, sent, delivered, failed, undelivered, rejected, consent_requested, required): Where the message is: `queued` (accepted, not yet with the carrier), `sent` (with the carrier, or a secure message sent), `delivered` (the carrier confirmed it), `failed` or `undelivered` (it didn't reach the patient), `rejected` (BloomText didn't send it, because the patient opted out, the carrier blocks texts to them, an admin blocked the number, the number can't receive texts, the organization requires consent and the patient hasn't given it, or the text waited for consent and wasn't sent), or `consent_requested` (the organization requires consent before texting: BloomText asked the patient, and the message goes when they reply YES). For a message to several patients, the worst of theirs: `failed` if any failed, `delivered` only when all were. - `error_code` (string or null): Why it wasn't delivered: the carrier's code, like `30005`, or BloomText's reason: `patient_opted_out`, `carrier_blocked`, `number_blocked`, `number_unreachable`, `consent_required` (the organization requires consent and the patient hasn't given it) or `consent_not_sent` (the text waited for consent and wasn't sent). Null otherwise. - `detail` (string or null): What `error_code` means, in plain English. Null when there's no error. - `updated_at` (timestamp, required): When the status last changed. Carrier reports arrive within minutes. - `recipients` (array of object): For a message to several patients (a group conversation), each one's delivery. Absent for one patient. - `campaign_id` (UUID or null): The campaign that sent this message. Null otherwise. - `created_at` (timestamp, required): When the message was sent. - `edited_at` (timestamp or null): When the message was last edited. Null if it never was. - `type` (text, file, required): Whether the message carries text or a file. - `body` (string or null): Message text. Null for file messages. - `file` (FileReference or null): File metadata. Null for text messages. Child attributes: - `id` (UUID, required): Unique ID of the file. - `name` (string, required): Original file name. - `mime` (string or null): MIME type, such as `application/pdf`. - `size_bytes` (integer or null): File size in bytes. - `reply_to_message_id` (UUID or null): Message this is a reply to. Null for top-level messages. - `unread` (boolean, required): Always false with an API key, which has no read state. With OAuth, whether the connected person hasn't read it. - `sent_via` (App or null): Null for messages sent in BloomText or with an API key. With OAuth, the app that sent it for the connected person; staff see this, patients don't. Child attributes: - `client_id` (string, required): Your app's OAuth client ID. - `name` (string, required): Your app's name as users and staff see it. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/patient-conversations` | [List patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) | | GET | `/patient-conversations/{conversationId}` | [Retrieve a patient conversation](https://www.bloomtext.com/developers/api/reference/get-patient-conversation/) | | GET | `/me/conversations` | [List conversations](https://www.bloomtext.com/developers/api/reference/list-conversations/) | | GET | `/me/conversations/{conversationId}` | [Retrieve a conversation](https://www.bloomtext.com/developers/api/reference/get-conversation/) | ```json filename="The Conversation object" { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "organization_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "type": "patient", "title": "Jane Doe", "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "phone_number": { "number": "+15125550100", "team": "Front desk" }, "channel": "sms", "created_at": "2026-09-21T15:04:05Z", "last_message_at": "2026-09-21T15:04:05Z", "unread_count": 0, "seen_at": null, "messages_in_range": null, "latest_message": null } ``` --- # List patient conversations > Lists patient conversations with messages in a time range, most recently active first, each with its latest message and how many messages fell in the range. Filter to one patient with patient_id. Every request passes after or patient_id, so a read is always bounded; there's no search by patient name. Source: https://www.bloomtext.com/developers/api/reference/list-patient-conversations/ `GET /patient-conversations` Lists patient conversations with messages in a time range, most recently active first, each with its latest message and how many messages fell in the range. Filter to one patient with `patient_id`. Every request passes `after` or `patient_id`, so a read is always bounded; there's no search by patient name. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `after` (string): Only messages sent at or after this time. An RFC 3339 timestamp, or a date for midnight in the organization's time zone. - `before` (string): Only messages sent before this time. Same format as `after`. - `patient_id` (UUID): Only conversations with this patient, on any phone number. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Conversation object](https://www.bloomtext.com/developers/api/reference/conversation-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 400 | `range_required` | Pass `after` or `patient_id`, so every read is bounded. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patient-conversations?after=2026-09-21T00:00:00Z" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-conversations?after=2026-09-21T00:00:00Z', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patient-conversations?after=2026-09-21T00:00:00Z", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patient-conversations?after=2026-09-21T00:00:00Z", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patient-conversations?after=2026-09-21T00:00:00Z") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "organization_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "type": "patient", "title": "Jane Doe", "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "phone_number": { "number": "+15125550100", "team": "Front desk" }, "channel": "sms", "created_at": "2026-09-21T15:04:05Z", "last_message_at": "2026-09-21T15:04:05Z", "unread_count": 0, "seen_at": null, "messages_in_range": null, "latest_message": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Retrieve a patient conversation > Returns a patient conversation: the patient, its phone number, and its channel. Source: https://www.bloomtext.com/developers/api/reference/get-patient-conversation/ `GET /patient-conversations/{conversationId}` Returns a patient conversation: the patient, its phone number, and its channel. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `conversationId` (UUID, required): ID of the conversation. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Conversation object](https://www.bloomtext.com/developers/api/reference/conversation-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/patient-conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/patient-conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/patient-conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/patient-conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/patient-conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "organization_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "type": "patient", "title": "Jane Doe", "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "phone_number": { "number": "+15125550100", "team": "Front desk" }, "channel": "sms", "created_at": "2026-09-21T15:04:05Z", "last_message_at": "2026-09-21T15:04:05Z", "unread_count": 0, "seen_at": null, "messages_in_range": null, "latest_message": null } ``` --- # The Phone number object > Attributes of a BloomText Phone number and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/phone-number-object/ The clinic phone numbers messages to patients come from, and the team each belongs to. ### Attributes - `number` (string, required): The phone number in E.164 format, like +15125550100. Pass it as `from` when sending. - `team` (string, required): The team the number belongs to, like "Front desk". Patient replies go to this team's conversation. - `is_default` (boolean, required): Whether sends use this number when they don't pass `from`. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/phone-numbers` | [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | ```json filename="The Phone number object" { "number": "+15125550100", "team": "Front desk", "is_default": true } ``` --- # List phone numbers > Lists the clinic phone numbers messages to patients can come from, each with the team it belongs to: every number in the organization. is_default marks the number a send uses when it leaves out from: the key's default number, or the organization's only number. Source: https://www.bloomtext.com/developers/api/reference/list-phone-numbers/ `GET /phone-numbers` Lists the clinic phone numbers messages to patients can come from, each with the team it belongs to: every number in the organization. `is_default` marks the number a send uses when it leaves out `from`: the key's default number, or the organization's only number. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with a `data` array of [Phone number object](https://www.bloomtext.com/developers/api/reference/phone-number-object/)s. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/phone-numbers" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/phone-numbers', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/phone-numbers", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/phone-numbers", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/phone-numbers") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "number": "+15125550100", "team": "Front desk", "is_default": true } ] } ``` --- # The Campaign object > Attributes of a BloomText Campaign and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/campaign-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) One message sent to many patients from a clinic phone number, with per-patient delivery. ### Attributes - `id` (UUID, required): Unique ID of the campaign. - `name` (string, required): A name for staff, like "Flu shot reminders, October". Patients never see it. - `status` (draft, running, paused, completed, stopped, required): `draft` until started; `completed` once every recipient is sent; `stopped` if someone stopped it early. - `channel` (secure, sms, required): How recipients receive the message. Secure unless the campaign asks for SMS. - `body` (string, required): The message every recipient gets. - `phone_number` (PhoneNumberRef, required): The clinic phone number a patient conversation is on. Child attributes: - `number` (string, required): The phone number. - `team` (string, required): The team it belongs to. - `sender` (CampaignSender, required): Who the campaign's messages come from. Child attributes: - `id` (UUID, required): ID of the admin or API key. - `name` (string, required): The API identity's name, like "Appointment reminders", or, until identities are on for the account, the API key's name. - `kind` (api_key, api_identity, required): `api_identity` when the key belongs to an API identity (an automated sender, not a person or a seat), else `api_key`. - `send_interval_seconds` (number, required): Seconds between messages. - `counts` (CampaignCounts, required): Progress across the campaign's recipients. Child attributes: - `recipients` (integer, required): Patients on the campaign. - `pending` (integer, required): Waiting to be sent. - `sent` (integer, required): Sent, including delivered. - `delivered` (integer, required): Confirmed delivered or opened. - `failed` (integer, required): Failed or undelivered. - `skipped` (integer, required): Not sent: opted out, no contact method, or cancelled. - `archived` (boolean, required): Whether the campaign is archived. - `created_at` (timestamp, required): When the campaign was created. - `started_at` (timestamp or null, required): When it first started. Null for a draft. - `finished_at` (timestamp or null, required): When it completed or was stopped. Null otherwise. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/campaigns` | [List campaigns](https://www.bloomtext.com/developers/api/reference/list-campaigns/) | | POST | `/campaigns` | [Create a campaign](https://www.bloomtext.com/developers/api/reference/create-campaign/) | | GET | `/campaigns/{campaignId}` | [Retrieve a campaign](https://www.bloomtext.com/developers/api/reference/get-campaign/) | | PATCH | `/campaigns/{campaignId}` | [Update a campaign](https://www.bloomtext.com/developers/api/reference/update-campaign/) | | DELETE | `/campaigns/{campaignId}` | [Delete a campaign](https://www.bloomtext.com/developers/api/reference/delete-campaign/) | | GET | `/campaigns/{campaignId}/recipients` | [List campaign recipients](https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/) | | POST | `/campaigns/{campaignId}/recipients` | [Add campaign recipients](https://www.bloomtext.com/developers/api/reference/add-campaign-recipients/) | | POST | `/campaigns/{campaignId}/recipients/remove` | [Remove campaign recipients](https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/) | | POST | `/campaigns/{campaignId}/start` | [Start a campaign](https://www.bloomtext.com/developers/api/reference/start-campaign/) | | POST | `/campaigns/{campaignId}/pause` | [Pause a campaign](https://www.bloomtext.com/developers/api/reference/pause-campaign/) | | POST | `/campaigns/{campaignId}/stop` | [Stop a campaign](https://www.bloomtext.com/developers/api/reference/stop-campaign/) | ```json filename="The Campaign object" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "draft", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 0, "pending": 0, "sent": 0, "delivered": 0, "failed": 0, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": null, "finished_at": null } ``` --- # List campaigns > Lists the organization's campaigns, newest first. Archived campaigns are left out unless archived=true. Source: https://www.bloomtext.com/developers/api/reference/list-campaigns/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `GET /campaigns` Lists the organization's campaigns, newest first. Archived campaigns are left out unless `archived=true`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `status` (draft, running, paused, completed, stopped): Only campaigns with this status. - `archived` (boolean): List archived campaigns instead of active ones. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/campaigns" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/campaigns", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/campaigns", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/campaigns") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "draft", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 0, "pending": 0, "sent": 0, "delivered": 0, "failed": 0, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": null, "finished_at": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Create a campaign > Creates a draft campaign. Add recipients, then start it. Every recipient gets the same message, from the phone number you choose. It's sent from the API identity the key belongs to; until identities are on for the account, it shows the key's name. Source: https://www.bloomtext.com/developers/api/reference/create-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns` Creates a draft campaign. Add recipients, then start it. Every recipient gets the same message, from the phone number you choose. It's sent from the API identity the key belongs to; until identities are on for the account, it shows the key's name. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 - `name` (string, required): A name for staff. - `body` (string, required): The message, up to 1,600 characters. Every recipient gets the same text. - `channel` (secure, sms): `secure` (the default) or `sms`, as in Send a message to a patient. - `from` (string): 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. - `send_interval_seconds` (number): Seconds between messages. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 422 | `from_required` | There are several phone numbers and no default. Pass `from`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"name":"Flu shot reminders, October","body":"Flu shots are available at Northside Clinic. Reply here to book a time."}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"name":"Flu shot reminders, October","body":"Flu shots are available at Northside Clinic. Reply here to book a time."}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"name":"Flu shot reminders, October","body":"Flu shots are available at Northside Clinic. Reply here to book a time."}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"name":"Flu shot reminders, October","body":"Flu shots are available at Northside Clinic. Reply here to book a time."}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { name: "Flu shot reminders, October", body: "Flu shots are available at Northside Clinic. Reply here to book a time." }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "draft", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 0, "pending": 0, "sent": 0, "delivered": 0, "failed": 0, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": null, "finished_at": null } ``` --- # Retrieve a campaign > Returns a campaign with its progress counts. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/get-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `GET /campaigns/{campaignId}` Returns a campaign with its progress counts. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "draft", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 0, "pending": 0, "sent": 0, "delivered": 0, "failed": 0, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": null, "finished_at": null } ``` --- # Update a campaign > Changes a campaign's name, message, channel, phone number, or pace while it's a draft or paused, and archives or unarchives it when it isn't running. Source: https://www.bloomtext.com/developers/api/reference/update-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `PATCH /campaigns/{campaignId}` Changes a campaign's name, message, channel, phone number, or pace while it's a draft or paused, and archives or unarchives it when it isn't running. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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. ### Body parameters Only the fields you send change. - `name` (string): A name for staff. - `body` (string): The message. Draft or paused campaigns only. - `channel` (secure, sms): `secure` or `sms`. Draft or paused campaigns only. - `from` (string): The phone number to send from. Draft campaigns only. - `send_interval_seconds` (number): Seconds between messages. - `archived` (boolean): Archive or unarchive the campaign. Not while it's running. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `campaign_not_editable` | The campaign is running, completed, or stopped. Pause it to change the message; archive it only when it isn't running. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X PATCH "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"send_interval_seconds":2}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65', { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({"send_interval_seconds":2}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.patch( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, json={"send_interval_seconds":2}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" ) func main() { body := bytes.NewBufferString(`{"send_interval_seconds":2}`) req, err := http.NewRequest("PATCH", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65") request = Net::HTTP::Patch.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Content-Type"] = "application/json" request.body = { send_interval_seconds: 2 }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "draft", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 2, "counts": { "recipients": 0, "pending": 0, "sent": 0, "delivered": 0, "failed": 0, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": null, "finished_at": null } ``` --- # Delete a campaign > Deletes a draft campaign. A campaign that has started can't be deleted, because its messages are in patients' conversations; archive it instead. Source: https://www.bloomtext.com/developers/api/reference/delete-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `DELETE /campaigns/{campaignId}` Deletes a draft campaign. A campaign that has started can't be deleted, because its messages are in patients' conversations; archive it instead. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `204 No Content` with an empty body. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `campaign_not_deletable` | The campaign has started. Archive it with Update a campaign instead. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) ``` ```python filename="Request" import os import requests response = requests.delete( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("DELETE", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65") request = Net::HTTP::Delete.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code ``` ```text filename="Response" HTTP/1.1 204 No Content ``` --- # List campaign recipients > Lists a campaign's recipients in the order they're sent, each with its delivery status. Source: https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `GET /campaigns/{campaignId}/recipients` Lists a campaign's recipients in the order they're sent, each with its delivery status. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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. - `status` (pending, sending, sent, delivered, opened, failed, undelivered, skipped, cancelled): Only recipients with this status. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of recipients, each with its `patient`, delivery `status`, `message_id` once sent, and `error`, plus a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "status": "delivered", "message_id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "error": null, "updated_at": "2026-09-21T15:04:07Z" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Add campaign recipients > Adds up to 10,000 patients to a campaign that isn't completed or stopped. Unknown patient IDs, and patients already on the campaign, are skipped and listed in skipped. Recipients added to a running campaign are sent after the ones already waiting. Source: https://www.bloomtext.com/developers/api/reference/add-campaign-recipients/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns/{campaignId}/recipients` Adds up to 10,000 patients to a campaign that isn't completed or stopped. Unknown patient IDs, and patients already on the campaign, are skipped and listed in `skipped`. Recipients added to a running campaign are sent after the ones already waiting. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 - `patient_ids` (array of UUID, required): Up to 10,000 patient IDs. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with `changed`, the number of patients added, and `skipped`, each patient left unchanged with its `reason`. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `campaign_not_editable` | The campaign is completed or stopped. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { patient_ids: ["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"] }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "changed": 2, "skipped": [] } ``` --- # Remove campaign recipients > Removes patients from a campaign before they're sent. Patients already sent to are skipped and listed in skipped. Source: https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns/{campaignId}/recipients/remove` Removes patients from a campaign before they're sent. Patients already sent to are skipped and listed in `skipped`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 - `patient_ids` (array of UUID, required): Up to 10,000 patient IDs. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with `changed`, the number of patients removed, and `skipped`, each patient left unchanged with its `reason`. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients/remove" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients/remove', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients/remove", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"patient_ids":["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"]}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients/remove", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/recipients/remove") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { patient_ids: ["5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77","9e0d3f7a-2c1b-4e8d-a5f6-7b3c2d1e0f98"] }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "changed": 2, "skipped": [] } ``` --- # Start a campaign > Starts sending a draft campaign, or resumes a paused one. Messages go out one at a time, send_interval_seconds apart. Source: https://www.bloomtext.com/developers/api/reference/start-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns/{campaignId}/start` Starts sending a draft campaign, or resumes a paused one. Messages go out one at a time, `send_interval_seconds` apart. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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. ### Returns Returns `200 OK` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `campaign_not_startable` | The campaign is already running, completed, stopped, or archived. | | 422 | `campaign_empty` | The campaign has no recipients waiting to be sent. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/start") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "running", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 412, "pending": 148, "sent": 264, "delivered": 251, "failed": 6, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": "2026-09-21T15:05:00Z", "finished_at": null } ``` --- # Pause a campaign > Stops sending after the message in progress. Start the campaign again to resume where it left off. Source: https://www.bloomtext.com/developers/api/reference/pause-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns/{campaignId}/pause` Stops sending after the message in progress. Start the campaign again to resume where it left off. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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. ### Returns Returns `200 OK` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `campaign_not_running` | Only a running campaign can be paused. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/pause" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/pause', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/pause", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/pause", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/pause") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "paused", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 412, "pending": 148, "sent": 264, "delivered": 251, "failed": 6, "skipped": 0 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": "2026-09-21T15:05:00Z", "finished_at": null } ``` --- # Stop a campaign > Stops a running or paused campaign for good. Recipients not yet sent are cancelled. A stopped campaign can't be started again. Source: https://www.bloomtext.com/developers/api/reference/stop-campaign/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=campaigns) `POST /campaigns/{campaignId}/stop` Stops a running or paused campaign for good. Recipients not yet sent are cancelled. A stopped campaign can't be started again. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/), or an [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `campaignId` (UUID, required): ID of the campaign. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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. ### Returns Returns `200 OK` with the [Campaign object](https://www.bloomtext.com/developers/api/reference/campaign-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `campaign_not_running` | Only a running or paused campaign can be stopped. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/stop" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/stop', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/stop", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/stop", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/campaigns/c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65/stop") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "c4a7e2d1-9b3f-4e6a-8d2c-1f0e9b8a7c65", "name": "Flu shot reminders, October", "status": "stopped", "channel": "secure", "body": "Flu shots are available at Northside Clinic. Reply here to book a time.", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "sender": { "id": "b7e1c3a9-4d2f-4a8b-9c6e-0f1d2e3a4b5c", "name": "Reminder service", "kind": "api_key" }, "send_interval_seconds": 1, "counts": { "recipients": 412, "pending": 0, "sent": 264, "delivered": 251, "failed": 6, "skipped": 148 }, "archived": false, "created_at": "2026-09-21T15:04:05Z", "started_at": "2026-09-21T15:05:00Z", "finished_at": "2026-09-21T15:20:00Z" } ``` --- # OAuth endpoints > Every endpoint an OAuth access token can call in the BloomText API, the admin's own conversations and the Patient API, plus the authorization server's URLs. Source: https://www.bloomtext.com/developers/api/reference/oauth-endpoints/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) All 38 endpoints an org admin's [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) can call: the admin's own conversations, which only OAuth reaches, and every [Patient API endpoint](https://www.bloomtext.com/developers/api/reference/patient-api-endpoints/). Each links to its full reference page, with parameters, errors, and code samples. ```text filename="Base URL" https://api.bloomtext.com/v1 ``` Send the access token as `Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN`. The scope column is what the admin must have approved; see [Scopes](https://www.bloomtext.com/developers/api/authentication/#scopes). ## Authorization server Your app gets and manages tokens with these standard OAuth 2.0 URLs: the authorization code flow for an app acting for an org admin, and client credentials for a server using an existing API key. They return OAuth errors, not problem details. See [Connect with OAuth](https://www.bloomtext.com/developers/api/oauth/). | Method | URL | Used to | | --- | --- | --- | | GET | `https://app.bloomtext.com/oauth/authorize` | [Send the admin to sign in and approve your app](https://www.bloomtext.com/developers/api/oauth/#send-the-user-to-bloomtext) | | POST | `https://app.bloomtext.com/oauth/token` | [Exchange a code for tokens](https://www.bloomtext.com/developers/api/oauth/#exchange-the-code-for-tokens) and [refresh an access token](https://www.bloomtext.com/developers/api/oauth/#refresh-an-access-token) | | POST | `https://app.bloomtext.com/oauth/token` with `grant_type=client_credentials` | [Get a token for an existing API key](https://www.bloomtext.com/developers/api/oauth/): a server-to-server access token that carries the key's scopes, a second way to authenticate the same key | | POST | `https://app.bloomtext.com/oauth/revoke` | [Disconnect a user](https://www.bloomtext.com/developers/api/oauth/#when-a-connection-ends) | | GET | `https://app.bloomtext.com/.well-known/oauth-authorization-server` | [Discover the authorization server](https://www.bloomtext.com/developers/api/oauth/#server-metadata) | | GET | `https://api.bloomtext.com/.well-known/oauth-protected-resource/v1` | [Discover the API as a protected resource](https://www.bloomtext.com/developers/api/oauth/#server-metadata) | ## The admin's own conversations OAuth only. These reach the conversations the connected admin is in, and the organization's staff directory. ### Profile The person who connected your app with OAuth, and the grant itself. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/me` | [Retrieve the profile](https://www.bloomtext.com/developers/api/reference/get-profile/) | `messages.read` | ### Messages The connected person's own messages, in team chats and patient conversations. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/me/messages` | [List messages](https://www.bloomtext.com/developers/api/reference/list-messages/) | `messages.read` | | GET | `/me/messages/{messageId}` | [Retrieve a message](https://www.bloomtext.com/developers/api/reference/get-message/) | `messages.read` | | POST | `/me/conversations/{conversationId}/messages` | [Send a message](https://www.bloomtext.com/developers/api/reference/create-message/) | `messages.write` | ### Reactions Emoji reactions on the connected person's messages. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/me/messages/{messageId}/reactions` | [List reactions](https://www.bloomtext.com/developers/api/reference/list-reactions/) | `messages.read` | | POST | `/me/messages/{messageId}/reactions` | [Add a reaction](https://www.bloomtext.com/developers/api/reference/create-reaction/) | `messages.write` | | DELETE | `/me/messages/{messageId}/reactions` | [Remove a reaction](https://www.bloomtext.com/developers/api/reference/delete-reaction/) | `messages.write` | ### Conversations The connected person's own conversations, team chats and patient conversations. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/me/conversations` | [List conversations](https://www.bloomtext.com/developers/api/reference/list-conversations/) | `messages.read` | | GET | `/me/conversations/{conversationId}` | [Retrieve a conversation](https://www.bloomtext.com/developers/api/reference/get-conversation/) | `messages.read` | ### Participants Staff and patients in one of the connected person's conversations. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/me/conversations/{conversationId}/participants` | [List participants](https://www.bloomtext.com/developers/api/reference/list-participants/) | `messages.read` | ### Users Staff members of the connected person's organization. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/users` | [List users](https://www.bloomtext.com/developers/api/reference/list-users/) | `messages.read` | | GET | `/users/{userId}` | [Retrieve a user](https://www.bloomtext.com/developers/api/reference/get-user/) | `messages.read` | ## Patient API The same endpoints an API key calls. With OAuth, [phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) are limited to the admin's teams' numbers, and messages come from the admin rather than a key. ### Organization The organization an API key acts on. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/organization` | [Retrieve the organization](https://www.bloomtext.com/developers/api/reference/get-organization/) | Any | ### Patients Patient records, always found by patient ID, phone number, or MRN. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patients` | [Find patients](https://www.bloomtext.com/developers/api/reference/list-patients/) | `patients.read` | | POST | `/patients` | [Create a patient](https://www.bloomtext.com/developers/api/reference/create-patient/) | `patients.write` | | GET | `/patients/{patientId}` | [Retrieve a patient](https://www.bloomtext.com/developers/api/reference/get-patient/) | `patients.read` | | PATCH | `/patients/{patientId}` | [Update a patient](https://www.bloomtext.com/developers/api/reference/update-patient/) | `patients.write` | | DELETE | `/patients/{patientId}` | [Delete a patient](https://www.bloomtext.com/developers/api/reference/delete-patient/) | `patients.write` | ### Patient imports Bulk imports of patient records. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | POST | `/patient-imports` | [Import patients](https://www.bloomtext.com/developers/api/reference/create-patient-import/) | `patients.write` | | GET | `/patient-imports/{importId}` | [Retrieve an import](https://www.bloomtext.com/developers/api/reference/get-patient-import/) | `patients.write` | ### Patient messages Messages with patients: send to a patient by ID or phone number, read patient messages by time range, and check delivery. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patient-messages` | [List patient messages](https://www.bloomtext.com/developers/api/reference/list-patient-messages/) | `messages.read` | | POST | `/patient-messages` | [Send a message to a patient](https://www.bloomtext.com/developers/api/reference/send-message/) | `messages.write` | | POST | `/messages:batch` | [Send messages to patients in a batch](https://www.bloomtext.com/developers/api/reference/send-message-batch/) | `messages.write` | | GET | `/patient-messages/{messageId}` | [Retrieve a patient message](https://www.bloomtext.com/developers/api/reference/get-patient-message/) | `messages.read` | ### Patient conversations Conversations with patients, one per patient and clinic phone number. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/patient-conversations` | [List patient conversations](https://www.bloomtext.com/developers/api/reference/list-patient-conversations/) | `messages.read` | | GET | `/patient-conversations/{conversationId}` | [Retrieve a patient conversation](https://www.bloomtext.com/developers/api/reference/get-patient-conversation/) | `messages.read` | ### Phone numbers The clinic phone numbers messages to patients come from, and the team each belongs to. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/phone-numbers` | [List phone numbers](https://www.bloomtext.com/developers/api/reference/list-phone-numbers/) | `messages.read` | ### Campaigns One message sent to many patients from a clinic phone number, with per-patient delivery. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/campaigns` | [List campaigns](https://www.bloomtext.com/developers/api/reference/list-campaigns/) | `messages.read` | | POST | `/campaigns` | [Create a campaign](https://www.bloomtext.com/developers/api/reference/create-campaign/) | `messages.write` | | GET | `/campaigns/{campaignId}` | [Retrieve a campaign](https://www.bloomtext.com/developers/api/reference/get-campaign/) | `messages.read` | | PATCH | `/campaigns/{campaignId}` | [Update a campaign](https://www.bloomtext.com/developers/api/reference/update-campaign/) | `messages.write` | | DELETE | `/campaigns/{campaignId}` | [Delete a campaign](https://www.bloomtext.com/developers/api/reference/delete-campaign/) | `messages.write` | | GET | `/campaigns/{campaignId}/recipients` | [List campaign recipients](https://www.bloomtext.com/developers/api/reference/list-campaign-recipients/) | `messages.read` | | POST | `/campaigns/{campaignId}/recipients` | [Add campaign recipients](https://www.bloomtext.com/developers/api/reference/add-campaign-recipients/) | `messages.write` | | POST | `/campaigns/{campaignId}/recipients/remove` | [Remove campaign recipients](https://www.bloomtext.com/developers/api/reference/remove-campaign-recipients/) | `messages.write` | | POST | `/campaigns/{campaignId}/start` | [Start a campaign](https://www.bloomtext.com/developers/api/reference/start-campaign/) | `messages.write` | | POST | `/campaigns/{campaignId}/pause` | [Pause a campaign](https://www.bloomtext.com/developers/api/reference/pause-campaign/) | `messages.write` | | POST | `/campaigns/{campaignId}/stop` | [Stop a campaign](https://www.bloomtext.com/developers/api/reference/stop-campaign/) | `messages.write` | --- # The Profile object > Attributes of a BloomText Profile and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/profile-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) The person who connected your app with OAuth, and the grant itself. ### Attributes - `user` (User, required): Child attributes: - `id` (UUID, required): Unique ID of the user. - `name` (string, required): Display name. - `role` (string, required): The user's role in the organization. - `organization` (Organization, required): Child attributes: - `id` (UUID, required): Stable organization UUID. - `name` (string, required): Organization display name. - `app` (App, required): A registered app. Child attributes: - `client_id` (string, required): Your app's OAuth client ID. - `name` (string, required): Your app's name as users and staff see it. - `scopes` (array of string, required): Scopes the user granted your app. - `expires_at` (timestamp, required): When this grant reaches its 12-month limit and the user must approve your app again. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me` | [Retrieve the profile](https://www.bloomtext.com/developers/api/reference/get-profile/) | ```json filename="The Profile object" { "user": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "member" }, "organization": { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" }, "app": { "client_id": "bt_client_7Hq2mX9aLk", "name": "Acme EHR Assistant" }, "scopes": [ "messages.read", "offline_access" ], "expires_at": "2027-09-21T15:04:05Z" } ``` --- # Retrieve the profile > Returns the person who connected your app, their organization, the scopes they granted, and when the grant expires. Source: https://www.bloomtext.com/developers/api/reference/get-profile/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me` Returns the person who connected your app, their organization, the scopes they granted, and when the grant expires. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Returns Returns `200 OK` with the [Profile object](https://www.bloomtext.com/developers/api/reference/profile-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "user": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "admin" }, "organization": { "id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "name": "Northside Clinic" }, "app": { "client_id": "bt_client_7Hq2mX9aLk", "name": "Acme EHR Assistant" }, "scopes": [ "messages.read", "offline_access" ], "expires_at": "2027-09-21T15:04:05Z" } ``` --- # List messages > Lists messages in the connected person's own conversations, team chats and patient conversations alike, in a time range, newest first, with a cursor. group_by=message (the default) returns them one by one; group_by=conversation returns every message in the range from one conversation before moving to the next. A conversation's messages include everyone's, not only the person's own. Source: https://www.bloomtext.com/developers/api/reference/list-messages/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/messages` Lists messages in the connected person's own conversations, team chats and patient conversations alike, in a time range, newest first, with a cursor. `group_by=message` (the default) returns them one by one; `group_by=conversation` returns every message in the range from one conversation before moving to the next. A conversation's messages include everyone's, not only the person's own. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Query parameters - `after` (string): Only messages sent at or after this time. An RFC 3339 timestamp, or a date for midnight in the organization's time zone. - `before` (string): Only messages sent before this time. Same format as `after`. - `group_by` (message, conversation): `message` (the default) lists messages one by one across conversations. `conversation` lists every message in the range from one conversation, then the next. - `order` (desc, asc): `desc` for newest first (the default) or `asc` for oldest first. With `group_by=conversation`, it orders the conversations by their latest message and the messages within each. - `conversation_id` (UUID): Only messages in this conversation. - `patient_id` (UUID): Only conversations with this patient, on any phone number. - `q` (string): Words and operators to search for, like `refill from:patient is:failed`. Supports free text, `"exact phrases"`, `from:`, `patient:`, `mrn:`, `phone:`, `is:failed`, `-` to negate, and `OR`; with OAuth, also `is:unread`. Use `after` and `before` for time ranges. See Search. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Message object](https://www.bloomtext.com/developers/api/reference/message-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `invalid_query` | The `q` query can’t be parsed. See [Search](https://www.bloomtext.com/developers/api/search/). | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/messages?after=2026-09-21T00:00:00Z&q=from:patient" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/messages?after=2026-09-21T00:00:00Z&q=from:patient', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/messages?after=2026-09-21T00:00:00Z&q=from:patient", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/messages?after=2026-09-21T00:00:00Z&q=from:patient", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/messages?after=2026-09-21T00:00:00Z&q=from:patient") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": null, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi, can I move my Thursday appointment to Friday morning?", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Retrieve a message > Returns one message in the connected person's own conversations. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/get-message/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/messages/{messageId}` Returns one message in the connected person's own conversations. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Path parameters - `messageId` (UUID, required): ID of the message. ### Returns Returns `200 OK` with the [Message object](https://www.bloomtext.com/developers/api/reference/message-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe", "kind": "patient" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": null, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Hi, can I move my Thursday appointment to Friday morning?", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": null } ``` --- # Send a message > Sends a text message as the connected person in one of their own conversations, a team chat or a patient conversation, and marks it as read for them. Set reply_to_message_id to reply in a thread. To message a patient by patient ID or phone number, use Send a message to a patient. Source: https://www.bloomtext.com/developers/api/reference/create-message/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `POST /me/conversations/{conversationId}/messages` Sends a text message as the connected person in one of their own conversations, a team chat or a patient conversation, and marks it as read for them. Set `reply_to_message_id` to reply in a thread. To message a patient by patient ID or phone number, use Send a message to a patient. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` ### Path parameters - `conversationId` (UUID, required): ID of the conversation. ### Headers - `Idempotency-Key` (UUID, required): 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 A text message. Sending files through the API isn't available yet. - `body` (string, required): Message text, up to 10,000 characters. - `reply_to_message_id` (UUID or null): Set to reply in a thread. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the [Message object](https://www.bloomtext.com/developers/api/reference/message-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"body":"Friday at 9:00 works. You are all set."}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"body":"Friday at 9:00 works. You are all set."}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"body":"Friday at 9:00 works. You are all set."}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"body":"Friday at 9:00 works. You are all set."}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/messages") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { body: "Friday at 9:00 works. You are all set." }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "conversation": { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "title": "Jane Doe" }, "sender": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Dr. Example", "kind": "staff" }, "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "channel": "sms", "phone_number": { "number": "+15125550100", "team": "Front desk" }, "delivery": { "status": "queued", "error": null, "updated_at": "2026-09-21T15:04:05Z" }, "campaign_id": null, "created_at": "2026-09-21T15:04:05Z", "edited_at": null, "type": "text", "body": "Friday at 9:00 works. You are all set.", "file": null, "reply_to_message_id": null, "unread": false, "sent_via": { "client_id": "bt_client_7Hq2mX9aLk", "name": "Acme EHR Assistant" } } ``` --- # The Reaction object > Attributes of a BloomText Reaction and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/reaction-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) Emoji reactions on the connected person's messages. OAuth only. ### Attributes - `message_id` (UUID, required): Message the reaction is on. - `user_id` (UUID, required): User who reacted. - `emoji` (string, required): The emoji. - `created_at` (timestamp, required): When the reaction was added. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/messages/{messageId}/reactions` | [List reactions](https://www.bloomtext.com/developers/api/reference/list-reactions/) | | POST | `/me/messages/{messageId}/reactions` | [Add a reaction](https://www.bloomtext.com/developers/api/reference/create-reaction/) | | DELETE | `/me/messages/{messageId}/reactions` | [Remove a reaction](https://www.bloomtext.com/developers/api/reference/delete-reaction/) | ```json filename="The Reaction object" { "message_id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "user_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "emoji": "👍", "created_at": "2026-09-21T15:04:05Z" } ``` --- # List reactions > Lists the emoji reactions on a message. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/list-reactions/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/messages/{messageId}/reactions` Lists the emoji reactions on a message. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Path parameters - `messageId` (UUID, required): ID of the message. ### Query parameters - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Reaction object](https://www.bloomtext.com/developers/api/reference/reaction-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "message_id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "user_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "emoji": "👍", "created_at": "2026-09-21T15:04:05Z" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Add a reaction > Adds an emoji reaction to a message as the user. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/create-reaction/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `POST /me/messages/{messageId}/reactions` Adds an emoji reaction to a message as the user. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.write` · **Idempotent:** With `Idempotency-Key` ### Path parameters - `messageId` (UUID, required): ID of the message. ### Headers - `Idempotency-Key` (UUID, required): 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 - `emoji` (string, required): A single emoji, such as 👍. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the [Reaction object](https://www.bloomtext.com/developers/api/reference/reaction-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"emoji":"👍"}' ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({"emoji":"👍"}), }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", "Idempotency-Key": str(uuid.uuid4()), }, json={"emoji":"👍"}, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "bytes" "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { body := bytes.NewBufferString(`{"emoji":"👍"}`) req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions", body) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) req.Header.Set("Idempotency-Key", uuid.NewString()) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" request["Idempotency-Key"] = SecureRandom.uuid request["Content-Type"] = "application/json" request.body = { emoji: "👍" }.to_json response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "message_id": "4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1", "user_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "emoji": "👍", "created_at": "2026-09-21T15:04:05Z" } ``` --- # Remove a reaction > Removes the user's reaction from a message. Reactions have no ID of their own, so pass the exact emoji. Source: https://www.bloomtext.com/developers/api/reference/delete-reaction/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `DELETE /me/messages/{messageId}/reactions` Removes the user's reaction from a message. Reactions have no ID of their own, so pass the exact emoji. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.write` ### Path parameters - `messageId` (UUID, required): ID of the message. ### Query parameters - `emoji` (string, required): The exact emoji the user reacted with. ### Returns Returns `204 No Content` with an empty body. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions?emoji=%F0%9F%91%8D" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions?emoji=%F0%9F%91%8D', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) ``` ```python filename="Request" import os import requests response = requests.delete( "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions?emoji=%F0%9F%91%8D", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("DELETE", "https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions?emoji=%F0%9F%91%8D", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/messages/4cbfdb50-6b7d-45d4-94b3-05a52ce3f4d1/reactions?emoji=%F0%9F%91%8D") request = Net::HTTP::Delete.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code ``` ```text filename="Response" HTTP/1.1 204 No Content ``` --- # List conversations > Lists the connected person's own conversations, team chats and patient conversations alike, with messages in a time range, most recently active first, each with its latest message and how many messages fell in the range. Source: https://www.bloomtext.com/developers/api/reference/list-conversations/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/conversations` Lists the connected person's own conversations, team chats and patient conversations alike, with messages in a time range, most recently active first, each with its latest message and how many messages fell in the range. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Query parameters - `after` (string): Only messages sent at or after this time. An RFC 3339 timestamp, or a date for midnight in the organization's time zone. - `before` (string): Only messages sent before this time. Same format as `after`. - `patient_id` (UUID): Only conversations with this patient, on any phone number. - `q` (string): Words and operators to filter conversations by, like `is:unread doe`. Free text matches conversation titles and participant names. Also supports `is:unread` and `with:` a user or patient ID. See Search. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Conversation object](https://www.bloomtext.com/developers/api/reference/conversation-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `invalid_query` | The `q` query can’t be parsed. See [Search](https://www.bloomtext.com/developers/api/search/). | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/conversations?after=2026-09-21T00:00:00Z" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/conversations?after=2026-09-21T00:00:00Z', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/conversations?after=2026-09-21T00:00:00Z", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/conversations?after=2026-09-21T00:00:00Z", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/conversations?after=2026-09-21T00:00:00Z") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "organization_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "type": "patient", "title": "Jane Doe", "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "phone_number": { "number": "+15125550100", "team": "Front desk" }, "channel": "sms", "created_at": "2026-09-21T15:04:05Z", "last_message_at": "2026-09-21T15:04:05Z", "unread_count": 0, "seen_at": null, "messages_in_range": null, "latest_message": null } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Retrieve a conversation > Returns one of the connected person's own conversations, with their unread count. Source: https://www.bloomtext.com/developers/api/reference/get-conversation/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/conversations/{conversationId}` Returns one of the connected person's own conversations, with their unread count. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Path parameters - `conversationId` (UUID, required): ID of the conversation. ### Returns Returns `200 OK` with the [Conversation object](https://www.bloomtext.com/developers/api/reference/conversation-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "organization_id": "6db1e3f5-9b7f-4f2b-8be1-0f1e1d7d7d8c", "type": "patient", "title": "Jane Doe", "patient": { "id": "5a1c9e2b-7d44-4f1a-9c3e-2b8d6f0a1e77", "name": "Jane Doe" }, "phone_number": { "number": "+15125550100", "team": "Front desk" }, "channel": "sms", "created_at": "2026-09-21T15:04:05Z", "last_message_at": "2026-09-21T15:04:05Z", "unread_count": 0, "seen_at": null, "messages_in_range": null, "latest_message": null } ``` --- # The Participant object > Attributes of a BloomText Participant and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/participant-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) Staff and patients in one of the connected person's conversations. OAuth only. ### Attributes - `user_id` (UUID, required): The participating user or patient. - `name` (string, required): Display name. - `kind` (staff, patient, required): Whether the participant is a staff member or a patient. - `conversation_id` (UUID, required): The conversation. - `joined_at` (timestamp, required): When the participant joined the conversation. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/me/conversations/{conversationId}/participants` | [List participants](https://www.bloomtext.com/developers/api/reference/list-participants/) | ```json filename="The Participant object" { "user_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "kind": "staff", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "joined_at": "2026-09-21T15:04:05Z" } ``` --- # List participants > Lists the staff and patients in a conversation. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/list-participants/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /me/conversations/{conversationId}/participants` Lists the staff and patients in a conversation. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Path parameters - `conversationId` (UUID, required): ID of the conversation. ### Query parameters - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Participant object](https://www.bloomtext.com/developers/api/reference/participant-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/participants" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/participants', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/participants", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/participants", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/me/conversations/e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0/participants") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "user_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "kind": "staff", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "joined_at": "2026-09-21T15:04:05Z" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # The User object > Attributes of a BloomText User and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/user-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) Staff members of the connected person's organization. OAuth only. ### Attributes - `id` (UUID, required): Unique ID of the user. - `name` (string, required): Display name. - `role` (string, required): The user's role in the organization. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/users` | [List users](https://www.bloomtext.com/developers/api/reference/list-users/) | | GET | `/users/{userId}` | [Retrieve a user](https://www.bloomtext.com/developers/api/reference/get-user/) | ```json filename="The User object" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "member" } ``` --- # List users > Lists the staff members of the user's organization, ordered by name. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/list-users/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /users` Lists the staff members of the user's organization, ordered by name. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Query parameters - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [User object](https://www.bloomtext.com/developers/api/reference/user-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/users" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/users', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/users", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/users", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/users") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "member" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Retrieve a user > Returns a single staff member of the user's organization. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/get-user/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=oauth) `GET /users/{userId}` Returns a single staff member of the user's organization. **Credentials:** [OAuth access token](https://www.bloomtext.com/developers/api/oauth/) only · **Scope:** `messages.read` ### Path parameters - `userId` (UUID, required): ID of the user. ### Returns Returns `200 OK` with the [User object](https://www.bloomtext.com/developers/api/reference/user-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `oauth_required` | API keys can’t use this endpoint. It needs OAuth. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/users/8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55" \ -H "Authorization: Bearer $BLOOMTEXT_ACCESS_TOKEN" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/users/8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_ACCESS_TOKEN}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/users/8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_ACCESS_TOKEN']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/users/8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_ACCESS_TOKEN")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/users/8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_ACCESS_TOKEN")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "Alex Example", "role": "member" } ``` --- # Account endpoints > Every endpoint an account API key can call to manage the organizations, members and teams on a BloomText account. Source: https://www.bloomtext.com/developers/api/reference/account-endpoints/ All 11 endpoints for running the organizations on your account by script: list the organizations a key reaches, and add, change and remove members and team members. An [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes, created by an Owner or IT person under Settings → Account → API keys, calls them; they answer `403` with `code: accounts_not_enabled` until BloomText turns accounts on for your account. ```text filename="Base URL" https://api.bloomtext.com/v1 ``` Pass `org_id` to say which organization a call is for when the key reaches more than one; without it the call answers `400` with `code: org_id_required`. [List organizations](https://www.bloomtext.com/developers/api/reference/list-orgs/) returns the IDs. An API key changes only the memberships an API key made: the rest answer `409` with `code: managed_by_admin`, `managed_by_account`, or `managed_by_identity_provider` (the account's Okta rules). ## Organizations The organizations on your account an account API key reaches. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/orgs` | [List organizations](https://www.bloomtext.com/developers/api/reference/list-orgs/) | `members.read` | ## Members People in an organization on your account, and who manages each membership. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/members` | [List members](https://www.bloomtext.com/developers/api/reference/list-members/) | `members.read` | | POST | `/members` | [Add a member](https://www.bloomtext.com/developers/api/reference/create-member/) | `members.write` | | GET | `/members/{memberId}` | [Retrieve a member](https://www.bloomtext.com/developers/api/reference/get-member/) | `members.read` | | PATCH | `/members/{memberId}` | [Update a member](https://www.bloomtext.com/developers/api/reference/update-member/) | `members.write` | | DELETE | `/members/{memberId}` | [Remove a member](https://www.bloomtext.com/developers/api/reference/delete-member/) | `members.write` | ## Teams Teams in an organization on your account, and the people the API placed on them. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/teams` | [List teams](https://www.bloomtext.com/developers/api/reference/list-teams/) | `members.read` | | POST | `/teams/{teamId}/members` | [Add a member to a team](https://www.bloomtext.com/developers/api/reference/add-team-member/) | `teams.write` | | DELETE | `/teams/{teamId}/members/{memberId}` | [Remove a member from a team](https://www.bloomtext.com/developers/api/reference/remove-team-member/) | `teams.write` | ## Member events Who joined, was approved, or left an organization on your account, and who did it. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/member-events` | [List member events](https://www.bloomtext.com/developers/api/reference/list-member-events/) | `members.read` | ## Audit events What people did in an organization on your account: sign-ins, chat views, exports, member and setting changes. Kept six years. | Method | Path | Endpoint | Scope | | --- | --- | --- | --- | | GET | `/audit-events` | [List audit events](https://www.bloomtext.com/developers/api/reference/list-audit-events/) | `audit.read` | --- # The Organization (account) object > Attributes of a BloomText Organization (account) and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/org-object/ The organizations on your account an account API key reaches. Account API keys only. ### Attributes - `id` (UUID, required): - `name` (string, required): - `is_default` (boolean, required): The account's default organization, where account-wide calls are recorded. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/orgs` | [List organizations](https://www.bloomtext.com/developers/api/reference/list-orgs/) | ```json filename="The Organization (account) object" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_default": false } ``` --- # List organizations > Lists the organizations on your account that the API key reaches, with the default organization marked. org_id on every other call takes one of these IDs. Source: https://www.bloomtext.com/developers/api/reference/list-orgs/ `GET /orgs` Lists the organizations on your account that the API key reaches, with the default organization marked. `org_id` on every other call takes one of these IDs. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Returns Returns `200 OK` with a `data` array of [Organization (account) object](https://www.bloomtext.com/developers/api/reference/org-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/orgs" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/orgs', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/orgs", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/orgs", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/orgs") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_default": false } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # The Member object > Attributes of a BloomText Member and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/member-object/ People in an organization on your account, and who manages each membership. Account API keys only. ### Attributes - `id` (UUID, required): The person's BloomText user ID. - `org_id` (UUID, required): - `email` (string, required): - `first_name` (string, required): - `last_name` (string, required): - `role` (admin, user, required): The role in this organization. - `account_role` (owner, it, null, required): Owner or IT on the account, set only in BloomText. - `managed_by` (admin, api, account, required): Who changes this membership: people in BloomText, an API key, or the account (an Owner or IT person's membership in every organization). - `managed_by_name` (string or null, required): The API key's name when `managed_by` is `api`. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/members` | [List members](https://www.bloomtext.com/developers/api/reference/list-members/) | | POST | `/members` | [Add a member](https://www.bloomtext.com/developers/api/reference/create-member/) | | GET | `/members/{memberId}` | [Retrieve a member](https://www.bloomtext.com/developers/api/reference/get-member/) | | PATCH | `/members/{memberId}` | [Update a member](https://www.bloomtext.com/developers/api/reference/update-member/) | | DELETE | `/members/{memberId}` | [Remove a member](https://www.bloomtext.com/developers/api/reference/delete-member/) | ```json filename="The Member object" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "email": "string", "first_name": "string", "last_name": "string", "role": "admin", "account_role": "owner", "managed_by": "admin", "managed_by_name": "string" } ``` --- # List members > Lists the members of an organization by name, with their role, account role and who manages each membership: admin (people in BloomText), api (an API key) or account (an Owner or IT person, in every organization). Source: https://www.bloomtext.com/developers/api/reference/list-members/ `GET /members` Lists the members of an organization by name, with their role, account role and who manages each membership: `admin` (people in BloomText), `api` (an API key) or `account` (an Owner or IT person, in every organization). **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Member object](https://www.bloomtext.com/developers/api/reference/member-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/members" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/members', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/members", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/members", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/members") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "email": "string", "first_name": "string", "last_name": "string", "role": "admin", "account_role": "owner", "managed_by": "admin", "managed_by_name": "string" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Add a member > Adds a person to an organization as a membership the API manages. A new email creates their BloomText user, owned by your account. They get an invite email only with send_invite_email: true. Only API keys change memberships the API made; people in BloomText see them locked as "Managed by API". Source: https://www.bloomtext.com/developers/api/reference/create-member/ `POST /members` Adds a person to an organization as a membership the API manages. A new email creates their BloomText user, owned by your account. They get an invite email only with `send_invite_email: true`. Only API keys change memberships the API made; people in BloomText see them locked as "Managed by API". **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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-Key` (UUID, required): 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 - `email` (string, required): The person's email address. A new one creates their BloomText user. - `first_name` (string): - `last_name` (string): - `role` (admin, user): - `title` (string): - `send_invite_email` (boolean): Email them an invite to set a password, if they haven't signed in yet. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the [Member object](https://www.bloomtext.com/developers/api/reference/member-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 409 | `already_member` | That person is already a member of this organization. | | 409 | `patient_account` | That email belongs to a patient's account. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/members" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/members', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/members", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/members", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/members") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "email": "string", "first_name": "string", "last_name": "string", "role": "admin", "account_role": "owner", "managed_by": "admin", "managed_by_name": "string" } ``` --- # Retrieve a member > Returns one member of the organization. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/get-member/ `GET /members/{memberId}` Returns one member of the organization. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `memberId` (UUID, required): The member's ID. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with the [Member object](https://www.bloomtext.com/developers/api/reference/member-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/members/memberId" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/members/memberId', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/members/memberId", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/members/memberId", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/members/memberId") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "email": "string", "first_name": "string", "last_name": "string", "role": "admin", "account_role": "owner", "managed_by": "admin", "managed_by_name": "string" } ``` --- # Update a member > Changes the role or title of a membership the API manages. A membership people manage in BloomText answers 409 managed_by_admin; an Owner or IT person's answers 409 managed_by_account. Source: https://www.bloomtext.com/developers/api/reference/update-member/ `PATCH /members/{memberId}` Changes the role or title of a membership the API manages. A membership people manage in BloomText answers 409 `managed_by_admin`; an Owner or IT person's answers 409 `managed_by_account`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `memberId` (UUID, required): The member's ID. ### Query parameters - `org_id` (UUID): 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. ### Body parameters - `role` (admin, user): - `title` (string): Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `200 OK` with the [Member object](https://www.bloomtext.com/developers/api/reference/member-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `managed_by_admin` | People in BloomText manage this membership. | | 409 | `managed_by_account` | This is an Owner or IT person's membership. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X PATCH "https://api.bloomtext.com/v1/members/memberId" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/members/memberId', { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.patch( "https://api.bloomtext.com/v1/members/memberId", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("PATCH", "https://api.bloomtext.com/v1/members/memberId", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/members/memberId") request = Net::HTTP::Patch.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "email": "string", "first_name": "string", "last_name": "string", "role": "admin", "account_role": "owner", "managed_by": "admin", "managed_by_name": "string" } ``` --- # Remove a member > Removes a membership the API manages. When it's the person's only organization and your account owns their user, removing them deletes the user, so the call must add confirm_delete_user=true (it then answers 204 as for any removal); without it the call answers 409 confirmation_required with reason: would_delete_user and changes nothing. Source: https://www.bloomtext.com/developers/api/reference/delete-member/ `DELETE /members/{memberId}` Removes a membership the API manages. When it's the person's only organization and your account owns their user, removing them deletes the user, so the call must add `confirm_delete_user=true` (it then answers `204` as for any removal); without it the call answers 409 `confirmation_required` with `reason: would_delete_user` and changes nothing. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `memberId` (UUID, required): The member's ID. ### Query parameters - `org_id` (UUID): 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. - `confirm_delete_user` (boolean): `true` to remove someone from their only organization when that deletes their BloomText user. ### Returns Returns `204 No Content` with an empty body. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `managed_by_admin` | People in BloomText manage this membership. | | 409 | `managed_by_account` | This is an Owner or IT person's membership. | | 409 | `confirmation_required` | Removing them deletes their user: add `confirm_delete_user=true`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/members/memberId" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/members/memberId', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) ``` ```python filename="Request" import os import requests response = requests.delete( "https://api.bloomtext.com/v1/members/memberId", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("DELETE", "https://api.bloomtext.com/v1/members/memberId", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/members/memberId") request = Net::HTTP::Delete.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code ``` ```text filename="Response" HTTP/1.1 204 No Content ``` --- # The Team object > Attributes of a BloomText Team and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/team-object/ Teams in an organization on your account, and the people the API placed on them. Account API keys only. ### Attributes - `id` (UUID, required): - `org_id` (UUID, required): - `name` (string, required): - `is_default` (boolean, required): ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/teams` | [List teams](https://www.bloomtext.com/developers/api/reference/list-teams/) | | POST | `/teams/{teamId}/members` | [Add a member to a team](https://www.bloomtext.com/developers/api/reference/add-team-member/) | | DELETE | `/teams/{teamId}/members/{memberId}` | [Remove a member from a team](https://www.bloomtext.com/developers/api/reference/remove-team-member/) | ```json filename="The Team object" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_default": false } ``` --- # List teams > Lists the teams of an organization, its default team first. Parameters, responses, and code examples in cURL, JavaScript, Python, Go, and Ruby. Source: https://www.bloomtext.com/developers/api/reference/list-teams/ `GET /teams` Lists the teams of an organization, its default team first. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. ### Returns Returns `200 OK` with a `data` array of [Team object](https://www.bloomtext.com/developers/api/reference/team-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/teams" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/teams', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/teams", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/teams", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/teams") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_default": false } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # Add a member to a team > Puts a member of the team's organization on the team. Someone already on it stays as they are. Source: https://www.bloomtext.com/developers/api/reference/add-team-member/ `POST /teams/{teamId}/members` Puts a member of the team's organization on the team. Someone already on it stays as they are. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `teams.write` · **Idempotent:** With `Idempotency-Key` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `teamId` (UUID, required): The team's ID. ### Headers - `Idempotency-Key` (UUID, required): 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 - `member_id` (UUID, required): A member of the team's organization. Any other field returns `422 unknown_field`. See [Unknown fields are rejected](https://www.bloomtext.com/developers/api/errors/#unknown-fields-are-rejected). ### Returns Returns `201 Created` with the [Team object](https://www.bloomtext.com/developers/api/reference/team-object/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `idempotency_key_reused` | The Idempotency-Key was already used with a different request. | | 409 | `idempotency_request_in_progress` | A request with this Idempotency-Key is still running. Retry shortly. | | 422 | `validation_failed` | A field failed validation. See `field_errors`. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X POST "https://api.bloomtext.com/v1/teams/teamId/members" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/teams/teamId/members', { method: 'POST', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import uuid import requests response = requests.post( "https://api.bloomtext.com/v1/teams/teamId/members", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" "github.com/google/uuid" ) func main() { req, err := http.NewRequest("POST", "https://api.bloomtext.com/v1/teams/teamId/members", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) req.Header.Set("Idempotency-Key", uuid.NewString()) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" require "securerandom" uri = URI("https://api.bloomtext.com/v1/teams/teamId/members") request = Net::HTTP::Post.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" request["Idempotency-Key"] = SecureRandom.uuid response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 201 Created" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_default": false } ``` --- # Remove a member from a team > Takes someone the API put on a team off it. Someone people placed in BloomText answers 409 managed_by_admin. Source: https://www.bloomtext.com/developers/api/reference/remove-team-member/ `DELETE /teams/{teamId}/members/{memberId}` Takes someone the API put on a team off it. Someone people placed in BloomText answers 409 `managed_by_admin`. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `teams.write` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Path parameters - `teamId` (UUID, required): The team's ID. - `memberId` (UUID, required): The member's ID. ### Returns Returns `204 No Content` with an empty body. ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 404 | `not_found` | The resource doesn’t exist, or isn’t visible to this credential. | | 409 | `managed_by_admin` | People in BloomText put this person on the team. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl -X DELETE "https://api.bloomtext.com/v1/teams/teamId/members/memberId" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/teams/teamId/members/memberId', { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) ``` ```python filename="Request" import os import requests response = requests.delete( "https://api.bloomtext.com/v1/teams/teamId/members/memberId", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("DELETE", "https://api.bloomtext.com/v1/teams/teamId/members/memberId", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/teams/teamId/members/memberId") request = Net::HTTP::Delete.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.code ``` ```text filename="Response" HTTP/1.1 204 No Content ``` --- # The Member event object > Attributes of a BloomText Member event and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/member-event-object/ Who joined, was approved, or left an organization on your account, and who did it. Account API keys only. ### Attributes - `type` (added, approved, removed, required): - `member_id` (UUID, required): - `org_id` (UUID, required): - `role` (string, required): - `occurred_at` (timestamp, required): - `actor_name` (string or null, required): Who made the change: a person's name, or `API key: `. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/member-events` | [List member events](https://www.bloomtext.com/developers/api/reference/list-member-events/) | ```json filename="The Member event object" { "type": "added", "member_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "role": "string", "occurred_at": "2026-09-21T15:04:05Z", "actor_name": "API key: HR sync" } ``` --- # List member events > Lists membership changes in an organization: who was added, approved or removed, when, and by whom. A change an API key made names it as API key: . Pages by membership, newest first. Source: https://www.bloomtext.com/developers/api/reference/list-member-events/ `GET /member-events` Lists membership changes in an organization: who was added, approved or removed, when, and by whom. A change an API key made names it as `API key: `. Pages by membership, newest first. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `members.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Member event object](https://www.bloomtext.com/developers/api/reference/member-event-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/member-events" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/member-events', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/member-events", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/member-events", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/member-events") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "type": "added", "member_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "role": "string", "occurred_at": "2026-09-21T15:04:05Z", "actor_name": "API key: HR sync" } ], "pagination": { "next_cursor": null, "has_more": false } } ``` --- # The Audit event object > Attributes of a BloomText Audit event and the endpoints that return it. Source: https://www.bloomtext.com/developers/api/reference/audit-event-object/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=audit-events) What people did in an organization on your account: sign-ins, chat views, exports, member and setting changes. Kept six years. Account API keys only. ### Attributes - `id` (UUID, required): - `org_id` (UUID, required): - `occurred_at` (timestamp, required): - `action` (AuditAction, required): What happened, as `object.past_tense_verb`. - `actor` (object, required): - `member_id` (UUID or null): The member acted on, for member, role and team changes. - `patient_id` (UUID or null): - `conversation_id` (UUID or null): - `team_id` (UUID or null): - `details` (string or null): What changed, such as a setting's old and new value. Never message text or patient details. ### Endpoints | Method | Path | Endpoint | | --- | --- | --- | | GET | `/audit-events` | [List audit events](https://www.bloomtext.com/developers/api/reference/list-audit-events/) | ```json filename="The Audit event object" { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "occurred_at": "2026-09-21T15:04:05Z", "action": "audit_log.exported", "actor": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_support": false }, "member_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "patient_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "team_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "details": "string" } ``` --- # List audit events > Lists an organization's audit events, newest first, with the filters of Account → Audit: a date range, a person, actions and a patient. Each event names its action with a dotted name such as chat.viewed, the same name the audit log's CSV export uses. In BloomText today, Owners and IT see the audit log under Settings → Account → Audit and download it as CSV. Source: https://www.bloomtext.com/developers/api/reference/list-audit-events/ > Your BloomText team turns this on for your account. [Request access](https://calendly.com/tyler-bloom/bloomtext-homepage-demo-request?utm_campaign=api-access&utm_content=audit-events) `GET /audit-events` Lists an organization's audit events, newest first, with the filters of Account → Audit: a date range, a person, actions and a patient. Each event names its action with a dotted name such as `chat.viewed`, the same name the audit log's CSV export uses. In BloomText today, Owners and IT see the audit log under Settings → Account → Audit and download it as CSV. **Credentials:** [API key](https://www.bloomtext.com/developers/api/api-keys/) with member scopes · **Scope:** `audit.read` [Run in Postman](https://www.bloomtext.com/developers/api/postman/bloomtext-api.postman_collection.json): import the collection and set `api_key`. ### Query parameters - `org_id` (UUID): 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. - `after` (string): Only messages sent at or after this time. An RFC 3339 timestamp, or a date for midnight in the organization's time zone. - `before` (string): Only messages sent before this time. Same format as `after`. - `actor_id` (UUID): Only events this person did, by user ID. - `action` (array of AuditAction): Only these actions, by dotted name. Repeat the parameter for several. - `patient_id` (UUID): Only events about this patient. - `page[limit]` (integer): Number of records to return. Defaults to 50, maximum 100. - `page[after]` (string): Cursor from the previous page's `pagination.next_cursor`. ### Returns Returns `200 OK` with a `data` array of [Audit event object](https://www.bloomtext.com/developers/api/reference/audit-event-object/)s and a `pagination` object. See [pagination](https://www.bloomtext.com/developers/api/pagination/). ### Errors Failed requests return `application/problem+json` [problem details](https://www.bloomtext.com/developers/api/errors/). The errors specific to this endpoint: | Status | Code | Meaning | | --- | --- | --- | | 400 | `invalid_request` | The request is malformed, such as invalid JSON. | | 400 | `org_id_required` | The key reaches more than one organization: pass `org_id`. | | 401 | `invalid_token` | The API key is missing or malformed, or isn’t a BloomText key. | | 401 | `key_revoked` | The API key was revoked. | | 401 | `key_expired` | The API key’s expiry has passed. | | 403 | `insufficient_scope` | The key doesn’t have the scope this endpoint needs. | | 403 | `org_not_reachable` | The key can't reach the organization in `org_id`. | | 403 | `accounts_not_enabled` | The account layer isn't turned on for this account yet. | | 429 | `rate_limited` | Too many requests. Retry after `Retry-After` seconds. | ```bash filename="Request" curl "https://api.bloomtext.com/v1/audit-events?after=2026-09-21T00:00:00Z" \ -H "Authorization: Bearer $BLOOMTEXT_API_KEY" ``` ```js filename="Request" const response = await fetch('https://api.bloomtext.com/v1/audit-events?after=2026-09-21T00:00:00Z', { headers: { Authorization: `Bearer ${process.env.BLOOMTEXT_API_KEY}`, }, }) if (!response.ok) throw new Error(`BloomText API error: ${response.status}`) const data = await response.json() ``` ```python filename="Request" import os import requests response = requests.get( "https://api.bloomtext.com/v1/audit-events?after=2026-09-21T00:00:00Z", headers={ "Authorization": f"Bearer {os.environ['BLOOMTEXT_API_KEY']}", }, ) response.raise_for_status() data = response.json() ``` ```go filename="Request" package main import ( "fmt" "io" "net/http" "os" ) func main() { req, err := http.NewRequest("GET", "https://api.bloomtext.com/v1/audit-events?after=2026-09-21T00:00:00Z", nil) if err != nil { panic(err) } req.Header.Set("Authorization", "Bearer "+os.Getenv("BLOOMTEXT_API_KEY")) res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() out, _ := io.ReadAll(res.Body) fmt.Println(res.Status, string(out)) } ``` ```ruby filename="Request" require "net/http" require "json" uri = URI("https://api.bloomtext.com/v1/audit-events?after=2026-09-21T00:00:00Z") request = Net::HTTP::Get.new(uri) request["Authorization"] = "Bearer #{ENV.fetch("BLOOMTEXT_API_KEY")}" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end data = JSON.parse(response.body) ``` ```json filename="Response · 200 OK" { "data": [ { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "org_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "occurred_at": "2026-09-21T15:04:05Z", "action": "audit_log.exported", "actor": { "id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "name": "string", "is_support": false }, "member_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "patient_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "conversation_id": "e5c3b7b8-8f08-4d5a-9af1-0d11b0f4b7a0", "team_id": "8b9c2d2f-6b1a-44f4-a7b1-0d6d3f2d6f55", "details": "string" } ], "pagination": { "next_cursor": null, "has_more": false } } ```