# Custom object import through API

**URL:** <https://community.hubspot.com/t/custom-object-import-through-api/98631>\
**Category:** APIs & Integrations\
**Tags:** companies\
**Created:** [January 25, 2024, 11:18am UTC](https://community.hubspot.com/t/custom-object-import-through-api/98631 "2024-01-25T11:18:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DTeam34](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@DTeam34](https://community.hubspot.com/u/DTeam34)\
**Post date:** [January 25, 2024, 11:18am UTC](https://community.hubspot.com/t/custom-object-import-through-api/98631/1 "2024-01-25T11:18:27Z")

</div>

Hi

What is the syntax for “importRequest” in the request body of the url [https://api.hubapi.com/crm/v3/imports](https://api.hubapi.com/crm/v3/imports) to import data for a custom object (Insert new records) and associate them to companies object usng a single CSV file containing data of both custom object and companies.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 25, 2024, 10:10pm UTC](https://community.hubspot.com/t/custom-object-import-through-api/98631/2 "2024-01-25T22:10:07Z")

</div>

Hi, @DTeam34 👋 Thanks for the question. I have a few questions to help give our community members more information:

- Have you made an attempt? If so, can you share your request body?

- If yes, have you tried making a request to retrieve more details about the error?

- If not, have you tried making a single sheet import for two objects with only a single row and a single column (or the minimum number of columns)?

Knowing what you’ve already tried, and any errors you are receiving, will help our community members better understand how they can help.

Thank you! Jaycee

---

<div class="post-metadata">

**Author:** ![DTeam34](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@DTeam34](https://community.hubspot.com/u/DTeam34)\
**Post date:** [January 30, 2024, 4:44am UTC](https://community.hubspot.com/t/custom-object-import-through-api/98631/3 "2024-01-30T04:44:30Z")

</div>

Hi [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074)

Thank you for your reply.

Below is the “Import Request” Json we are using.

{

“name”: “import\_test\_1”,

“importOperations”: {

“0-1”: “UPSERT”

},

“dateFormat”: “DAY\_MONTH\_YEAR”,

“files”: [

{

“fileName”: “Stats-Companies.csv”,

“fileFormat”: “CSV”,

“fileImportPage”: {

“hasHeader”: true,

“columnMappings”: [

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “AccountName”,

“propertyName”: “accountname”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Account\_Id”,

“propertyName”: “account\_id”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Clicks30”,

“propertyName”: “clicks30”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Clicks60”,

“propertyName”: “clicks60”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Clicks90”,

“propertyName”: “clicks90”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Clicks”,

“propertyName”: “clicks”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingSales30”,

“propertyName”: “pendingsales30”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingSales60”,

“propertyName”: “pendingsales60”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingSales90”,

“propertyName”: “pendingsales90”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingSales”,

“propertyName”: “pendingsales”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Sales30”,

“propertyName”: “sales30”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Sales60”,

“propertyName”: “sales60”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Sales90”,

“propertyName”: “sales90”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Sales”,

“propertyName”: “sales”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingPayout30”,

“propertyName”: “pendingpayout30”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingPayout60”,

“propertyName”: “pendingpayout60”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingPayout90”,

“propertyName”: “pendingpayout90”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “PendingPayout”,

“propertyName”: “pendingpayout”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Payout30”,

“propertyName”: “payout30”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Payout60”,

“propertyName”: “payout60”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Payout90”,

“propertyName”: “payout90”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Payout”,

“propertyName”: “payout”

},

{

“columnObjectTypeId”: “2-21443064”,

“columnName”: “Balance”,

“propertyName”: “balance”

},

{

“columnObjectTypeId”: “0-2”,

“columnName”: “Website”,

“propertyName”: “website”

},

{

“columnObjectTypeId”: “0-2”,

“columnName”: “CompanyName”,

“propertyName”: “name”

},

{

“columnObjectTypeId”: “0-2”,

“columnName”: “Domain”,

“propertyName”: “domain”

},

{

“columnObjectTypeId”: “0-2”,

“columnName”: “Phone”,

“propertyName”: “phone”

}

]

}

}

]

}

Actual our requirement is to insert new records into statistics custom object and create association with existing companies object based on common column (account\_id). But the import is inserting new records into both statistics and companies (Causing duplicates in companies) and association created from statistics to newly created company object, which is actually a duplicate.

Thank you.
