# How Can I get and add new company via Rest API

**URL:** <https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936>\
**Category:** API Q&A\
**Created:** [July 10, 2017, 6:29am UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936 "2017-07-10T06:29:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravi\_Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Ravi\_Ranjan](https://integration.keap.com/u/Ravi_Ranjan)\
**Post date:** [July 10, 2017, 6:29am UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/1 "2017-07-10T06:29:20Z")

</div>

How Can I get and add new company via Rest API.

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 10, 2017, 6:41am UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/2 "2017-07-10T06:41:31Z")

</div>

See this thread:

> [@Is there a way to create a new company record via the REST API or otherwise?](https://integration.keap.com/t/is-there-a-way-to-create-a-new-company-record-via-the-rest-api-or-otherwise/921):
>
> Hi all, I’d like to be able to create a new company record via the REST API. Is this possible? I see there’s an existing Zapier integration that allows this, so Zapier must be doing it somehow… Relevant links: Zapier: [Keap Max Classic Integrations | Connect Your Apps with Zapier](https://zapier.com/zapbook/infusionsoft/) Company Record: [Create a company record | Max Classic](http://help.infusionsoft.com/userguides/contact-management/create-and-manage-companies/create-a-company-record) Thanks in advance, Ethan

---

<div class="post-metadata">

**Author:** ![Ravi\_Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Ravi\_Ranjan](https://integration.keap.com/u/Ravi_Ranjan)\
**Post date:** [July 10, 2017, 12:24pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/3 "2017-07-10T12:24:32Z")

</div>

@John_Borelli: Sorry, but I couldn’t get to your reply. Would you please elaborate it? Also where can I get the information about “AccountId”?

For clarity, I need to create, update, and retrieve existing and new company (As a hotel) via REST API.

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 10, 2017, 3:26pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/4 "2017-07-10T15:26:37Z")

</div>

REST can create contact. Companies are contact records with one specific difference…the field ‘AccountId’ is set to be the same as the ‘Id’ field. That’s how IS knows it’s a company record. So create the contact and then set AccountId to the same value as Id and you’ll have a company record.

---

<div class="post-metadata">

**Author:** ![mike.christianson](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/mike.christianson/32/74_2.png) [@mike.christianson](https://integration.keap.com/u/mike.christianson)\
**Post date:** [July 10, 2017, 5:55pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/5 "2017-07-10T17:55:06Z")

</div>

@Ravi_Ranjan We have yet to add a _Companies_ resource to the REST API. For now, you’ll need to use the XML-RPC API.

NB: the [`/contacts`](https://developer.infusionsoft.com/docs/rest/#!/Contact/createContactUsingPOST) resource **does not** allow manipulation of Companies.

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 10, 2017, 6:18pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/6 "2017-07-10T18:18:57Z")

</div>

@mike.christianson,

Are you saying that you can’t set the AccountId field on a contact using the REST implementation? I wouldn’t think that creating a contact would be restricted in being able to write to the same fields that we’ve always been able to write to so I just wanted to be sure?

---

<div class="post-metadata">

**Author:** ![mike.christianson](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/mike.christianson/32/74_2.png) [@mike.christianson](https://integration.keap.com/u/mike.christianson)\
**Post date:** [July 10, 2017, 6:29pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/7 "2017-07-10T18:29:37Z")

</div>

The REST API will have separate resources for Contacts and Companies. They will likely end up looking/feeling different than what folks may be used to with the XML-RPC API.

So, in this case, hypothetically, `AccountId` would not be a field on _Contacts_ but would rather be a field on _Companies_. (I use this as an illustration; it’s not guarantee of the future.)

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 10, 2017, 6:38pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/8 "2017-07-10T18:38:45Z")

</div>

k, so that’s not how the tables are structured at this time. Does this mean they’ve already changed? The question still remains, can a field that currently exists on the contact table, like AccountId, be updated. The defining principle here is that companies are currently stored in the contact table (there is no company table but rather just a view of company records stored on the contact table). Is that schema going to change? If not then this can still be done as I’ve described.

---

<div class="post-metadata">

**Author:** ![Ravi\_Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Ravi\_Ranjan](https://integration.keap.com/u/Ravi_Ranjan)\
**Post date:** [July 11, 2017, 10:25am UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/9 "2017-07-11T10:25:56Z")

</div>

Thank you @mike.christianson

@John_Borelli : I tried the way you recommended but I am receiving error as “message”: “Input could not be converted to a valid request”. Would you be able to help me with request file if any? Here is what I’m trying with:  
“company”: {  
“company\_name”: “Test IBC hotels Dont-Book”,  
“AccountId”: 0  
}

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 11, 2017, 5:49pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/10 "2017-07-11T17:49:42Z")

</div>

@mike.christianson,

you don’t set the accountid of the company. You set the account id to the IS id value on the contact. From that point forward it will be a company.

---

<div class="post-metadata">

**Author:** ![mike.christianson](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/mike.christianson/32/74_2.png) [@mike.christianson](https://integration.keap.com/u/mike.christianson)\
**Post date:** [July 11, 2017, 9:24pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/11 "2017-07-11T21:24:35Z")

</div>

That may work, but would be unsupported. The to-be-created _Companies_ resource would be the proper way.

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [July 12, 2017, 1:58am UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/12 "2017-07-12T01:58:30Z")

</div>

unsupported is understood, however, in the absence of viable methods one overcomes with discovery. This is just what I’ve discovered to be true 😜

---

<div class="post-metadata">

**Author:** ![mike.christianson](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/mike.christianson/32/74_2.png) [@mike.christianson](https://integration.keap.com/u/mike.christianson)\
**Post date:** [March 28, 2018, 5:55pm UTC](https://integration.keap.com/t/how-can-i-get-and-add-new-company-via-rest-api/3936/13 "2018-03-28T17:55:13Z")

</div>

@Ravi_Ranjan We’re happy to announce:

> [@API Additions and Changes 2018-03-28](https://integration.keap.com/t/api-additions-and-changes-2018-03-28/35378/1):
>
> - _New_ [Create a Company](https://developer.infusionsoft.com/docs/rest/#!/Company/createCompanyUsingPOST): Creates a new company. Plain, simple, and straightfoward – no [Rube Goldberg machines](https://en.wikipedia.org/wiki/Rube_Goldberg_machine) required.
