Add

Adding a new client

POST https://do.workzeal.com/company/insert

Request Body

Name Type Description
company* JSON

Query Parameters

Name Type Description
check_duplicates Boolean true: do not create the client if any of its emails (the client's or a contact person's) already belongs to an existing client. Defaults to false: no check, as before
{
  "status": "success",
  "error": null,
  "code": "0",
  "rows": 1,
  "pages": 1,
  "page": 1,
  "value": "1"
}
{
  "status": "error",
  "error": "Duplicate: company ID 1234 already has the email info@example.com. The company was NOT created - use the existing one.",
  "code": "409",
  "value": "1234"
}
// value - ID of the existing client with this email; no new client was created

Note

The duplicate answer comes with HTTP status 200, like every other API answer: look for status = error and code = 409. Don't retry the request; work with the client from value instead. This is how the MCP server adds companies: the insert_company tool always passes check_duplicates=true.

JSON

All available parameters of the new object
  • name - * Company name
  • first_name - First name of an individual
  • last_name - Last name of an individual
  • middle_name - Middle name of an individual
  • person - Legal entity or individual flag [Int] (1/2)
  • address - Primary address
  • country - Country
  • region - Region
  • user_id - * Responsible person code
  • type_id - * Type code
  • status_id - Status code
  • category_id - Category code
  • url - Website
  • activity_type - Line of business
  • info_source - Information source
  • note - Note
  • which_site_source - Lead source website
  • which_host_source - Lead source web host
  • which_link_source - Lead source referral web link
  • utm_campaign - UTM lead source
  • utm_source - UTM lead source
  • utm_medium - UTM lead source
  • utm_content - UTM lead source
  • utm_term - UTM lead source

Contacts - List of contact persons

  • first_name - First name
  • last_name - Last name
  • position - Position
  • note - Note
  • status_id - Contact person status code
  • Email - List of the contact person's email addresses
  • Phones - List of the contact person's phones

Emails - List of the client's email addresses

  • email - Email

Phones - List of the client's phones

  • phone - Phone
  • descr - Phone type
  • inn, kpp, ogrn_client - Codes
  • kr_name, full_name - Name with the legal form (short / full)
  • adres_yur - Legal address
  • dir_name, dir_status - Director and position
  • bank_name, bik, ks, rs - Bank and accounts

The full list of fields is on the Card and company details page. The first set of details becomes the primary one: the tax_id filter in the list works on it.


{
    "name" : "Apple",
    "type_id" : 1,
    "user_id" : 37,

    "Contacts": [
                 {
                  "first_name": "John",
                  "last_name": "Smith",
                  "position": "CEO",
                  "note": "The main decision maker",
                  "status_id": 1,
                  "Emails": [
                              {
                               "email": "John@example.com"
                              }
                            ],
                  "Phones": [
                              {
                               "phone": "+1 234 567890",
                               "descr": "mobile"
                              }
                            ]
                   }
                 ],
        "Emails": [
                     {
                       "email": "company@example.com"
                     }
                  ],
        "Phones": [
                     {
                       "phone": "+1 123 345678",
                        "descr": "Reception"
                      }
                   ]
  }

Note

Required parameters
name (Name)
type_id (Client type code, available in the directory)
user_id (Responsible person code, available in Users)

Example

curl --location --request POST 'https://do.workzeal.com/company/insert' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name" : "Apple",
    "type_id" : 1,
    "user_id" : 37,

    "Contacts": [
                 {
                  "first_name": "John",
                  "last_name": "Smith",
                  "position": "CEO",
                  "note": "The main decision maker",
                  "status_id": 1,
                  "Emails": [
                              {
                               "email": "John@example.com"
                              }
                            ],
                  "Phones": [
                              {
                               "phone": "+1 234 567890",
                               "descr": "mobile"
                              }
                            ]
                   }
                 ],
        "Emails": [
                     {
                       "email": "company@example.com"
                     }
                  ],
        "Phones": [
                     {
                       "phone": "+1 123 345678",
                        "descr": "Reception"
                      }
                   ]
  }
  '
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://do.workzeal.com/company/insert',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "name" : "Apple",
    "type_id" : 1,
    "user_id" : 37,

    "Contacts": [
                 {
                  "first_name": "John",
                  "last_name": "Smith",
                  "position": "CEO",
                  "note": "The main decision maker",
                  "status_id": 1,
                  "Emails": [
                              {
                               "email": "John@example.com"
                              }
                            ],
                  "Phones": [
                              {
                               "phone": "+1 234 567890",
                               "descr": "mobile"
                              }
                            ]
                   }
                 ],
        "Emails": [
                     {
                       "email": "company@example.com"
                     }
                  ],
        "Phones": [
                     {
                       "phone": "+1 123 345678",
                        "descr": "Reception"
                      }
                   ]
  }
  ',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer XXXXX-XXXXXXX-XXXXXXXXX',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://do.workzeal.com/company/insert',
  'headers': {
    'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "name": "Apple",
    "type_id": 1,
    "user_id": 37,
    "Contacts": [
      {
        "first_name": "John",
        "last_name": "Smith",
        "position": "CEO",
        "note": "The main decision maker",
        "status_id": 1,
        "Emails": [
          {
            "email": "John@example.com"
          }
        ],
        "Phones": [
          {
            "phone": "+1 234 567890",
            "descr": "mobile"
          }
        ]
      }
    ],
    "Emails": [
      {
        "email": "company@example.com"
      }
    ],
    "Phones": [
      {
        "phone": "+1 123 345678",
        "descr": "Reception"
      }
    ]
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Directories

For clients

Users

Response

{
  "status": "success",
  "error": null,
  "code": "0",
  "rows": 1,
  "pages": 1,
  "page": 1,
  "value": "1"
}
// value - ID of the new client
Previous
Next