# Update or create company
You can create or update companies based on the "custom_id" key-value. If a company with the provided value exists, we will update its profile with provided data, otherwise, a new company will be created.
POST
/companies/update_or_create/
Attributes | Type | Required | Description |
---|---|---|---|
custom_id | string | no | The unique identifier for the company which is provided by the client. |
address | string | no | A company’s address. |
city | string | no | A company city of residence. |
country | string | no | A company country of residence. |
created_at | string | no | A creation date of a company. |
description | string | no | A description of a company. |
string(email) | no | A company’s email address. | |
name | string | yes | A company name. |
phone_numbers | string(list) | no | A list of phone numbers. |
postal_code | string | no | A postal code according to the address of your company.. |
region | string | no | A company region of residence. |
size | integer | no | An approximate size of your company. |
tags | string | no | A list of tags associated with a company |
updated_at | string | no | A date of last company update. |
assigned_to | integer | no | An agent group ID. |
# Request
- CURL
- JavaScript
- PHP
- Python
curl -X POST -H "Authorization: Token <your_64_char_api_key>" -H "Content-Type: application/json"
-H "Accept: */*; version=2" -d '{
"name": "1Company from API",
"description": "Company created by API request",
"email": "company@email.com",
"country": "United States",
"city": "Beverly Hills",
"postal_code": "90210",
"phone_numbers": [13102990912, 123456789]
}' "https://<your_app_subdomain>.user.com/api/public/companies/update_or_create/"
# Response
{
"id": 1666,
"name": "1Company from API",
"description": "Company created by API request",
"email": "company@email.com",
"country": "United States",
"region": null,
"city": "Beverly Hills",
"address": null,
"postal_code": "90210",
"approx_employees": null,
"created_at": "2017-07-06T15:39:25.513985Z",
"updated_at": "2017-07-06T15:39:25.514009Z",
"phone_numbers": [
"13102990912",
"13123456789"
],
"company_id": null,
"employees": [123, 432, 543]
}