Skip to content

This page is available as Markdown at https://developers.klaviyo.com/en/v2025-01-15/reference/assign_template_to_campaign_message.md. An index of every page is at https://developers.klaviyo.com/llms.txt.

KlaviyoKlaviyoDevelopers
v2025-01-15

You're reading the reference for API revision 2025-01-15. The latest revision is 2026-10-15. See this page in the latest revision.

Assign Template to Campaign Message

POSThttps://a.klaviyo.com/api/campaign-message-assign-template

Creates a non-reusable version of the template and assigns it to the message.

Revision header
revision: 2025-01-15required
Scopes
campaigns:write
Rate limits
Burst: 10/sSteady: 150/m

Headers

  • revision#stringrequired

    API endpoint revision (format: YYYY-MM-DD[.suffix])

    2025-01-15

Request body

Content type: application/vnd.api+jsonrequired

  • data#objectrequired
    Show 3 fields
    • type#stringrequired
      Allowed values:
      • campaign-message
    • id#stringrequired

      The message ID to be assigned to

    • relationships#objectrequired
      Show 1 field
      • template#objectrequired
        Show 1 field
        • data#object
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • template
          • id#stringrequired

            The template ID to assign

            Example: RipRmi

Responses

201Success

Content type: application/vnd.api+json

  • data#objectrequired
    Show 5 fields
    • type#stringrequired
      Allowed values:
      • campaign-message
    • id#stringrequired

      The message ID

    • attributes#objectrequired
      Show 7 fields
      • label#stringrequired

        The label or name on the message

      • channel#stringrequired

        The channel the message is to be sent on

      • content#oneOfrequired

        Additional attributes relating to the content of the message

        One of:

        1. Option 1: EmailContentSubObject
          • subject#stringnullable

            The subject of the message

            Example: Buy our product!

          • preview_text#stringnullable

            Preview text associated with the message

            Example: My preview text

          • from_email#stringnullable

            The email the message should be sent from

            Example: store@my-company.com

          • from_label#stringnullable

            The label associated with the from_email

            Example: My Company

          • reply_to_email#stringnullable

            Optional Reply-To email address

            Example: reply-to@my-company.com

          • cc_email#stringnullable

            Optional CC email address

            Example: cc@my-company.com

          • bcc_email#stringnullable

            Optional BCC email address

            Example: bcc@my-company.com

        2. Option 2: SMSContentSubObject
          • body#stringnullable

            The message body

            Example: My preview sms

          • media_url#stringnullable

            URL for included media

      • send_times#object[]nullable

        The list of appropriate Send Time Sub-objects associated with the message

        Show 2 fields
        • datetime#string<date-time>required

          The datetime that the message is to be sent

          Example: 2022-11-08T00:00:00+00:00

        • is_local#booleanrequired

          Whether that datetime is to be a local datetime for the recipient

      • render_options#object
        Show 4 fields
        • add_org_prefix#booleannullable

          Default: true

          Example: true

        • add_opt_out_language#booleannullable

          Default: false

      • created_at#string<date-time>nullable

        The datetime when the message was created

        Example: 2022-11-08T00:00:00+00:00

      • updated_at#string<date-time>nullable

        The datetime when the message was last updated

        Example: 2022-11-08T00:00:00+00:00

    • relationships#object
      Show 2 fields
      • campaign#object
        Show 2 fields
        • data#object
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • campaign
          • id#stringrequired

            The parent campaign id

      • template#object
        Show 2 fields
        • data#object
          Show 2 fields
          • type#stringrequired
            Allowed values:
            • template
          • id#stringrequired

            The associated template id

4XXClient Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string

5XXServer Error

Content type: application/vnd.api+json

  • errors#object[]required
    Show 5 fields
    • id#stringrequired
    • code#stringrequired
    • title#stringrequired
    • detail#stringrequired
    • source#object
      Show 2 fields
      • pointer#string
      • parameter#string