File Import Action
Learn about Middle's "Import File into Hubspot Action"
Action purpose
Imports a file into HubSpot using the /crm/v3/imports API.
Supports CSV and BZ2-compressed CSV files, fetched from an S3 presigned URL, with robust options for field mapping, transformations, and optional formatting prior to upload.
Overview
This action allows you to import any supported HubSpot object type — such as Contacts, Companies, Deals, Tickets, or Notes — using a CSV file.
You can define mappings between CSV columns and HubSpot property names either by:
Providing a structured array of field definitions, or
Using a special “Field Definitions String” input (recommended for a more streamlines implementation).
The action handles:
Field transformations
Static values
Row filtering
CSV reformatting for Hubspot
Optional date/datetime normalization
Upsert / Create / Update import modes
Field Definitions String
Defines field mappings, transformations, and filters in text format, one mapping per line.
Example:
source_field:destination_fieldIn cases where the file is sourced from a Middle file export, the source_field will be the internal name of the Middle field.
Transformations
&&remove_whitespace
Removes all spaces and tabs.
first_name:first_name:&&remove_whitespace
&&uppercase
Converts the string to uppercase.
name:name:&&uppercase
&&lowercase
Converts the string to lowercase.
email:email:&&lowercase
&&titlecase
Capitalizes each word.
full_name:name:&&titlecase
&&static_value;VALUE
Sets this field to a static value for all rows.
status:status:&&static_value;Active
&&filter_row;VALUE
Keeps only rows where this field equals VALUE; discards all others.
region:region:&&filter_row;CA
Object identity reconciliation
Defines which field pair is the unique identifier for record reconciliation.
The format is:
csv_column_name:hubspot_property_name:PRIMARY|SECONDARYExamples
id:hs_object_id:PRIMARY
email:email:SECONDARYError handling
403 File Access Error: File in S3 could not be retrieved — check presigned URL expiration.
Reconciliation Missing: If no primary or secondary key is identified, import will abort.
Transformation Error: Misspelled or unknown transformation names trigger a runtime error.
Column Mismatch: If a specified CSV column is not found, an exception is raised.
Best practices
Always include a reconciliation key (
PRIMARYorSECONDARY).Use optional_formatting = true if the column order in your CSV is unpredictable.
Limit transformations to supported types — unrecognized transformations will cause failure.
Test transformations with a small dataset first.
Use static_value for flags or constant properties to simplify source CSVs.
Last updated
Was this helpful?

