There's a new version of the HubSpot API

We're also working on a new documentation website, you're invited to check it out and give us your feedback.

Create a new form

Last updated November 20, 2023

POST /forms/v2/forms

Method Details

HTTP Methods:

POST

Content Type:

application/json

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing

Required Scope:

forms

This endpoint is used to create a new form in a given HubSpot account.

Use case for this endpoint: Forms are standard website tools that are used to generate leads. This capability might be useful for an integration with an external system that has its own form-building interface.

Form fields and groups

Forms may have a set of associated fields or field groups. When creating a new form using this API, you can specify the fields that you want included.

Field groups are used to group fields together in a row. All fields in the same fieldgroup will be displayed on the same row.

Response details

All forms should have a unique name. If you attempt to create a new form using the same name as an existing form, we will return a 409.

Example URL:  https://api.hubapi.com/forms/v2/forms

Required parameters How to use Description
OAuth access token or private app access token Authorization: Bearer {token} header Used to authenticate the request. Please see this page for more details about authentication.
Form data Used in the request body The data for the form that you're creating. This can include any number of data points or fields. For an example of this data, please see the JSON code sample for POSTing and creating a new form below.
Optional parameters How to use Description
Form fields and groups Used in the request body When creating a new form, you have the ability to also add some fields that you'd like to be a part of the form you're creating. These fields will show up in the form through the HubSpot user interface, where you can customize your forms further. For an example of the data structure for adding form fields to your form on creation with this method, please see the example below.
selectedExternalOptions Used in the request body Use this option to set a lifecycle stage for contacts when submitting the form. The selectedExternalOptions must include entries for both contacts and companies, even if the form only includes fields for contacts or only for companies.

The id set for both contact and company must match exactly, or the call will be rejected. If either entry is not included, this will result in a INVALID_LIFECYCLE_STAGE error.

If no lifecycle stage is set up in the form definition, the form's Lifecycle stage setting will be set to the default lifecycle stage for the HubSpot account.