Zum Hauptinhalt springen
POST
/
marketing
/
v3
/
emails
/
ab-test
/
create-variation
Créez une variante de test A/B d'un e-mail marketing.
curl --request POST \
  --url https://api.hubapi.com/marketing/v3/emails/ab-test/create-variation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contentId": "7",
  "variantName": "AB Test - Number 7"
}'
{
  "activeDomain": "test.hs-sites.com",
  "archived": false,
  "campaign": "1b7f51a6-33c1-44d6-ba28-fe81f655dced",
  "content": {
    "flexAreas": {
      "main": {
        "boxed": false,
        "isSingleColumnFullWidth": false,
        "sections": [
          {
            "columns": [
              {
                "id": "column_1606761806181_0",
                "widgets": [
                  "module_160676180617911"
                ],
                "width": 12
              }
            ],
            "id": "section_1606761806181",
            "style": {
              "backgroundColor": "",
              "backgroundType": "CONTENT"
            }
          },
          {
            "columns": [
              {
                "id": "column-0-1",
                "widgets": [
                  "module-0-1-1"
                ],
                "width": 12
              }
            ],
            "id": "section-0",
            "style": {
              "backgroundType": "CONTENT",
              "paddingBottom": "40px",
              "paddingTop": "40px"
            }
          },
          {
            "columns": [
              {
                "id": "column-1-1",
                "widgets": [
                  "module-1-1-1"
                ],
                "width": 12
              }
            ],
            "id": "section-1",
            "style": {
              "backgroundColor": "",
              "backgroundType": "CONTENT",
              "paddingBottom": "0px",
              "paddingTop": "0px"
            }
          }
        ]
      }
    },
    "plainTextVersion": "This is custom! View in browser ({{view_as_page_url}})\n\nHello {{ contact.firstname }},\n\nPlain text emails have minimal formatting so your reader can really focus on what you have to say. Introduce yourself and explain why you’re reaching out.\n\nEvery email should try to lead the reader to some kind of action. Use this space to describe why the reader should want to click on the link below. Put the link on its own line to really draw their eye to it.\n\nLink text\n\nNow it’s time to wrap up your email. Before your signature, thank the recipient for reading. You can also invite them to send this email to any of their colleagues who might be interested.\n\nAll the best,\n\nYour full name\n\nYour job title\n\nOther contact information\n\n{{site_settings.company_name}}, {{site_settings.company_street_address_1}}, {{site_settings.company_street_address_2}}, {{site_settings.company_city}}, {{site_settings.company_state}} {{site_settings.company_zip}}, {{site_settings.company_country}}, {{site_settings.company_phone}}\n\nUnsubscribe ({{unsubscribe_link_all}})\n\nManage preferences ({{unsubscribe_link}})",
    "styleSettings": {},
    "templatePath": "@hubspot/email/dnd/plain_text.html",
    "widgets": {
      "module-0-1-1": {
        "body": {
          "css_class": "dnd-module",
          "html": "<p style=\"margin-bottom:10px;\">Hello {{ contact.firstname }},<br><br>Plain text emails have minimal formatting so your reader can really focus on what you have to say. Introduce yourself and explain why you’re reaching out.</p><p style=\"margin-bottom:10px;\">Every email should try to lead the reader to some kind of action. Use this space to describe why the reader should want to click on the link below. Put the link on its own line to really draw their eye to it.</p><p style=\"margin-bottom:10px;\"><a target=\"_blank\" rel=\"noopener\">Link text</a></p><p style=\"margin-bottom:10px;\">Now it’s time to wrap up your email. Before your signature, thank the recipient for reading. You can also invite them to send this email to any of their colleagues who might be interested.</p><p style=\"margin-bottom:10px;\">All the best,<br>Your full name<br>Your job title<br>Other contact information</p>",
          "i18nKey": "richText.plainText",
          "path": "@hubspot/rich_text",
          "schema_version": 2
        },
        "child_css": {},
        "css": {},
        "id": "module-0-1-1",
        "module_id": 1155639,
        "name": "module-0-1-1",
        "order": 2,
        "styles": {},
        "type": "module"
      },
      "module-1-1-1": {
        "body": {
          "align": "center",
          "css_class": "dnd-module",
          "font": {
            "color": "#23496d",
            "font": "Arial, sans-serif",
            "size": {
              "units": "px",
              "value": 12
            }
          },
          "link_font": {
            "color": "#00a4bd",
            "font": "Helvetica,Arial,sans-serif",
            "size": {
              "units": "px",
              "value": 12
            },
            "styles": {
              "bold": false,
              "italic": false,
              "underline": true
            }
          },
          "path": "@hubspot/email_footer",
          "schema_version": 2,
          "unsubscribe_link_type": "both"
        },
        "child_css": {},
        "css": {},
        "id": "module-1-1-1",
        "module_id": 2869621,
        "name": "module-1-1-1",
        "order": 3,
        "styles": {},
        "type": "module"
      },
      "module_160676180617911": {
        "body": {
          "font": {
            "color": "#00a4bd",
            "font": "Arial, sans-serif",
            "size": {
              "units": "px",
              "value": 12
            },
            "styles": {
              "bold": false,
              "italic": false,
              "underline": true
            }
          },
          "hs_enable_module_padding": false,
          "hs_wrapper_css": {}
        },
        "child_css": {},
        "css": {},
        "id": "module_160676180617911",
        "module_id": 2794854,
        "name": "module_160676180617911",
        "styles": {},
        "type": "module"
      },
      "preview_text": {
        "body": {
          "value": ""
        },
        "child_css": {},
        "css": {},
        "id": "preview_text",
        "label": "Preview Text <span class=help-text>This will be used as the preview text that displays in some email clients</span>",
        "name": "preview_text",
        "order": 0,
        "styles": {},
        "type": "text"
      }
    }
  },
  "createdAt": "2020-11-30T18:43:17.136Z",
  "createdById": 3739732,
  "from": {
    "fromName": "Bruce Wayne",
    "replyTo": "test@hubspot.com"
  },
  "id": "38175169118",
  "isPublished": false,
  "isTransactional": false,
  "language": "en",
  "name": "My subject",
  "publishDate": "2020-11-30T18:44:20.387Z",
  "sendOnPublish": true,
  "state": "DRAFT",
  "subcategory": "batch",
  "subject": "My subject",
  "subscriptionDetails": {
    "officeLocationId": "5449392956"
  },
  "to": {
    "contactIds": {},
    "contactIlsLists": {
      "exclude": [
        1
      ],
      "include": [
        5
      ]
    },
    "suppressGraymail": true
  },
  "type": "BATCH_EMAIL",
  "updatedAt": "2020-11-30T18:44:20.384Z",
  "updatedById": 3739732,
  "webversion": {
    "expiresAt": "2020-11-30T18:44:20.387Z",
    "metaDescription": "",
    "redirectToPageId": 0,
    "redirectToUrl": "http://www.example.org"
  }
}
Produits pris en charge
Exige l'un des produits suivants ou un produit supérieur.
Marketing HubMarketing HubGratuit
Sales HubSales HubGratuit
Service HubService HubGratuit
Content HubContent HubGratuit

Portées requises

Cette API requiert l’une des portées suivantes :
  • content

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

Request body object for creating A/B tests.

variationName
string
required
contentId
string
required

ID de l'objet à tester.

Response

successful operation

A marketing email

subject
string
required

L'objet de l'e-mail.

Example:

"My subject"

content
object
required

Data structure representing the content of the email.

from
object
required

Data structure representing the from fields on the email.

id
string
required

L'ID de l'e-mail.

Example:

"38175169118"

state
enum<string>
required

État de l'e-mail.

Available options:
AUTOMATED,
AUTOMATED_DRAFT,
AUTOMATED_SENDING,
AUTOMATED_FOR_FORM,
AUTOMATED_FOR_FORM_BUFFER,
AUTOMATED_FOR_FORM_DRAFT,
AUTOMATED_FOR_FORM_LEGACY,
BLOG_EMAIL_DRAFT,
BLOG_EMAIL_PUBLISHED,
DRAFT,
DRAFT_AB,
DRAFT_AB_VARIANT,
ERROR,
LOSER_AB_VARIANT,
PAGE_STUB,
PRE_PROCESSING,
PROCESSING,
PUBLISHED,
PUBLISHED_AB,
PUBLISHED_AB_VARIANT,
PUBLISHED_OR_SCHEDULED,
RSS_TO_EMAIL_DRAFT,
RSS_TO_EMAIL_PUBLISHED,
SCHEDULED,
SCHEDULED_AB,
SCHEDULED_OR_PUBLISHED,
AUTOMATED_AB,
AUTOMATED_AB_VARIANT,
AUTOMATED_DRAFT_AB,
AUTOMATED_DRAFT_ABVARIANT,
AUTOMATED_LOSER_ABVARIANT
Example:

"DRAFT"

name
string
required

Le nom de l'e-mail, tel qu'affiché sur le tableau de bord des e-mails.

Example:

"My subject"

to
object
required

Data structure representing the to fields of the email.

subcategory
string
required

La sous-catégorie de l'e-mail.

Example:

"batch"

sendOnPublish
boolean
required

Détermine si l'e-mail sera envoyé immédiatement lors de la publication.

Example:

true

feedbackSurveyId
string

L'ID de l'enquête de feedback liée à l'e-mail.

publishedByEmail
string
publishDate
string<date-time>

La date et l'heure auxquelles l'e-mail est programmé, suivant le format ISO8601. Ceci n'est utilisé que pour les e-mails d'heure locale ou les e-mails programmés.

Example:

"2020-11-30T18:44:20.387+00:00"

isTransactional
boolean

Affiche si l'e-mail est ou non un e-mail transactionnel. En lecture seule.

Example:

false

language
enum<string>
Available options:
af,
af-na,
af-za,
agq,
agq-cm,
ak,
ak-gh,
am,
am-et,
ann,
ann-ng,
ar,
ar-001,
ar-ae,
ar-bh,
ar-dj,
ar-dz,
ar-eg,
ar-eh,
ar-er,
ar-il,
ar-iq,
ar-jo,
ar-km,
ar-kw,
ar-lb,
ar-ly,
ar-ma,
ar-mr,
ar-om,
ar-ps,
ar-qa,
ar-sa,
ar-sd,
ar-so,
ar-ss,
ar-sy,
ar-td,
ar-tn,
ar-ye,
as,
asa,
asa-tz,
ast,
ast-es,
as-in,
az,
az-az,
bas,
bas-cm,
be,
bem,
bem-zm,
bez,
bez-tz,
be-by,
bg,
bgc,
bgc-in,
bg-bg,
bho,
bho-in,
bm,
bm-ml,
bn,
bn-bd,
bn-in,
bo,
bo-cn,
bo-in,
br,
brx,
brx-in,
br-fr,
bs,
bs-ba,
ca,
ca-ad,
ca-es,
ca-fr,
ca-it,
ccp,
ccp-bd,
ccp-in,
ce,
ceb,
ceb-ph,
ce-ru,
cgg,
cgg-ug,
chr,
chr-us,
ckb,
ckb-iq,
ckb-ir,
cs,
cs-cz,
cu,
cu-ru,
cv,
cv-ru,
cy,
cy-gb,
da,
dav,
dav-ke,
da-dk,
da-gl,
de,
de-at,
de-be,
de-ch,
de-de,
de-gr,
de-it,
de-li,
de-lu,
dje,
dje-ne,
doi,
doi-in,
dsb,
dsb-de,
dua,
dua-cm,
dyo,
dyo-sn,
dz,
dz-bt,
ebu,
ebu-ke,
ee,
ee-gh,
ee-tg,
el,
el-cy,
el-gr,
en,
en-001,
en-150,
en-ae,
en-ag,
en-ai,
en-as,
en-at,
en-au,
en-bb,
en-be,
en-bi,
en-bm,
en-bs,
en-bw,
en-bz,
en-ca,
en-cc,
en-ch,
en-ck,
en-cm,
en-cn,
en-cx,
en-cy,
en-de,
en-dg,
en-dk,
en-dm,
en-ee,
en-er,
en-es,
en-fi,
en-fj,
en-fk,
en-fm,
en-fr,
en-gb,
en-gd,
en-gg,
en-gh,
en-gi,
en-gm,
en-gu,
en-gy,
en-hk,
en-ie,
en-il,
en-im,
en-in,
en-io,
en-je,
en-jm,
en-ke,
en-ki,
en-kn,
en-ky,
en-lc,
en-lr,
en-ls,
en-lu,
en-mg,
en-mh,
en-mo,
en-mp,
en-ms,
en-mt,
en-mu,
en-mv,
en-mw,
en-mx,
en-my,
en-na,
en-nf,
en-ng,
en-nl,
en-nr,
en-nu,
en-nz,
en-pg,
en-ph,
en-pk,
en-pn,
en-pr,
en-pw,
en-rw,
en-sb,
en-sc,
en-sd,
en-se,
en-sg,
en-sh,
en-si,
en-sl,
en-ss,
en-sx,
en-sz,
en-tc,
en-tk,
en-tn,
en-to,
en-tt,
en-tv,
en-tz,
en-ug,
en-um,
en-us,
en-vc,
en-vg,
en-vi,
en-vu,
en-ws,
en-za,
en-zm,
en-zw,
eo,
eo-001,
es,
es-419,
es-ar,
es-bo,
es-br,
es-bz,
es-cl,
es-co,
es-cr,
es-cu,
es-do,
es-ea,
es-ec,
es-es,
es-gq,
es-gt,
es-hn,
es-ic,
es-mx,
es-ni,
es-pa,
es-pe,
es-ph,
es-pr,
es-py,
es-sv,
es-us,
es-uy,
es-ve,
et,
et-ee,
eu,
eu-es,
ewo,
ewo-cm,
fa,
fa-af,
fa-ir,
ff,
ff-bf,
ff-cm,
ff-gh,
ff-gm,
ff-gn,
ff-gw,
ff-lr,
ff-mr,
ff-ne,
ff-ng,
ff-sl,
ff-sn,
fi,
fil,
fil-ph,
fi-fi,
fo,
fo-dk,
fo-fo,
fr,
frr,
frr-de,
fr-be,
fr-bf,
fr-bi,
fr-bj,
fr-bl,
fr-ca,
fr-cd,
fr-cf,
fr-cg,
fr-ch,
fr-ci,
fr-cm,
fr-dj,
fr-dz,
fr-fr,
fr-ga,
fr-gf,
fr-gn,
fr-gp,
fr-gq,
fr-ht,
fr-km,
fr-lu,
fr-ma,
fr-mc,
fr-mf,
fr-mg,
fr-ml,
fr-mq,
fr-mr,
fr-mu,
fr-nc,
fr-ne,
fr-pf,
fr-pm,
fr-re,
fr-rw,
fr-sc,
fr-sn,
fr-sy,
fr-td,
fr-tg,
fr-tn,
fr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-th,
ti,
ti-er,
ti-et,
tk,
tk-tm,
tl,
to,
tok,
tok-001,
to-to,
tr,
tr-cy,
tr-tr,
tt,
tt-ru,
twq,
twq-ne,
tzm,
tzm-ma,
ug,
ug-cn,
uk,
uk-ua,
ur,
ur-in,
ur-pk,
uz,
uz-af,
uz-uz,
vai,
vai-lr,
vi,
vi-vn,
vo,
vo-001,
vun,
vun-tz,
wae,
wae-ch,
wo,
wo-sn,
xh,
xh-za,
xog,
xog-ug,
yav,
yav-cm,
yo,
yo-bj,
yo-ng,
yrl,
yrl-br,
yrl-co,
yrl-ve,
yue,
yue-cn,
yue-hk,
zgh,
zgh-ma,
zh,
zh-cn,
zh-hans,
zh-hant,
zh-hk,
zh-mo,
zh-sg,
zh-tw,
zu,
zu-za
Example:

"en"

type
enum<string>

Le type d'e-mail, dérivé d'autres propriétés sur l'e-mail comme la sous-catégorie.

Available options:
AB_EMAIL,
BATCH_EMAIL,
LOCALTIME_EMAIL,
AUTOMATED_AB_EMAIL,
BLOG_EMAIL,
BLOG_EMAIL_CHILD,
RSS_EMAIL,
RSS_EMAIL_CHILD,
RESUBSCRIBE_EMAIL,
OPTIN_EMAIL,
OPTIN_FOLLOWUP_EMAIL,
AUTOMATED_EMAIL,
FEEDBACK_CES_EMAIL,
FEEDBACK_CUSTOM_EMAIL,
FEEDBACK_CUSTOM_SURVEY_EMAIL,
FEEDBACK_NPS_EMAIL,
FOLLOWUP_EMAIL,
LEADFLOW_EMAIL,
SINGLE_SEND_API,
MARKETING_SINGLE_SEND_API,
SMTP_TOKEN,
TICKET_EMAIL,
MEMBERSHIP_REGISTRATION_EMAIL,
MEMBERSHIP_PASSWORD_SAVED_EMAIL,
MEMBERSHIP_PASSWORD_RESET_EMAIL,
MEMBERSHIP_EMAIL_VERIFICATION_EMAIL,
MEMBERSHIP_PASSWORDLESS_AUTH_EMAIL,
MEMBERSHIP_REGISTRATION_FOLLOW_UP_EMAIL,
MEMBERSHIP_OTP_LOGIN_EMAIL,
MEMBERSHIP_FOLLOW_UP_EMAIL,
MEMBERSHIP_VERIFICATION_EMAIL
Example:

"BATCH_EMAIL"

campaignUtm
string
businessUnitId
string
webversion
object
workflowNames
string[]

Noms des workflows dans lesquels l'e-mail est utilisé dans une action « Envoyer un e-mail ».

archived
boolean

Détermine si l'e-mail est archivé ou non.

Example:

false

publishedByName
string
createdAt
string<date-time>

La date et l'heure de création de l'e-mail, au format ISO8601.

Example:

"2020-11-30T18:43:17.136+00:00"

stats
object
jitterSendTime
boolean
allEmailCampaignIds
string[]
createdById
string

L'ID de l'utilisateur qui a créé l'e-mail.

Example:

"3739732"

updatedAt
string<date-time>

La date et l'heure de la dernière mise à jour de l'e-mail, au format ISO8601.

Example:

"2020-11-30T18:44:20.384+00:00"

clonedFrom
string

L'ID de l'e-mail à partir duquel cet e-mail a été cloné.

Example:

"3817552341"

rssData
object

RSS related data if it is a blog or rss email.

publishedAt
string<date-time>

La date et l'heure de publication de l'e-mail, au format ISO8601.

publishedById
string

L'ID de l'utilisateur qui a publié l'e-mail.

isPublished
boolean

Affiche le statut publié de l'e-mail. En lecture seul.

Example:

false

testing
object

AB testing related data. This property is only returned for AB type emails.

updatedById
string

L'ID du dernier utilisateur à avoir mis à jour l'e-mail.

Example:

"3739732"

folderId
integer
emailCampaignGroupId
string
subscriptionDetails
object

Data structure representing the subscription fields of the email.

deletedAt
string<date-time>

La date et l'heure de suppression de l'e-mail, au format ISO8601.

activeDomain
string

Le domaine actif de l'e-mail.

Example:

"test.hs-sites.com"

campaign
string

L'e GUID de la campagne dans l'e-mail.

Example:

"1b7f51a6-33c1-44d6-ba28-fe81f655dced"

campaignName
string

Le nom de la campagne

I