Quick tipDeveloperSmart CRMData Hub

Start a HubSpot import from code with the imports API

For large files, letting HubSpot's import engine do the work is often better than thousands of create calls.

Subscription
All tiers
Permissions
App with import scopes
Time
5 min · Advanced
Last verified

Short answer

POST /crm/v3/imports is a multipart/form-data request with two fields: importRequest (JSON text) and files (the CSV or Excel file). The JSON lists each file, its format (CSV or SPREADSHEET), and a columnMappings array in the same order as the file's columns, each with the property's internal name. File requirements are the same as UI imports.

1. The request

POST https://api.hubapi.com/crm/v3/imports   (multipart/form-data)

importRequest = {
  "name": "Nightly company import",
  "files": [{
    "fileName": "companies.csv",
    "fileFormat": "CSV",
    "fileImportPage": {
      "hasHeader": true,
      "columnMappings": [
        { "columnObjectTypeId": "0-2", "columnName": "Domain", "propertyName": "domain" },
        { "columnObjectTypeId": "0-2", "columnName": "Name", "propertyName": "name" }
      ]
    }
  }]
}
files = @companies.csv

2. Mapping rules

  • One mapping per column, in column order.
  • propertyName is the internal name. See labels vs internal names.
  • Multi-file imports use a common column with toColumnObjectTypeId.

3. Related

Import limits: HubSpot import limits. Finding what an import created: records from an import.

Sources

New field notes by email

One email when a new article publishes.

Still stuck?

If this did not fix it, the problem is probably specific to your setup. Book a call and we will look at it together.

Book a call with Sam