Skip to main content
POST
AhaSend Go SDK
The AhaSend API creates a campaign template: a reusable design for marketing campaigns. Access requires templates:write. A campaign template has no draft, no versions, no subject and no sender. The request sets the design that a campaign copies when you create it with template_id in Create Campaign. The campaign sets its own subject and sender. Editor:
  • content.mjml creates an advanced campaign template, and content.html creates an html campaign template.
  • content.markup creates a simple campaign template from AhaML. A content.html beside it is ignored, and a content.mjml beside it is refused.
  • Without content.mjml, content.html or content.markup, set editor. An editor that does not agree with the content is refused.
  • Without content, the campaign template gets an empty design, which you can complete in the dashboard’s editor.
  • You cannot change the editor after you create the campaign template.
Content rules:
  • MJML must pass strict validation. For a validation error, the message gives the line of each problem.
  • AhaML must follow the AhaML rules. A refused write lists the problems in errors, each with its line and column when it has a place in the AhaML. See AhaML errors.
  • In MJML and HTML, images and stylesheets must use full https:// URLs, such as https://example.com/logo.png. The API refuses relative paths, such as images/logo.png, and http:, //, data:, cid: and other schemes. A URL that starts with a template variable, such as {{ logo_url }}, is allowed. AhaML URLs follow the AhaML URL rules. The API cannot upload files.
  • The MJML, the HTML, the AhaML and a text written by hand can each be at most 200 KB.
  • A campaign can copy the campaign template only when the campaign template has HTML.
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

Body

application/json

A new campaign template.

name
string
required

Campaign template name. Spaces around it are dropped.

Required string length: 1 - 255
editor
enum<string>

Required when content holds none of markup, mjml and html. content.markup means simple, also beside content.html; content.mjml means advanced and content.html alone means html. An editor that disagrees with the content is refused.

Available options:
advanced,
simple,
html
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.

Response

Campaign template created

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. A read or write answer of one item gives the design as AhaSend Markup (AhaML) in content.markup; a list does not. A write changes the design with content.markup.
  • 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.

markup_warnings
object[]

Warnings about the AhaML in content.markup, up to the first 100; empty when there are none. Present only in the answer to a write that carried content.markup.

Maximum array length: 100