# Hubspot's CRM import API with Node SDK

**URL:** <https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114>\
**Category:** CRM\
**Tags:** starter\
**Created:** [January 1, 2022, 6:48am UTC](https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114 "2022-01-01T06:48:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdullahmahboob](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@abdullahmahboob](https://community.hubspot.com/u/abdullahmahboob)\
**Post date:** [January 1, 2022, 6:48am UTC](https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114/1 "2022-01-01T06:48:17Z")

</div>

This is how my importRequest JSON object looks like. I just stringify it using **JSON.stringify.**

```lia-code-sample
const importRequest = {
 name: "test_import",
 files: [
 {
 fileName: "accounts.csv",
 fileFormat: "CSV",
 fileImportPage: {
 hasHeader: true,
 columnMappings: [
 {
 columnName: "Email",
 propertyName: "email",
 columnObjectType: "CONTACT",
 },
 {
 columnName: "First name",
 propertyName: "firstname",
 columnObjectType: "CONTACT",
 },
 {
 columnName: "Last name",
 propertyName: "lastname",
 columnObjectType: "CONTACT",
 },
 {
 columnName: "Phone number",
 propertyName: "phone",
 columnObjectType: "CONTACT",
 },
 {
 columnName: "Created At",
 propertyName: "createdat",
 columnObjectType: "CONTACT",
 },
 ],
 },
 },
 ],
 };

```

This is how my csv file looks like. It’s placed in the same folder as the **index.js** file.

 ![Screen Shot 2022-01-01 at 11.43.32 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/7/773a548af00e0dbf8ebc4a3fefd82cb276aeb86c.png)

All I get is the notorious

```lia-code-sample
body: {
 status: 'error',
 message: 'Unable to process JSON',
 correlationId: '9ea8d506-36a3-4cea-b0a8-33f336d6233c'
},

```

error. ANY HELP is appreciated. I have tried all formating checks from the community posts but none seem to work for me.

---

<div class="post-metadata">

**Author:** ![abdullahmahboob](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@abdullahmahboob](https://community.hubspot.com/u/abdullahmahboob)\
**Post date:** [January 1, 2022, 8:19am UTC](https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114/2 "2022-01-01T08:19:08Z")

</div>

Got it to work. The Node SDK’s documentation is outdated. VSCode’s suggestions saved me.  
npm docs say [this:](https://www.npmjs.com/package/@hubspot/api-client#:~:text=const%20result%20%3D%20await%20hubspotClient.crm.imports.coreApi.create(JSON.stringify(importRequest)%2C%20importFileReadStream))

`const result = await hubspotClient.crm.imports.coreApi.create(JSON.stringify(importRequest), importFileReadStream)`

While in reality, **importFileReadStream** is the first parameter and **importRequest** is the second, not the other way around.

`const result = await hubspotClient.crm.imports.coreApi.create(importFileReadStream, JSON.stringify(importRequest))`

I hope this helps someone before they fall down this rabbithole and waste 4 hours because of inaccurate documentation.

Hubspot team! Please!! 🙏🏻 Do something!

---

<div class="post-metadata">

**Author:** ![JJose6](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@JJose6](https://community.hubspot.com/u/JJose6)\
**Post date:** [July 7, 2022, 2:35pm UTC](https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114/3 "2022-07-07T14:35:20Z")

</div>

“Argument of type ‘ReadStream’ is not assignable to parameter of type ‘HttpFile’” is the error I am facing any ideas about this? thanks

---

<div class="post-metadata">

**Author:** ![VonazonAccnt](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/vonazonaccnt/32/31567_2.png) [@VonazonAccnt](https://community.hubspot.com/u/VonazonAccnt)\
**Post date:** [September 23, 2022, 5:57pm UTC](https://community.hubspot.com/t/hubspots-crm-import-api-with-node-sdk/49114/4 "2022-09-23T17:57:35Z")

</div>

Abdullah, thanks for sharing. Any chance you know what the request should look like without the SDK. Maybe a sample post request. No worries, if you don’t know 🙂
