Update a newsletter variant
Update the content of a newsletter: the default message, a test variant in an A/B test group, or a translation.
For an email, you can also update the envelope: from address, subject line, etc.
NOTE: You cannot manage content made with the drag-and-drop editor via API, and you cannot use this endpoint to update Design Studio emails. You can, however, manage Design Studio content with other endpoints. You also can't update in-app or inbox message content through the API—use the message editor instead.
- Type: integernewsletter
_id requiredThe identifier of a newsletter.
- Type: integercontent
_id requiredThe identifier of a message in a newsletter. If your newsletter has an A/B test group or includes multiple languages, each variant has its own
content_id, separate from thenewsletter_id.Use List variants of a newsletter to find the
content_idassociated with the right variant.
Update the contents of an email newsletter variant. You can set the sender with
from_id. If you don't provide it, the existing sender is preserved.- bodyType: string
The HTML body of the email. You cannot modify the body if you created the newsletter with Design Studio or the drag-and-drop editor.
- bodyType: string
_amp AMP-enabled content for your email. If a recipient's email client doesn't support AMP, they receive your
bodycontent instead. Make sure you're set up to send AMP first. - bodyType: string
_plain By default, your workspace generates a plaintext version of your message body for each delivery. Use this key to override the default plain text body.
- fromType: integer
_id The identifier of the
fromaddress, commonly known as the "sender". Use List sender identities to find valid IDs. - preheaderType: string
_text Also known as "preview text", this is the small block of text shown in an email inbox next to or underneath the subject line.
- recipientType: string
The recipient address for the newsletter. By default, it's
{{customer.email}}. - replyType: integer | null
_to _id The identifier for the
reply_toaddress, if applicable. Use List sender identities to find valid IDs. - subjectType: string
The subject line for an
emailaction.
- application/json
- 400
The request is malformed.
- 404
The newsletter or variant does not exist.
- 429
Your request is over the 10-per-second limit.
curl https://api.customer.io/v1/newsletters/1/contents/1 \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"body": "",
"body_amp": "",
"body_plain": "",
"subject": "Did you get that thing I sent you?",
"preheader_text": "",
"from_id": 1,
"reply_to_id": 38,
"recipient": ""
}'
{
"content": {
"id": 1,
"newsletter_id": 10,
"deduplicate_id": "15:1492548073",
"name": "newsletter variant A",
"layout": "<html><body>{{ content }}</body></html>",
"body": "<strong>Hello from the API</strong>",
"body_amp": "string",
"language": "fr",
"type": "email",
"from": "sentFrom@example.com",
"from_id": 1,
"reply_to": "replyto@example.com",
"reply_to_id": 38,
"preprocessor": "premailer",
"recipient": "{{customer.email}}",
"subject": "Did you get that thing I sent you?",
"cc": "string",
"bcc": "string",
"fake_bcc": true,
"preheader_text": "string",
"headers": "[{\"name\":\"X-Mailgun-Tag\",\"value\":\"my-cool-tag\"},{\"name\":\"X-Custom-Header\",\"value\":\"custom-value\"}]"
}
}Returns the updated newsletter variant.