---
title: "Update a message fragment"
method: PUT
path: "/shop/message-fragments/{messageFragmentId}"
tags: ["MessageFragments"]
---

# Update a message fragment

`PUT /shop/message-fragments/{messageFragmentId}`

Updates an existing message fragment. Omitting
`permitted_membership_type_ids` (or sending an empty array)
clears the membership filter so the fragment becomes available
to all customers; supply the field with the desired IDs to keep
or change the restriction. Requires the `SETTINGS_MANAGE`
permission on the fragment's site.

## Request body

- object
  - `name` string, required — Internal label for the fragment, shown in the admin UI when authoring email templates. Not visible to customers.
  - `message_type` 'basket_cancelled' | 'basket_confirmed' | 'basket_follow_up' | 'basket_item_cancelled' | 'basket_reminder' | 'order_summary' | 'pay_by_link_request' | 'appointment_enquiry_confirmed' | 'visit_prompt' | 'membership_welcome' | 'membership_cancelled' | 'voucher_recipient' | 'membership_enquiry_confirmed' | 'new_order' | 'new_enquiry' — Which transactional email this fragment is included in.
  - `message` string, nullable — Body of the fragment. Accepts a restricted subset of HTML and is sanitised on save. Liquid-style placeholders are interpolated at send time.
  - `priority` integer, nullable — Render order within a message. Fragments are concatenated in ascending `priority` order.
  - `offerings` OfferingIdentifier[] — Offerings the fragment applies to. Empty means the fragment applies to every offering at the site.
    - `offering_id` string, mongo-id, required — The ID of the offering.
    - `offering_name` string, required — The name of the offering.
    - `offering_type` 'appointment' | 'appointment_enquiry' | 'area_booking' | 'course' | 'hotel_room_reservation' | 'membership' | 'package' | 'product' | 'session' | 'table_reservation' | 'voucher', required — Discriminator describing what kind of sellable item an `Offering` represents. The value determines which downstream schema (`Appointment`, `Session`, `Package`, etc.) the offering's `offering_id` resolves against, and which checkout/booking flow applies.
  - `permitted_membership_type_ids` string[], nullable — `MembershipType` IDs the fragment is restricted to. Omit (or send an empty array) to clear the membership filter; the field is reset when not present in the request body.

## Response `200`

The message fragment was successfully retrieved.

- object
  - `data` MessageFragment, required — A `MessageFragment` is a reusable block of HTML/Markdown content that is concatenated into transactional emails (booking confirmations, reminders, follow-ups, etc.). Fragments are scoped to a site, can be filtered by `message_type`, and can be limited to specific offerings or membership types so that copy is tailored to the customer's context. At send time, the messaging pipeline pulls every fragment whose `message_type` matches the message being sent and whose `offerings` and `permitted_membership_type_ids` filters are satisfied, sorts them by ascending `priority`, and renders them inline into the email body.
    - `id` string, mongo-id, required — Unique identifier of the message fragment.
    - `name` string, required — Internal label for the fragment, shown in the admin UI when authoring email templates. Not visible to customers.
    - `message_type` 'basket_cancelled' | 'basket_confirmed' | 'basket_follow_up' | 'basket_item_cancelled' | 'basket_reminder' | 'order_summary' | 'pay_by_link_request' | 'appointment_enquiry_confirmed' | 'visit_prompt' | 'membership_welcome' | 'membership_cancelled' | 'voucher_recipient' | 'membership_enquiry_confirmed' | 'new_order' | 'new_enquiry', required — Which transactional email this fragment is included in. Fragments are only rendered into the matching message type.
    - `message` string, nullable, required — The body of the fragment. Accepts a restricted subset of HTML (basic block and inline tags) which is sanitised on save. Liquid-style placeholders such as `{{ customer.first_name }}` and `{{ booking.starts_at }}` are interpolated when the email is rendered.
    - `priority` integer, nullable, required — Render order within a message. Fragments are concatenated in ascending `priority` order, so lower numbers appear earlier in the email body. Use to control which paragraph leads.
    - `offerings` OfferingIdentifier[], required — Offerings this fragment applies to. When empty, the fragment applies to every offering at the site (a global fallback). When non-empty, the fragment is only included if the message's booking contains at least one matching offering.
      - `offering_id` string, mongo-id, required — The ID of the offering.
      - `offering_name` string, required — The name of the offering.
      - `offering_type` 'appointment' | 'appointment_enquiry' | 'area_booking' | 'course' | 'hotel_room_reservation' | 'membership' | 'package' | 'product' | 'session' | 'table_reservation' | 'voucher', required — Discriminator describing what kind of sellable item an `Offering` represents. The value determines which downstream schema (`Appointment`, `Session`, `Package`, etc.) the offering's `offering_id` resolves against, and which checkout/booking flow applies.
    - `permitted_membership_type_ids` string[], nullable, required — Optional list of `MembershipType` IDs. When set, the fragment is only rendered for customers who hold an active membership of one of these types - useful for member-only welcome copy, loyalty perks, or upgrade prompts. Empty/null means no membership filter applies.
    - `site_id` string, uuid, required — Site the fragment belongs to. Fragments are authored per-site so each location can tailor its email copy.
    - `organisation_id` string, uuid, required — Organisation that owns the site.

## Other responses

- `401` — The user is unauthenticated
- `403` — The authenticated user does not have permission.
- `404` — The resource couldn't be found
- `422` — The request didn't pass validation

---

[API](https://skmtc.dev/try/apis/trybe-api.md) · [All operations](https://skmtc.dev/try/apis/trybe-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/try/trybe-api/revisions/f37f92702da5/schema)
