---
title: "Assign Template to Campaign Message"
description: "How to call Assign Template to Campaign Message (POST /api/campaign-message-assign-template) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/v2026-07-15/reference/assign_template_to_campaign_message"
revision: "2026-07-15"
latestUrl: "https://developers.klaviyo.com/en/reference/assign_template_to_campaign_message"
operationId: "assign_template_to_campaign_message"
aliases: ["create_campaign_message_assign_template"]
method: "POST"
endpoint: "https://a.klaviyo.com/api/campaign-message-assign-template"
authentication: "privateKey"
scopes: ["campaigns:write"]
rateLimits: {"burst":"10/s","steady":"150/m"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json"
jsonApi: {"fields":{"campaign-message":["channel","content","content.bcc_email","content.body","content.cc_email","content.from_email","content.from_label","content.media_url","content.preview_text","content.reply_to_email","content.subject","created_at","id","label","render_options","render_options.add_info_link","render_options.add_opt_out_language","render_options.add_org_prefix","render_options.shorten_links","send_times","updated_at"]}}
related: ["https://developers.klaviyo.com/en/v2026-07-15/reference/campaigns/llms.txt","https://developers.klaviyo.com/en/v2026-07-15/reference/get_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/update_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_campaign_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_campaign_id_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_template_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_template_id_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_image_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/get_image_id_for_campaign_message.md","https://developers.klaviyo.com/en/v2026-07-15/reference/update_image_for_campaign_message.md"]
---

# Assign Template to Campaign Message

> This is the Markdown version of https://developers.klaviyo.com/en/v2026-07-15/reference/assign_template_to_campaign_message

```http
POST https://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: 2026-07-15` (required)
- Scopes: `campaigns:write`
- Rate limits: Burst: `10/s`, Steady: `150/m`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json)

## Example request

```bash
curl --request POST \
     --url 'https://a.klaviyo.com/api/campaign-message-assign-template' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "campaign-message",
    "id": "string",
    "relationships": {
      "template": {}
    }
  }
}'
```

## Query parameters

- `fields[campaign-message]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/v2026-07-15/reference.md) Allowed values: `channel`, `content`, `content.bcc_email`, `content.body`, `content.cc_email`, `content.from_email`, `content.from_label`, `content.media_url`, `content.preview_text`, `content.reply_to_email`, `content.subject`, `created_at`, `id`, `label`, `render_options`, `render_options.add_info_link`, `render_options.add_opt_out_language`, `render_options.add_org_prefix`, `render_options.shorten_links`, `send_times`, `updated_at`

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2026-07-15`

## Request body

Content type: `application/vnd.api+json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `campaign-message`
  - `id` (string, required): The message ID to be assigned to
  - `relationships` (object, required)
    - `template` (object, required)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).

### Example request body

```json
{
  "data": {
    "type": "campaign-message",
    "id": "string",
    "relationships": {
      "template": {}
    }
  }
}
```

## Responses

### 200: Success

Content type: `application/vnd.api+json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `campaign-message`
  - `id` (string, required): The message ID
  - `attributes` (object, required)
    - `label` (string, required): The label or name on the message
    - `channel` (string, required): The channel the message is to be sent on
    - `content` (oneOf, required): Additional attributes relating to the content of the message
      - One of:
        - Option 1: `EmailContentSubObject` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
        - Option 2: `SMSContentSubObject` Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
    - `send_times` (object[], nullable): The list of appropriate Send Time Sub-objects associated with the message
      - `datetime` (string<date-time>, required): The datetime that the message is to be sent Example: `2022-11-08T00:00:00+00:00`
      - `is_local` (boolean, required): Whether that datetime is to be a local datetime for the recipient
    - `render_options` (object)
      - `shorten_links` (boolean, nullable): Default: `true` Example: `true`
      - `add_org_prefix` (boolean, nullable): Default: `true` Example: `true`
      - `add_info_link` (boolean, nullable): Default: `true` Example: `true`
      - `add_opt_out_language` (boolean, nullable): 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)
    - `campaign` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
      - `links` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
    - `template` (object)
      - `data` (object): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
      - `links` (RelationshipLinks): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-07-15/openapi/stable/apis/assign_template_to_campaign_message.json).
  - `links` (object, required)
    - `self` (string<uri>, required)
- `links` (ObjectLinks): Same fields as the first ObjectLinks above.
- `meta` (object): Response-level metadata
  - `agent_hints` (object): Optional hints emitted by the API for agent callers
    - `next_steps` (string[]): Suggested follow-up actions for agents to take after this response

#### Example response body

```json
{
  "data": {
    "type": "campaign-message",
    "id": "string",
    "attributes": {
      "label": "string",
      "channel": "string",
      "content": {
        "subject": "Buy our product!",
        "preview_text": "My preview text",
        "from_email": "store@my-company.com",
        "from_label": "My Company",
        "reply_to_email": "reply-to@my-company.com",
        "cc_email": "cc@my-company.com",
        "bcc_email": "bcc@my-company.com"
      },
      "send_times": [
        {
          "datetime": "2022-11-08T00:00:00+00:00",
          "is_local": true
        }
      ],
      "render_options": {
        "shorten_links": true,
        "add_org_prefix": true,
        "add_info_link": true,
        "add_opt_out_language": false
      },
      "created_at": "2022-11-08T00:00:00+00:00",
      "updated_at": "2022-11-08T00:00:00+00:00"
    },
    "relationships": {
      "campaign": {
        "data": {
          "type": "campaign",
          "id": "string"
        },
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      },
      "template": {
        "data": {
          "type": "template",
          "id": "string"
        },
        "links": {
          "self": "https://www.example.com",
          "related": "https://www.example.com"
        }
      }
    },
    "links": {
      "self": "https://www.example.com"
    }
  },
  "links": {
    "self": "https://www.example.com"
  },
  "meta": {
    "agent_hints": {
      "next_steps": [
        "string"
      ]
    }
  }
}
```

### 4XX: Client Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
