POST
/
marketing
/
v3
/
forms
/
Créer un formulaire
curl --request POST \
  --url https://api.hubapi.com/marketing/v3/forms/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "formType": "hubspot",
  "name": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "archived": true,
  "archivedAt": "2023-11-07T05:31:56Z",
  "fieldGroups": [
    {
      "groupType": "default_group",
      "richTextType": "text",
      "richText": "<string>",
      "fields": [
        {
          "objectTypeId": "<string>",
          "hidden": true,
          "defaultValue": "<string>",
          "name": "<string>",
          "description": "<string>",
          "dependentFields": [
            {
              "dependentCondition": {
                "rangeStart": "<string>",
                "values": [
                  "<any>"
                ],
                "value": "<string>",
                "operator": "eq",
                "rangeEnd": "<string>"
              },
              "dependentField": {}
            }
          ],
          "label": "<string>",
          "placeholder": "<string>",
          "fieldType": "email",
          "required": true,
          "validation": {
            "useDefaultBlockList": true,
            "blockedEmailDomains": [
              "<string>"
            ]
          }
        }
      ]
    }
  ],
  "configuration": {
    "createNewContactForNewEmail": true,
    "editable": true,
    "allowLinkToResetKnownValues": true,
    "lifecycleStages": [
      {
        "objectTypeId": "<string>",
        "value": "<string>"
      }
    ],
    "postSubmitAction": {
      "type": "thank_you",
      "value": "<string>"
    },
    "language": "af",
    "prePopulateKnownValues": true,
    "cloneable": true,
    "notifyContactOwner": true,
    "recaptchaEnabled": true,
    "archivable": true,
    "notifyRecipients": [
      "<string>"
    ]
  },
  "displayOptions": {
    "renderRawHtml": true,
    "cssClass": "<string>",
    "theme": "default_style",
    "submitButtonText": "<string>",
    "style": {
      "labelTextSize": "<string>",
      "legalConsentTextColor": "<string>",
      "fontFamily": "<string>",
      "legalConsentTextSize": "<string>",
      "backgroundWidth": "<string>",
      "helpTextSize": "<string>",
      "submitFontColor": "<string>",
      "labelTextColor": "<string>",
      "submitAlignment": "left",
      "submitSize": "<string>",
      "helpTextColor": "<string>",
      "submitColor": "<string>"
    }
  },
  "legalConsentOptions": {
    "type": "none"
  }
}'
{
  "id": "409fa224-7fef-4507-b731-1eb3f508a3eb",
  "name": "Join our mailing list",
  "createdAt": "2020-09-22T07:13:28.102Z",
  "updatedAt": "2020-09-22T07:13:28.102Z",
  "archived": false,
  "fieldGroups": [
    {
      "groupType": "default_group",
      "richTextType": "text",
      "fields": [
        {
          "objectTypeId": "0-1",
          "name": "email",
          "label": "Email",
          "required": true,
          "hidden": false,
          "fieldType": "email",
          "validation": {
            "blockedEmailDomains": [],
            "useDefaultBlockList": false
          }
        }
      ]
    },
    {
      "groupType": "default",
      "richTextType": "text",
      "fields": [
        {
          "objectTypeId": "0-1",
          "name": "firstname",
          "label": "First name",
          "required": false,
          "hidden": false,
          "fieldType": "single_line_text"
        },
        {
          "objectTypeId": "0-1",
          "name": "lastname",
          "label": "Last name",
          "required": false,
          "hidden": false,
          "fieldType": "single_line_text"
        }
      ]
    }
  ],
  "configuration": {
    "language": "en",
    "cloneable": true,
    "postSubmitAction": {
      "type": "thank_you",
      "value": "Thanks for joining our mailing list."
    },
    "editable": true,
    "archivable": true,
    "recaptchaEnabled": false,
    "notifyContactOwner": false,
    "notifyRecipients": [
      "2886602"
    ],
    "createNewContactForNewEmail": false,
    "prePopulateKnownValues": true,
    "allowLinkToResetKnownValues": false,
    "lifecycleStages": [
      {
        "objectTypeId": "0-1",
        "value": "subscriber"
      },
      {
        "objectTypeId": "0-2",
        "value": "subscriber"
      }
    ]
  },
  "displayOptions": {
    "renderRawHtml": false,
    "theme": "default_style",
    "submitButtonText": "Submit",
    "style": {
      "fontFamily": "arial, helvetica, sans-serif",
      "backgroundWidth": "100%",
      "labelTextColor": "#33475b",
      "labelTextSize": "13px",
      "helpTextColor": "#7C98B6",
      "helpTextSize": "11px",
      "legalConsentTextColor": "#33475b",
      "legalConsentTextSize": "14px",
      "submitColor": "#ff7a59",
      "submitAlignment": "left",
      "submitFontColor": "#ffffff",
      "submitSize": "12px"
    },
    "cssClass": "hs-form stacked"
  },
  "legalConsentOptions": {
    "type": "none"
  },
  "formType": "hubspot"
}
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 HubStarter

Portées requises

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

Authorizations

Authorization
string
header
required

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

Body

application/json

Response

201
application/json

successful operation

The response is of type object.