DocsBuilding AppsInstalling IntercomAPI & Webhook ReferenceCanvas Kit Reference
DocsApp StoreForumBlogYour Apps

Companies and Users

Associate a Company with a User

$ curl https://api.intercom.io/users \
-X POST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
  "id": "531ee472cce572a6ec000005",
  "companies": [
    {
    "company_id" : "366",
    "name" : "Serenity"
    }
  ]
}'
intercom.users.create(user_id: 111, companies: [{company_id: 10}])
<?php
$intercom->users->create([
    "user_id" => "111",
    "companies" => [
        [
            "company_id" => "10"
        ]
    ]
]);
?>
User user = User.find("541a144b201ebf2ec5000001");
user.addCompany(company);
User.update(user);
Remove a User from a Company

$ curl https://api.intercom.io/users \
-X POST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
  "id": "531ee472cce572a6ec000005",
  "companies": [
    {
      "company_id" : "3",
     "remove" : true
    }
  ]
}'
user.companies = [{ :company_id => "1234", :remove => true}]
<?php
$intercom->users->create([
    "email" => "[email protected]",
    "companies" => [
        [
            "company_id" => "9",
            "remove" => true
        ]
    ]
]);
?>

❗️

Companies field is an Array

Note that when associating a company with a user, the companies field used is an array, not an object (as is the case when the user is being fetched)

📘

Create or Update Companies?

Users may be created or updated with a company object. If the company object does not already exist, it will be created for you. This saves having to create a company or check it exists before creating or updating a user.

To remove a company from a user add the field remove with a value of true to the embedded company object and submit the user as a update request. You must also submit the id of the company.

🚧

Note: the "id" to be used for the "companies" object is the company_id.