Hello!
We are trying to use the Contacts API to bulk import contacts from a CSV but we are having a bit of trouble. I created a test .csv file to try in a sandbox account with and followed the Contacts API article. Below I’ve included my request:
function submitHubSpotImport() {
const url = 'https://api.hubapi.com/crm/v3/imports?hapikey=xxx';
const body = {
"name": "test_import",
"files": [{
"filename": "test-contact-import-new.csv",
"fileFormat": "CSV",
"dateFormat": "DAY_MONTH_YEAR",
"fileImportPage": {
"hasHeader": true,
"columnMappings": [
{
"columnObjectTypeId": "0-1",
"columnName": "First Name",
"propertyName": "firstname",
"idColumnType": null
},
{
"columnObjectTypeId": "0-1",
"columnName": "Last Name",
"propertyName": "lastname",
"idColumnType": null
},
{
"columnObjectTypeId": "0-1",
"columnName": "Email",
"propertyName": "email",
"idColumnType": null
},
]
}
}]
};
var request = {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data'
},
body: JSON.stringify(body)
};
fetch(url, request)
.then(function() {
console.log('Success: ' + request);
})
.catch(function(err) {
console.log('Error: ' + err);
});
}
This returns a 400 error.
In postman I get the same 400 error but a bit more info:
{
"status": "error",
"message": "Import cannot be processed without file data!",
"correlationId": "xxx",
"category": "VALIDATION_ERROR"
}
I do have the file key in postman pointing to the file I’m trying to use. Seems as if for some reason the file isn’t coming through? I also tried including the full url to the file in the filename after I uploaded it to our file manager but that didn’t seem to help. My test csv looks like this:
I can provide any further information needed. Any help would be greatly appreciated! Thank you.

