# Create Form — HubSpot

> Create a form in HubSpot. See the documentation

- Key: `hubspot-create-form`
- Type: Action (Write)
- Version: 0.0.16
- App: HubSpot (`hubspot`) — https://pipedream.com/apps/hubspot.md
- This page (HTML): https://pipedream.com/apps/hubspot/actions/create-form
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/hubspot/actions/create-form/create-form.mjs

## Description

Create a form in HubSpot. [See the documentation](https://developers.hubspot.com/docs/reference/api/marketing/forms#post-%2Fmarketing%2Fv3%2Fforms%2F)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | The name of the form. |
| `archived` | `boolean` | No | Whether the form is archived. |
| `fieldGroups` | `string[]` | No | A list for objects of group type and fields. Format: [{ "groupType": "default_group", "richTextType": "text", "fields": [ { "objectTypeId": "0-1", "name": "email", "label": "Email", "required": true, "hidden": false, "fieldType": "email", "validation": { "blockedEmailDomains": [], "useDefaultBlockList": false }}]}] See the documentation for more information. |
| `createNewContactForNewEmail` | `boolean` | No | Whether to create a new contact when a form is submitted with an email address that doesn't match any in your existing contacts records. |
| `editable` | `boolean` | No | Whether the form can be edited. |
| `allowLinkToResetKnownValues` | `boolean` | No | Whether to add a reset link to the form. This removes any pre-populated content on the form and creates a new contact on submission. |
| `lifecycleStages` | `string[]` | No | A list of objects of lifecycle stages. Format: [{ "objectTypeId": "0-1", "value": "subscriber" }] See the documentation for more information. |
| `postSubmitActionType` | `string` | No | The action to take after submit. The default action is displaying a thank you message. |
| `postSubmitActionValue` | `string` | No | The thank you text or the page to redirect to. |
| `language` | `string` | No | The language of the form. |
| `prePopulateKnownValues` | `boolean` | No | Whether contact fields should pre-populate with known information when a contact returns to your site. |
| `cloneable` | `boolean` | No | Whether the form can be cloned. |
| `notifyContactOwner` | `boolean` | No | Whether to send a notification email to the contact owner when a submission is received. |
| `recaptchaEnabled` | `boolean` | No | Whether CAPTCHA (spam prevention) is enabled. |
| `archivable` | `boolean` | No | Whether the form can be archived. |
| `notifyRecipients` | `string[]` | No | Note - this needs to be a contact that already exists within HubSpot. You may need to add a Create or Update Contact step before this one. Then, use the email created in that step in this field. Options are loaded from the connected account. |
| `renderRawHtml` | `boolean` | No | Whether the form will render as raw HTML as opposed to inside an iFrame. |
| `cssClass` | `string` | No | The CSS class of the form. |
| `theme` | `string` | No | The theme used for styling the input fields. This will not apply if the form is added to a HubSpot CMS page. |
| `submitButtonText` | `string` | No | The text displayed on the form submit button. |
| `labelTextSize` | `string` | No | The size of the label text. |
| `legalConsentTextColor` | `string` | No | The color of the legal consent text. |
| `fontFamily` | `string` | No | The font family of the form. |
| `legalConsentTextSize` | `string` | No | The size of the legal consent text. |
| `backgroundWidth` | `string` | No | The width of the background. |
| `helpTextSize` | `string` | No | The size of the help text. |
| `submitFontColor` | `string` | No | The color of the submit font. |
| `labelTextColor` | `string` | No | The color of the label text. |
| `submitAlignment` | `string` | No | The alignment of the submit button. |
| `submitSize` | `string` | No | The size of the submit button. |
| `helpTextColor` | `string` | No | The color of the help text. |
| `submitColor` | `string` | No | The color of the submit button. |
| `legalConsentOptionsType` | `string` | No | The type of legal consent options. |
| `legalConsentOptionsObject` | `object` | No | The object of legal consent options. Format: {"subscriptionTypeIds": [1,2,3], "lawfulBasis": "lead", "privacy": "string"} See the documentation for more information. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "hubspot",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "hubspot-create-form",
  arguments: {
    name: "Name",
    archived: true,
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "hubspot-create-form",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    hubspot: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    archived: true,
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "hubspot-create-form",
    "configured_props": {
      "hubspot": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "archived": true
    }
  }'
```

---

- App: https://pipedream.com/apps/hubspot.md · All apps: https://pipedream.com/apps
