Skip to main content
PUT
AhaSend Go SDK
The AhaSend API changes the name, the content, or both, of a campaign template. Access requires templates:write. Changes:
  • A campaign template has no draft. The change applies when the request succeeds.
  • Campaigns already made from the campaign template keep their own copies of the design. The change applies only to campaigns that you create after it.
  • A field that you leave out does not change and is not checked. A request with no field is refused with 400.
  • A name or content equal to the current one changes nothing, so you can repeat the request safely.
  • You cannot change the editor.
Content:
  • You can send back the content of Get Campaign Template with your changes. Leave out content when you do not change it.
  • For a simple campaign template, send only content.text: you can change its design only in the dashboard.
  • When you send a new content.mjml or content.html and leave out content.text, a text written by hand stays, and a text made from the HTML is made again from the new HTML. Send content.text as null to make the text again from the new HTML, also when the text was written by hand.
  • A text written by hand that stays must still render. If it holds a {{, {% or {# that cannot be rendered, the request is refused with 400.
  • The content follows the rules of Create Campaign Template: strict MJML, full https:// URLs for images and stylesheets, and at most 200 KB each for the MJML, the HTML and a text written by hand.
A design that is saved later in the dashboard replaces the design that this request wrote. This is also true for a dashboard editor that was opened before this request. This operation accepts an Idempotency-Key header. See Idempotency.

Authorizations

Authorization
string
header
required

API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.

Headers

Idempotency-Key
string

Optional idempotency key for safe request retries. Must be a unique string for each logical request. An identical request with a completed stored outcome returns the original status and body. An in-progress execution returns 409, a changed method/path/body returns 422, and a released 5xx execution may run again. Keys for non-secret responses expire after 24 hours. API-key create responses include a one-time secret_key, so successful encrypted replay responses for those operations expire after 5 minutes.

Maximum string length: 255

Path Parameters

account_id
string<uuid>
required

Account ID

template_id
string<uuid>
required

Campaign template ID

Body

application/json

Changes to a campaign template. A field left out is not changed or checked. The editor never changes.

name
string

Campaign template name. Spaces around it are dropped.

Required string length: 1 - 255
content
object

The content, by the rules of TemplateContentInput. A campaign template has no draft, so where those rules name the draft, they mean the campaign template itself. For a simple campaign template, send only text.

Response

Campaign template updated

A design a campaign copies when it is made from it. A campaign template has no draft, no versions, no subject and no sender; the campaign owns its subject and sender.

object
enum<string>
required

Object type identifier

Available options:
campaign_template
id
string<uuid>
required

Campaign template ID

created_at
string<date-time>
required

When the campaign template was created

updated_at
string<date-time>
required

When the campaign template last changed

name
string
required

Campaign template name, as it appears in the dashboard

editor
enum<string>
required

The editor the template is designed with. It never changes after the template is created.

  • advanced: designed in MJML, with the dashboard's advanced editor.
  • simple: designed with the dashboard's simple editor. Its HTML is made from the design and can be read but not changed through the API.
  • html: an HTML template, uploaded or written by hand.
Available options:
advanced,
simple,
html
content
object | null

The content. Null when the campaign template has neither HTML nor text, as for one created without content. A campaign can be made from the campaign template only once it has HTML. List Campaign Templates leaves this field out; every other operation that returns a CampaignTemplate sets it.