Skip to content

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

KlaviyoKlaviyoDevelopers
v2023-07-15

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

Assign Campaign Message Template

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: 2023-07-15required
Scopes
campaigns:write
Rate limits
Burst: 10/sSteady: 150/m

Headers

  • revision#stringrequired

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

    2023-07-15

Request body

Content type: application/jsonrequired

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

        The message ID to be assigned to

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

            Example: RipRmi

Responses

201

Content type: application/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#string

            The subject of the message

            Example: Buy our product!

          • preview_text#string

            Preview text associated with the message

            Example: My preview text

          • from_email#string

            The email the message should be sent from

            Example: store@my-company.com

          • from_label#string

            The label associated with the from_email

            Example: My Company

          • reply_to_email#string

            Optional Reply-To email address

            Example: reply-to@my-company.com

          • cc_email#string

            Optional CC email address

            Example: cc@my-company.com

          • bcc_email#string

            Optional BCC email address

            Example: bcc@my-company.com

        2. Option 2: SMSContentSubObject
          • body#string

            The message body

            Example: My preview sms

          • media_url#string

            URL for included media

      • send_times#object[]

        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

        • is_local#booleanrequired

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

      • render_options#object
        Show 4 fields
        • add_org_prefix#boolean

          Default: true

          Example: true

        • add_opt_out_language#boolean
      • created_at#string<date-time>

        The datetime when the message was created

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

      • updated_at#string<date-time>

        The datetime when the message was last updated

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

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

4XXClient Error

Content type: application/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/json

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