API documentation
Method list
Test your request
Changelog


addCrmClient
The method allows you to add a new CRM client. Adding a client with the same crm_client_id again will update the previously saved client (only the provided fields will be changed).


Input parameters
crm_client_idintCRM client ID. If provided and greater than 0, the existing client will be updated. If 0 or omitted, a new client will be created.
status_idintCRM client status ID.
starintStar type. Values from 0 to 5. 0 means no star.
contractor_idintBase Connect contractor ID associated with the client (the list can be retrieved with getConnectIntegrationContractors method).
loginvarchar(156)Client login name.
phonevarchar(156)Client phone number.
emailvarchar(220)Client email address.
notestextClient notes.
invoice_companyvarchar(500)Invoice company name.
invoice_fullnamevarchar(500)Invoice full name.
invoice_addressvarchar(500)Invoice address.
invoice_postcodevarchar(20)Invoice postcode.
invoice_cityvarchar(100)Invoice city.
invoice_statevarchar(35)Invoice state/province.
invoice_country_codevarchar(2)Invoice country code (ISO 3166-1 alpha-2).
invoice_tax_idvarchar(50)Invoice tax ID (NIP). Whitespace and dashes are automatically removed.
delivery_companyvarchar(500)Delivery company name.
delivery_fullnamevarchar(500)Delivery full name.
delivery_addressvarchar(500)Delivery address.
delivery_postcodevarchar(20)Delivery postcode.
delivery_cityvarchar(100)Delivery city.
delivery_statevarchar(35)Delivery state/province.
delivery_country_codevarchar(2)Delivery country code (ISO 3166-1 alpha-2).
custom_extra_fieldsarrayA list containing CRM client custom extra fields, where the key is the extra field ID and value is an extra field content for given extra field. The list of extra fields can be retrieved with getCrmClientExtraFields method.
In case of removing a field the empty string is expected.
In case of file the following format is expected:
{
    "title": "file.pdf" (varchar(40) - the file name)
    "file": "data:4AAQSkZJRgABA[...]" (base64 - the file body limited to 2MB)
}



Output data
The method returns the data in JSON format.
statusvarchar(30)SUCCESS - request executed correctly
ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code
crm_client_idintID of the created or updated CRM client.



Sample
Input data:
Output data:
A sample request in PHP: