# TeraRx API > GLP-1 coaching for telehealth brands, their patients and their prescribers. - [Introduction](https://docs.tera.health/introduction.md): Coaching for patients on GLP-1 therapy, built into your telehealth brand. - [Quickstart](https://docs.tera.health/quickstart.md): Get a token, enroll a patient and call the API as a brand server, a patient and a prescriber system. - [Sandbox](https://docs.tera.health/sandbox.md): What the sandbox checks, and what it leaves to the real API. - [Authentication](https://docs.tera.health/guides/authentication.md): Client credentials for brand servers and prescriber systems, token exchange for patients. - [Platform partners](https://docs.tera.health/guides/partners.md): One integration for several brands: a token per brand, shared signing keys and webhooks. - [Webhooks](https://docs.tera.health/guides/webhooks.md): Event envelope, signature verification, retries and secret rotation. - [Conventions](https://docs.tera.health/guides/conventions.md): Versioning, formats, errors, idempotency, pagination, rate limits and privacy. - [Samples](https://docs.tera.health/samples.md): Node and Python code for the patient token, webhook verification and enrollment. - [Get an access token](https://docs.tera.health/api-reference/auth/get-an-access-token.md): **Client credentials** (brand servers and prescriber systems): authenticate with HTTP Basic (`client_id:client_secret`) and send `grant_type=client_credentials`. The token lasts 1 hour and carries the client's scopes, or the subset you ask for in `scope`. - [List the brands this client may act for](https://docs.tera.health/api-reference/tenants/list-the-brands-this-client-may-act-for.md): A platform partner's client sees every brand under the partner, whichever brand its token is for. A brand's own client sees its own brand. Use the ids as `tenant_id` on the token request and in patient assertions. A `cursor` this list did not return answers `422 validation_failed`, so a partial list… - [List enrollments](https://docs.tera.health/api-reference/enrollments/list-enrollments.md): Your brand's enrollments, newest first. Filter by `external_patient_id` to find one patient's enrollments. - [Enroll a patient](https://docs.tera.health/api-reference/enrollments/enroll-a-patient.md): Call this at checkout, or when an existing patient subscribes. In one transaction TeraRx creates the patient record for your brand (or reuses it for a returning patient), the enrollment, the consent records, the first treatment version and the onboarding form assignments from TeraRx's form rules for… - [Get an enrollment](https://docs.tera.health/api-reference/enrollments/get-an-enrollment.md): Stage, care team status, form status, protocol timestamps and risk level. No clinical content. - [Update the patient's details](https://docs.tera.health/api-reference/enrollments/update-the-patients-details.md): Contact details, demographics, time zone, conditions and the health profile, when they change in your system. Changes reach the care team at once and apply to plans and AI Coach replies generated after them. - [Change plan](https://docs.tera.health/api-reference/enrollments/change-plan.md): Move between `ai_health_fitness` and `ai_only`. Moving to `ai_only` ends the care team assignments (`care_team.changed`); moving to the coached plan queues assignment (`care_team.assigned` follows). Billing switches plan from the change. Error codes: `plan_not_offered` (422), `same_plan`, `invalid_s… - [Pause](https://docs.tera.health/api-reference/enrollments/pause.md): Paused days are not billed. The patient keeps read access to their plan; reminders and new protocols stop. The enrollment stays paused until you call resume. Fires `enrollment.paused`. Error code: `invalid_status_transition` (409) unless the enrollment is `active`. - [Resume](https://docs.tera.health/api-reference/enrollments/resume.md): Back to `active`. Fires `enrollment.resumed`. Error code: `invalid_status_transition` (409) unless the enrollment is `paused`. - [Cancel](https://docs.tera.health/api-reference/enrollments/cancel.md): Ends the enrollment and the care team assignments, and starts the retention clock for the patient's records (your contract's retention period). Fires `enrollment.cancelled`. Error code: `invalid_status_transition` (409) when the enrollment has already ended. - [Ask the AI Coach to reach out](https://docs.tera.health/api-reference/enrollments/ask-the-ai-coach-to-reach-out.md): The AI Coach starts a short check-in chat with the patient, for example after `patient.disengaged`. It goes out within minutes, outside the patient's quiet hours; you get `message.created` when it does, and send your push then. At most one request every 3 days per enrollment. Error codes: `outreach_… - [List medications](https://docs.tera.health/api-reference/treatment/list-medications.md): The GLP-1 products you can name in a treatment. The platform catalogue plus any added for your brand. - [List treatment versions](https://docs.tera.health/api-reference/treatment/list-treatment-versions.md): The mirrored treatment history, newest first. Use it to reconcile with your own records. - [Update the treatment mirror](https://docs.tera.health/api-reference/treatment/update-the-treatment-mirror.md): Send the treatment whenever your prescriber sets or changes it: a new dose, a phase change, a pause or a stop. Each call appends a version and the latest becomes current. TeraRx never changes a dose; protocols are redrafted against the new dose by the rule matrix. - [List consent records](https://docs.tera.health/api-reference/consent/list-consent-records.md): Every document the patient has accepted for this enrollment, from your checkout or from the app. - [Record consent proof](https://docs.tera.health/api-reference/consent/record-consent-proof.md): Proof that the patient accepted legal documents in your checkout, when it was not sent with the enrollment. Documents still not accepted are shown to the patient on first open (`GET /v1/patient/legal-documents`). Recording a document the patient already accepted keeps the first acceptance. Error cod… - [Send a meal log](https://docs.tera.health/api-reference/brand-logs/send-a-meal-log.md): A meal your app already recorded. Returns a receipt, not the values. A repeated `external_id` returns the first receipt with `200`. While the patient has data sharing off, the log is stored but the care team does not see it. - [Send a workout log](https://docs.tera.health/api-reference/brand-logs/send-a-workout-log.md): A workout your app already recorded. A repeated `external_id` returns the first receipt with `200`. - [Send a symptom log](https://docs.tera.health/api-reference/brand-logs/send-a-symptom-log.md): A symptom your app or clinicians already recorded. Alert rules run on it exactly as on a patient's own log, so a red flag here raises a clinical flag. A repeated `external_id` returns the first receipt with `200`. - [Send an injection log](https://docs.tera.health/api-reference/brand-logs/send-an-injection-log.md): A dose taken or missed, as your app recorded it. A repeated `external_id` returns the first receipt with `200`. - [Delete a meal log](https://docs.tera.health/api-reference/brand-logs/delete-a-meal-log.md): Deletes a meal your server sent, for example one recorded against the wrong patient. Deleting it again returns `204`. Its `external_id` stays taken: sending it again returns the deleted log's receipt, so use a new id for a replacement. Error code: `log_not_owned` (403). - [Correct a meal log](https://docs.tera.health/api-reference/brand-logs/correct-a-meal-log.md): Corrects a meal your server sent, found by your `external_id`. A log the patient made in the app can't be changed here (`403 log_not_owned`). Returns the receipt with the new `updated_at`; the values stay with the care team. Error codes: `log_not_owned` (403), `upload_not_found`, `meal_plan_item_not… - [Delete a workout log](https://docs.tera.health/api-reference/brand-logs/delete-a-workout-log.md): Deletes a workout your server sent, for example one recorded against the wrong patient. Deleting it again returns `204`. Its `external_id` stays taken: sending it again returns the deleted log's receipt, so use a new id for a replacement. Error code: `log_not_owned` (403). - [Correct a workout log](https://docs.tera.health/api-reference/brand-logs/correct-a-workout-log.md): Corrects a workout your server sent, found by your `external_id`. A log the patient made in the app can't be changed here (`403 log_not_owned`). Returns the receipt with the new `updated_at`; the values stay with the care team. Error codes: `log_not_owned` (403), `workout_plan_item_not_found` (422). - [Delete a symptom log](https://docs.tera.health/api-reference/brand-logs/delete-a-symptom-log.md): Deletes a symptom your server sent, for example one recorded against the wrong patient. Deleting it again returns `204`. Its `external_id` stays taken: sending it again returns the deleted log's receipt, so use a new id for a replacement. Editing or deleting a symptom never closes a clinical flag or… - [Correct a symptom log](https://docs.tera.health/api-reference/brand-logs/correct-a-symptom-log.md): Corrects a symptom your server sent, found by your `external_id`. A log the patient made in the app can't be changed here (`403 log_not_owned`). Returns the receipt with the new `updated_at`; the values stay with the care team. Editing or deleting a symptom never closes a clinical flag or lowers the… - [Delete an injection log](https://docs.tera.health/api-reference/brand-logs/delete-an-injection-log.md): Deletes an injection your server sent, for example one recorded against the wrong patient. Deleting it again returns `204`. Its `external_id` stays taken: sending it again returns the deleted log's receipt, so use a new id for a replacement. Changing a missed dose to taken (or back) does not close a… - [Correct an injection log](https://docs.tera.health/api-reference/brand-logs/correct-an-injection-log.md): Corrects an injection your server sent, found by your `external_id`. A log the patient made in the app can't be changed here (`403 log_not_owned`). Returns the receipt with the new `updated_at`; the values stay with the care team. Changing a missed dose to taken (or back) does not close an alert alr… - [Send daily values](https://docs.tera.health/api-reference/brand-logs/send-daily-values.md): Weight, body measures, water, steps, sleep and other daily values your app recorded. Only the fields sent change. - [Replay events](https://docs.tera.health/api-reference/events/replay-events.md): The same events as the webhooks, oldest first, for the last 30 days. After an outage, pass the id of the last event you processed as `since`, then follow `next_cursor` until it is `null`. Every event appears exactly once, in order; events outside the 30-day window are gone. Error code: `event_too_ol… - [Get an event](https://docs.tera.health/api-reference/events/get-an-event.md): One event by id, within the 30-day window. - [Get the brand report](https://docs.tera.health/api-reference/reports/get-the-brand-report.md): Enrollment counts, engagement and outcomes for a period, in total and per plan. Aggregates only, never patient-level values; any metric whose group has fewer than 10 patients is `null`. Ask for `Accept: application/pdf` for the same report as a PDF. Periods can be up to 366 days. Error code: `period… - [List data requests](https://docs.tera.health/api-reference/data-requests/list-data-requests.md): Your brand's data requests, newest first. - [Create a data request](https://docs.tera.health/api-reference/data-requests/create-a-data-request.md): A patient's request, made through you, to export, delete or amend their coaching records. Requests are processed in the background; `data_request.completed` fires when done. Error codes: `data_request_in_progress` (409) for a second open request of the same kind, `validation_failed` (422). - [Get a data request](https://docs.tera.health/api-reference/data-requests/get-a-data-request.md): Status, and for exports whether the download is ready. - [Get a download link](https://docs.tera.health/api-reference/data-requests/get-a-download-link.md): A short-lived link to the export file. Ask for a new link each time you download; the file itself stays until `export.expires_at`. Error codes: `export_not_ready` (409), `export_expired` (410). - [Decide an amendment](https://docs.tera.health/api-reference/data-requests/decide-an-amendment.md): Accept or deny an `amend` request within 60 days of `requested_at`. A denial needs `decision_note` (HIPAA requires the reason). Accepting applies the change and records the previous value in the record history. Error codes: `not_an_amend_request`, `already_decided` (409). - [Get my profile](https://docs.tera.health/api-reference/patient/get-my-profile.md): The patient's profile, plan, care team and brand details. Call it first after the token exchange. - [Update my profile](https://docs.tera.health/api-reference/patient/update-my-profile.md): Height; the health profile (activity level, food allergies, dietary restrictions, food dislikes, cooking and lifestyle); time zone, language, display units and data sharing. Changes apply to plans and AI Coach replies generated after them. Turning `data_sharing` off is recorded on the enrollment his… - [Get my treatment](https://docs.tera.health/api-reference/patient/get-my-treatment.md): The current GLP-1 medication, dose and treatment week. Error code `treatment_not_found` (404) before one is set. - [Report my treatment (TeraRx Direct)](https://docs.tera.health/api-reference/patient/report-my-treatment-terarx-direct.md): Direct patients self-report the GLP-1 they take. Brand patients' treatment comes from the brand's prescriber, so this returns `403 treatment_managed_by_brand` for them. - [List my legal documents](https://docs.tera.health/api-reference/patient/list-my-legal-documents.md): The current version of every document that applies to the patient, with whether they accepted it. On first open, ask for acceptance of each one with `required_on_first_open` and no `accepted_at` before showing coaching screens. - [Accept a legal document](https://docs.tera.health/api-reference/patient/accept-a-legal-document.md): Records the patient's acceptance in the app. Accepting a document already accepted returns the existing record with `200`. Error code: `unknown_legal_document` (422). - [List my forms](https://docs.tera.health/api-reference/forms/list-my-forms.md): Forms sent to the patient, newest first. By default only open ones (`sent`, `in_progress`). - [Get a form](https://docs.tera.health/api-reference/forms/get-a-form.md): The form's fields at the version it was sent with, the prefill from the brand's intake and any saved draft. - [Save a draft](https://docs.tera.health/api-reference/forms/save-a-draft.md): Saves partial answers so the patient can finish later; the status becomes `in_progress`. Each call replaces the previous draft. Error code: `form_not_open` (409) once completed, expired or cancelled. - [Submit a form](https://docs.tera.health/api-reference/forms/submit-a-form.md): Validates every answer against the fields (required, type, options, range) and completes the form. When the last blocking form is completed the enrollment moves to `onboarding_completed` (`onboarding.completed`). Answers to health profile questions (allergies, dietary restrictions, activity level, c… - [List my daily logs](https://docs.tera.health/api-reference/logging/list-my-daily-logs.md): One row per day with the patient's daily values and the rollups from meals, workouts and symptoms. - [Log daily values](https://docs.tera.health/api-reference/logging/log-daily-values.md): Water, weight and body measures, steps, sleep, mood, stress, energy, habit check-offs and any other metric for one day. Only the fields sent change. Dates more than 30 days back or in the future are refused (`log_date_out_of_range`, 422). - [Start a meal photo upload](https://docs.tera.health/api-reference/logging/start-a-meal-photo-upload.md): Returns a pre-signed URL. Upload the photo there, then send `upload_id` as `photo_upload_id` on the meal log. An upload not attached to a meal within 1 hour is deleted. - [Analyze a meal photo](https://docs.tera.health/api-reference/logging/analyze-a-meal-photo.md): The AI Coach estimates the meal in an uploaded photo: what it is, its ingredients and their macros. Show the result as an editable form, then save it with `POST /v1/patient/meals`, sending the same `photo_upload_id` and `entry_method: photo_ai`. Takes a few seconds. Asking again for the same upload… - [List my recent foods](https://docs.tera.health/api-reference/logging/list-my-recent-foods.md): Foods the patient logged before, most recently logged first, 10 at a time; follow `next_cursor` for the next 10. Picking one pre-fills a meal ingredient with the amount and macros from the last time. Correcting or deleting a meal updates the list. - [List my meals](https://docs.tera.health/api-reference/logging/list-my-meals.md): Meal logs in a date range, newest first. - [Log a meal](https://docs.tera.health/api-reference/logging/log-a-meal.md): Macros are optional; send what you have. Updates the day's protein, calorie and fiber rollups. Error codes: `upload_not_found` (422) for an unknown or expired `photo_upload_id`, `meal_plan_item_not_found` (422). - [Delete a meal log](https://docs.tera.health/api-reference/logging/delete-a-meal-log.md): Deletes a meal logged by mistake. It leaves lists and the day's rollups at once; its history is kept until the brand's retention period ends. Deleting it again returns `204`. Only logs made in the app can be deleted. Error code: `log_not_owned` (403). - [Correct a meal log](https://docs.tera.health/api-reference/logging/correct-a-meal-log.md): Changes a meal the patient logged. Only logs made in the app can be changed; a log the brand's server sent returns `403 log_not_owned`. The previous version is kept in the record's history, and the day's rollups are recalculated (for both days if the meal moves to another day). Error codes: `log_not… - [List my workouts](https://docs.tera.health/api-reference/logging/list-my-workouts.md): Workout logs in a date range, newest first. - [Log a workout](https://docs.tera.health/api-reference/logging/log-a-workout.md): Updates the day's workout minutes. Link `workout_plan_item_id` when the workout came from the plan. - [Delete a workout log](https://docs.tera.health/api-reference/logging/delete-a-workout-log.md): Deletes a workout logged by mistake. It leaves lists and the day's rollups at once; its history is kept until the brand's retention period ends. Deleting it again returns `204`. Only logs made in the app can be deleted. Error code: `log_not_owned` (403). - [Correct a workout log](https://docs.tera.health/api-reference/logging/correct-a-workout-log.md): Changes a workout the patient logged. Only logs made in the app can be changed; a log the brand's server sent returns `403 log_not_owned`. The previous version is kept in the record's history, and the day's rollups are recalculated (for both days if the workout moves to another day). Error codes: `l… - [List my symptoms](https://docs.tera.health/api-reference/logging/list-my-symptoms.md): Symptom logs in a date range, newest first. - [Log a symptom](https://docs.tera.health/api-reference/logging/log-a-symptom.md): Severity 1 (mild) to 5 (severe). Alert rules run on every symptom: a red flag or a severe GI episode raises a clinical flag (to the coach on the coached plan, to the brand's prescriber on `ai_only`). When the response has `is_red_flag: true`, show the emergency guidance (call 911, or 988 for a menta… - [Delete a symptom log](https://docs.tera.health/api-reference/logging/delete-a-symptom-log.md): Deletes a symptom logged by mistake. It leaves lists and the day's rollups at once; its history is kept until the brand's retention period ends. Deleting it again returns `204`. Only logs made in the app can be deleted. Editing or deleting a symptom never closes a clinical flag or lowers the risk le… - [Correct a symptom log](https://docs.tera.health/api-reference/logging/correct-a-symptom-log.md): Changes a symptom the patient logged. Only logs made in the app can be changed; a log the brand's server sent returns `403 log_not_owned`. The previous version is kept in the record's history, and the day's rollups are recalculated (for both days if the symptom moves to another day). Editing or dele… - [List my injections](https://docs.tera.health/api-reference/logging/list-my-injections.md): Injection logs in a date range, newest first. - [Log an injection](https://docs.tera.health/api-reference/logging/log-an-injection.md): A dose taken (`injected_at`) or missed (`missed: true`). A missed dose can raise a `missed_injection` alert. Error code: `injection_incomplete` (422) when the log is neither taken nor missed. - [Delete an injection log](https://docs.tera.health/api-reference/logging/delete-an-injection-log.md): Deletes an injection logged by mistake. It leaves lists and the day's rollups at once; its history is kept until the brand's retention period ends. Deleting it again returns `204`. Only logs made in the app can be deleted. Changing a missed dose to taken (or back) does not close an alert already rai… - [Correct an injection log](https://docs.tera.health/api-reference/logging/correct-an-injection-log.md): Changes an injection the patient logged. Only logs made in the app can be changed; a log the brand's server sent returns `403 log_not_owned`. The previous version is kept in the record's history, and the day's rollups are recalculated (for both days if the dose moves to another day). Changing a miss… - [Get today](https://docs.tera.health/api-reference/progress/get-today.md): What the home screen needs for the patient's today, in their time zone: targets against what's logged so far, the plan's meals and workouts for the day, habits, the next reminder, recent milestones, and counts of open forms, unread care messages and legal documents to accept. - [Get targets and progress for a day](https://docs.tera.health/api-reference/progress/get-targets-and-progress-for-a-day.md): The targets from the protocols in force on `date`, with what that day's logs add up to. Metric codes are the protocol targets' codes, so a new metric needs no app change to show. Error code: `date_out_of_range` (422) for a day before the enrollment or in the future. - [Get a week's stats](https://docs.tera.health/api-reference/progress/get-a-weeks-stats.md): A summary of one week of treatment, numbered like `treatment_week` on `GET /v1/patient/treatment`: week 1 starts on the treatment's `started_on`. Defaults to the current week, counted up to today. Error code: `week_not_available` (404) for a week before the enrollment, after the current one, or befo… - [List my milestones](https://docs.tera.health/api-reference/progress/list-my-milestones.md): Every milestone the patient reached in this enrollment, newest first. Your server hears about a new one from `patient.milestone_reached`, so the app can celebrate it. - [Get a milestone](https://docs.tera.health/api-reference/progress/get-a-milestone.md): The milestone with the patient's own numbers, for a celebration screen after `patient.milestone_reached`. - [List my active protocols](https://docs.tera.health/api-reference/protocols-and-plans/list-my-active-protocols.md): At most one active protocol per type (nutrition, fitness, sleep, stress, lifestyle, supplements). - [Get my active protocol of a type](https://docs.tera.health/api-reference/protocols-and-plans/get-my-active-protocol-of-a-type.md): Error code: `protocol_not_found` (404) when there is no active protocol of this type yet. - [List versions of a protocol](https://docs.tera.health/api-reference/protocols-and-plans/list-versions-of-a-protocol.md): The active version and the superseded ones before it. - [Get one version of a protocol](https://docs.tera.health/api-reference/protocols-and-plans/get-one-version-of-a-protocol.md): Any published version, active or superseded. - [Get my meal plan](https://docs.tera.health/api-reference/protocols-and-plans/get-my-meal-plan.md): The active meal plan, day by day, including any swapped meals. Error code `meal_plan_not_found` (404). - [Get my workout plan](https://docs.tera.health/api-reference/protocols-and-plans/get-my-workout-plan.md): The active workout plan, day by day. Error code `workout_plan_not_found` (404). - [Rate a meal on my plan](https://docs.tera.health/api-reference/protocols-and-plans/rate-a-meal-on-my-plan.md): 1 to 5 stars with an optional comment, shown on the plan as `my_rating`; rating again replaces it. Coaches see it, and new plans, swaps and the AI Coach avoid meals rated 1 or 2. To rate the recipe itself wherever it appears, use `PUT /v1/patient/library/{library_item_id}/rating`. - [Clear a meal rating](https://docs.tera.health/api-reference/protocols-and-plans/clear-a-meal-rating.md): Clearing a rating that isn't there changes nothing. - [Ask the AI Coach for swap options](https://docs.tera.health/api-reference/meal-swap/ask-the-ai-coach-for-swap-options.md): The AI Coach proposes replacements for one meal and keeps only those that stay within the protocol's targets and the brand's rule matrix (allergies, foods to avoid, calorie floor). Takes a few seconds. Options expire after 30 minutes. Counts toward the plan's daily AI Coach cap. - [Swap a meal](https://docs.tera.health/api-reference/meal-swap/swap-a-meal.md): Replaces the meal with one of the options. The original meal and the reason are kept on the item and shown to the care team. Error codes: `swap_option_expired` (409), `swap_option_not_found` (422). - [Browse recipes and exercises](https://docs.tera.health/api-reference/library/browse-recipes-and-exercises.md): Searches the recipes and exercises the patient can see, alphabetically. Recipes that contain one of the patient's food allergies, or don't fit one of their dietary restrictions, are never returned. Food dislikes are not filtered. - [Get a recipe or exercise](https://docs.tera.health/api-reference/library/get-a-recipe-or-exercise.md): The full recipe or exercise, for example from a meal plan's `recipe_id` or a workout's `exercise_id`. Unlike the list, this returns the item whatever the patient's profile; use `recipe.allergens` to warn them. - [Save a recipe or exercise](https://docs.tera.health/api-reference/library/save-a-recipe-or-exercise.md): Adds it to the patient's favorites (`GET /v1/patient/library?favorites=true`). Saving it again changes nothing. - [Remove a favorite](https://docs.tera.health/api-reference/library/remove-a-favorite.md): Removing one that isn't saved changes nothing. - [Rate a recipe](https://docs.tera.health/api-reference/library/rate-a-recipe.md): 1 to 5 stars with an optional comment; rating again replaces it. New meal plans, swaps and the AI Coach avoid recipes rated 1 or 2, and coaches see the ratings. After a low rating the app can offer to add a food dislike with `PATCH /v1/patient`. Error code: `not_a_recipe` (422) for an exercise. - [Clear a recipe rating](https://docs.tera.health/api-reference/library/clear-a-recipe-rating.md): Clearing a rating that isn't there changes nothing. - [List my care threads](https://docs.tera.health/api-reference/care-messaging/list-my-care-threads.md): One thread per coach on the care team, with unread counts. - [List messages in a care thread](https://docs.tera.health/api-reference/care-messaging/list-messages-in-a-care-thread.md): Newest first. New messages are announced by `message.created`; fetch them here. - [Message my coach](https://docs.tera.health/api-reference/care-messaging/message-my-coach.md): Text, a photo, or both. For a photo, start an upload with `POST /v1/patient/message-photos`, upload it, then send its `upload_id` as `photo_upload_id`. Coaching is not emergency care. Show the 911 and 988 guidance next to the message box: coaches do not answer around the clock. Error codes: `convers… - [Mark a care thread read](https://docs.tera.health/api-reference/care-messaging/mark-a-care-thread-read.md): Moves the patient's read marker. The coach sees their messages as seen. - [Edit my last message](https://docs.tera.health/api-reference/care-messaging/edit-my-last-message.md): Changes the text of the patient's most recent message in a care thread. Only that one can be edited, and only in care threads (AI Coach replies are written from what the patient sent). The coach sees it marked as edited, and the previous text is kept in the record's history. Error codes: `not_last_m… - [Set my reactions on a message](https://docs.tera.health/api-reference/care-messaging/set-my-reactions-on-a-message.md): Replaces the patient's reactions on any message in their care or AI Coach threads. Send `[]` to remove them. - [Start a photo upload for my coach](https://docs.tera.health/api-reference/care-messaging/start-a-photo-upload-for-my-coach.md): Returns a pre-signed URL. Upload the photo there, then send `upload_id` as `photo_upload_id` with the message. An upload not sent within 1 hour is deleted. The coach sees the photo in the thread; the patient's copy comes back as an `image` attachment with a short-lived `url`. - [List open feedback popups](https://docs.tera.health/api-reference/feedback/list-open-feedback-popups.md): Popups waiting for an answer, oldest first. `care_team.feedback_due` tells your server when one opens; check here too, for example when the app opens, in case a webhook was missed. - [Get a feedback popup](https://docs.tera.health/api-reference/feedback/get-a-feedback-popup.md): The popup's title, questions and the coach it is about. TeraRx writes the questions; render each one by its `kind`. Don't show a popup whose `status` is no longer `requested`. - [Answer a feedback popup](https://docs.tera.health/api-reference/feedback/answer-a-feedback-popup.md): Checks each answer against its question: every `required` question answered, ratings from 1 to `scale_max`, thumbs `up` or `down`, choices among the `options`, text within `max_length`. The answers go to TeraRx, which uses them to support its coaches. Error codes: `validation_failed` (422, with a po… - [Dismiss a feedback popup](https://docs.tera.health/api-reference/feedback/dismiss-a-feedback-popup.md): The patient closed the popup without answering; it won't be offered again. Error code: `feedback_request_closed` (409) once answered, dismissed or expired. - [List my AI Coach chats](https://docs.tera.health/api-reference/ai-coach/list-my-ai-coach-chats.md): The patient's chats with the AI Coach, most recent first. A patient can have many. - [Start an AI Coach chat](https://docs.tera.health/api-reference/ai-coach/start-an-ai-coach-chat.md): Opens a new chat. The AI Coach remembers confirmed preferences across chats. - [List messages in an AI Coach chat](https://docs.tera.health/api-reference/ai-coach/list-messages-in-an-ai-coach-chat.md): Newest first, the patient's messages and the AI Coach's replies. - [Message the AI Coach](https://docs.tera.health/api-reference/ai-coach/message-the-ai-coach.md): Stores the patient's message and starts the AI Coach's reply. The response has the stored message and the reply in `pending`; get the reply with `GET /v1/patient/ai-coach/messages/{message_id}/reply`, by polling or as a stream. - [Get the AI Coach's reply](https://docs.tera.health/api-reference/ai-coach/get-the-ai-coachs-reply.md): `message_id` is the patient's message. Two ways to read the reply: - [Rate an AI Coach reply](https://docs.tera.health/api-reference/ai-coach/rate-an-ai-coach-reply.md): Thumbs up or down on one of the AI Coach's messages, with an optional note. Rating again replaces it. Error code `not_an_ai_message` (422). - [List what the AI Coach remembers](https://docs.tera.health/api-reference/ai-coach/list-what-the-ai-coach-remembers.md): Things the AI Coach remembers from the patient's chats, such as foods they dislike or when they like to work out, so the patient can check them. Brands never see them. - [Forget a memory](https://docs.tera.health/api-reference/ai-coach/forget-a-memory.md): The AI Coach stops using it at once. Deleting it again returns `204`. - [Confirm a memory](https://docs.tera.health/api-reference/ai-coach/confirm-a-memory.md): The patient confirms that a memory is right (or takes the confirmation back). To correct a memory, delete it and tell the AI Coach. - [List my reminders](https://docs.tera.health/api-reference/reminders/list-my-reminders.md): Injection days, check-in forms, logging nudges and habits. Brand apps also receive `reminder.due` and send the notification in their own words; this list is for showing what is coming. - [Snooze a reminder](https://docs.tera.health/api-reference/reminders/snooze-a-reminder.md): Moves a scheduled or just-sent reminder later by `minutes` (5 minutes to 24 hours). Error code `reminder_not_snoozable` (409) once cancelled. - [Get my reminder settings](https://docs.tera.health/api-reference/reminders/get-my-reminder-settings.md): Which reminders are on, when they are sent, and quiet hours. Anything the patient has not set shows the brand's default. - [Change my reminder settings](https://docs.tera.health/api-reference/reminders/change-my-reminder-settings.md): Turning a kind off cancels its scheduled reminders and stops `reminder.due` for it, so a brand app sends fewer notifications too; turning it back on schedules the next one. A new time applies from the next reminder. The settings belong to the patient and carry over to a later enrollment with the sam… - [List clinical flags](https://docs.tera.health/api-reference/clinical-flags/list-clinical-flags.md): Your brand's flags, oldest first so the longest-waiting come first. By default only those needing action (`open` and `acknowledged`). On the AI-only plan every escalation lands here, so poll this as a backstop to the `clinical.flag_raised` webhook. - [Get a clinical flag](https://docs.tera.health/api-reference/clinical-flags/get-a-clinical-flag.md): Symptom, severity, the triggering records, a timeline around them, the treatment and any coach note. - [Acknowledge a flag](https://docs.tera.health/api-reference/clinical-flags/acknowledge-a-flag.md): Tells TeraRx a prescriber has the flag, which stops re-delivery. It does not change risk. Acknowledging again returns the flag unchanged. Fires `clinical.flag_acknowledged`. Error codes: `flag_closed` (409) once resolved or dismissed, `validation_failed` (422) without `name` and `npi` or `prescriber… - [Resolve a flag](https://docs.tera.health/api-reference/clinical-flags/resolve-a-flag.md): Records the prescriber's decision and sets the enrollment's risk level to `new_risk_level`. This is the only way risk goes down. Resolving an open flag acknowledges it too. Fires `clinical.flag_resolved`. Error codes: `flag_closed` (409) once resolved or dismissed, `validation_failed` (422). - [Enrollmentcreated](https://docs.tera.health/api-reference/webhooks/enrollmentcreated.md): A new enrollment, after `POST /v1/enrollments` (or a TeraRx Direct signup). - [Enrollmentstage changed](https://docs.tera.health/api-reference/webhooks/enrollmentstage_changed.md): The enrollment moved along `created → awaiting_assignment → assigned → onboarding_pending → onboarding_completed → protocols_active`. - [Enrollmentpaused](https://docs.tera.health/api-reference/webhooks/enrollmentpaused.md): The enrollment was paused. Paused days are not billed. - [Enrollmentresumed](https://docs.tera.health/api-reference/webhooks/enrollmentresumed.md): The enrollment is active again. - [Enrollmentcancelled](https://docs.tera.health/api-reference/webhooks/enrollmentcancelled.md): The enrollment ended. The retention period for the patient's records starts. - [Care teamassigned](https://docs.tera.health/api-reference/webhooks/care_teamassigned.md): A coach was assigned to a care role (coached plan). Coach identity is not sent. - [Care teamchanged](https://docs.tera.health/api-reference/webhooks/care_teamchanged.md): A care role was reassigned to another coach, or ended (for example on a move to `ai_only`). `reason_code` says why, for example `state_change` after you updated the patient's state. - [Care teamcapacity warning](https://docs.tera.health/api-reference/webhooks/care_teamcapacity_warning.md): No coach with a license in the patient's state and free capacity is available, so the enrollment is waiting. Brands on `brand_coaches` never fall back to the TeraRx pool. - [Care teamfeedback due](https://docs.tera.health/api-reference/webhooks/care_teamfeedback_due.md): TeraRx would like the patient's feedback on the coach in `care_role`. Show your feedback popup: read its content with `GET /v1/patient/feedback-requests/{feedback_request_id}` and send the answers with `POST /v1/patient/feedback-requests/{feedback_request_id}/response`. TeraRx decides when to ask. - [Formrequested](https://docs.tera.health/api-reference/webhooks/formrequested.md): A form was sent to the patient. Prompt them in your app; they fill it in with `GET /v1/patient/forms/{form_assignment_id}`. - [Onboardingcompleted](https://docs.tera.health/api-reference/webhooks/onboardingcompleted.md): Every blocking onboarding form is done. Protocol drafting starts. - [Protocolpublished](https://docs.tera.health/api-reference/webhooks/protocolpublished.md): The first version of a protocol type is live. The patient reads it with `GET /v1/patient/protocols/{protocol_type}`. - [Protocolupdated](https://docs.tera.health/api-reference/webhooks/protocolupdated.md): A new version replaced the active protocol of a type (for example after a dose change). - [Messagecreated](https://docs.tera.health/api-reference/webhooks/messagecreated.md): A new message in a care thread or from the AI Coach, so your app can notify the patient. Ids only: the body is never sent. Keep push notification text generic ("You have a new message"). - [Clinicalflag raised](https://docs.tera.health/api-reference/webhooks/clinicalflag_raised.md): A clinical flag for your prescriber. Read it with the clinical client (`GET /v1/clinical-flags/{flag_id}`) and acknowledge it before `ack_due_at`. - [Clinicalflag redelivered](https://docs.tera.health/api-reference/webhooks/clinicalflag_redelivered.md): A flag passed its `ack_due_at` without an acknowledgement. It stays open, gets a new deadline and is sent again with a new event id (so your dedupe does not drop it), until a prescriber acknowledges it. Escalate internally. - [Clinicalflag acknowledged](https://docs.tera.health/api-reference/webhooks/clinicalflag_acknowledged.md): A prescriber acknowledged the flag. Re-delivery stops. - [Clinicalflag resolved](https://docs.tera.health/api-reference/webhooks/clinicalflag_resolved.md): A prescriber resolved the flag and set the enrollment's risk level to `new_risk_level`. - [Patientdisengaged](https://docs.tera.health/api-reference/webhooks/patientdisengaged.md): No logs or messages for your brand's `disengaged_after_days` (7 by default). A nudge from your app may help. - [Patientmilestone reached](https://docs.tera.health/api-reference/webhooks/patientmilestone_reached.md): The patient reached a milestone. Celebrate it in your app: read the personal details with `GET /v1/patient/milestones/{milestone_id}` using the patient's token. Keep any push text generic. - [Reminderdue](https://docs.tera.health/api-reference/webhooks/reminderdue.md): A reminder is due. Send the notification in your own words, with no health details in the push text. - [Data requestcompleted](https://docs.tera.health/api-reference/webhooks/data_requestcompleted.md): A data request finished. For an export, get a download link with `POST /v1/data-requests/{data_request_id}/export-link`. ## OpenAPI Specs - [openapi](/openapi.json) This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.