API Specification
amoCRM’s API is implemented based on the standard HTTPS protocol. POST requests and responses are implemented in XML. To work with the API, you can use CURL (see http://en.wikipedia.org/wiki/CURL) or other libraries that can make requests to external services.
All requests must be done not on a common domain http://www.amocrm.com, and the exact address of your account, for example, https://company.amocrm.com or https://qsoft.amocrm.com. Also note that requests must be made in HTTPS.
Authorization
The program provides two types of authorization:
- Via user login and password
- Via special keys (Tokens), which are available on the Edit User Profile screen. However, a new key is generated each time the password is changed.
For authorization, do the following query:
- Page Request: /private/api/auth.php
- POST-parameters for authentication through login and password: USER_LOGIN=Login&USER_PASSWORD=password
- POST-parameters for the authorization key: USER_LOGIN=Login&USER_HASH=key
You receive an XML response with the following structure:
<root>
<auth>true <!-- (or false otherwise) --></auth>
</root>
Contacts
Contacts list
For a list of contacts, make a request to the page /private/api/contacts.php. In response, XML will be returned with contact information.
Number of items issued will correspond to the count, which the user specified when the list of contacts in the normal interface (this setting is saved in the preferences of users). If you want to specify a different value, then you can use the ELEMENT_CONT (for example, &ELEMENT_CONT=30). Information on pages contained in the XML-tags, in response <onpage>, <totalpages> and <currpage>
Contact search
To find a contact for any keyword or (e-mail, name, company name, etc.) must make a request to the page /private/api/contact_search.php and the parameter to pass the word SEARCH. In response XML will be issued similar to that displayed in the contact list.
Detailed contact page
For complete information on a specific contact, make a request to the page /private/api/contact_detail.php and pass a parameter ID with a unique pin number (transmitted, for example, when constructing a list of contacts). In response, XML will be returned with complete information on the contact, related notes, and the tasks for users.
Add Contact
To add a contact to call the page /private/api/contact_add.php and tell her the following POST-parameters:
ACTION = ADD_PERSON
contact = Array (
'person_name' => 'Name',
'person_position' => 'Title'
'person_company_name' => 'The Company'
'person_company_id' => 'ID of the company, if you know it'
'contact_data' => Array (
'phone_numbers' => Array (
0 => Array ('number' => '+1 495 123-45-67'),
1 => Array ('location' => 'Work'),
2 => Array ('number' => '+1 499 891-01-11'),
3 => Array ('location' => 'Mobile')
),
'email_addresses' => Array (
0 => Array('address' => 'maks@qsoftus.com'),
1 => Array('location' => 'Work')
),
'web_addresses' => Array(
0 => Array('url' => 'http://www.amocrm.com')
),
'addresses' => Array(
'street' => 'Address'
),
'instant_messengers' => Array(
0 => Array('address' => 'imaddr'),
1 => Array('protocol' => 'Skype')
)
)
)
Editing a contact
To edit a contact, call the /private/api/contact_add.php and pass the following parameters:
- ACTION=EDIT
- ID=ID of contact
- contact= data structure similar to that used when adding a contact (you need to transfer all the contact information, regardless of whether the field has changed or not)
Deleting a contact
To delete a contact, call page /private/api/contact_delete.php with the following parameters:
- ACTION=DELETE
- ID=ID of contact
Deals
Deals list
For a list of deals, make a request to the page /private/ api / deals.php. In response, XML will be returned with information about the deals associated with the deal’s contacts, users, and information about the tags.
Number of items issued will correspond to the count, which the user specified when the list of transactions in the normal interface (this setting is saved in the user’s preferences). If you want to specify a different value, then you can use the ELEMENT_CONT (for example, &ELEMENT_CONT=30). Information on pages contained in the XML-tags, in response <onpage>, <totalpages> and <currpage>
Search for deals
To find a deal by keyword (such as an associated e-mail, name, company name, etc.) you must make a request to the page /private/api/deal_search.php and the parameter to pass the word SEARCH. In response XML will be returned similar to that displayed in the list of deals.
Detailed deal page
For complete information on a particular deal, make a request to the page /private/api/deal_detail.php and pass a parameter ID with the deal’s unique number (transmitted, for example, when constructing a list of deals). In response XML will be returned with complete information on the deal, contact, related to the notes on the tasks of users.
Adding a deal
To add a deal, call page /private/api/deal_add.php and tell her the following POST-parameters:
ACTION=ADD
deal = Array (
'name' => 'Name deal'
'status_id' => 'ID status deal'
'price' => 'price (number)',
'main_user_id' => 'ID user charge'
'tags' => 'tag teg2, teg3'
'linked_contact' => 'ID-related contact'
)
Editing deal
To edit a deal, call /private/api/deal_add.php and pass the following parameters:
- ACTION=EDIT
- ID= ID deal
- deal= data structure similar to that used when adding a transaction (must pass all of these transactions, regardless of whether the field has changed or not)
Deleting deal
To delete deal, call the page /private/api/deal_delete.php with the following parameters:
- ACTION= DELETE
- ID= ID deal
Notes
List of notes
For a list of the notes on an object (contact or deal), you must request a detailed page on the object. All linked notes will be automatically returned in the XML-response.
Add a note
To add a note to turn the page /private/api/note_add.php and pass mark. options:
- ACTION=ADD_NOTE
- BODY=note text
- ID=ID associated object
- ELEMENT_TYPE=1 for contacts, 2 for deals
Editing notes
To edit the notes page, perform /private/api/note_add.php to trace. parameters:
- ACTION=EDIT_NOTE
- ID=ID editing notes
- BODY= text notes
Deleting comments
Inquiry is necessary to make a page /private/api/note_add.php. Command Line Options:
- ACTION=NOTE_DELETE
- ID=ID to delete comments
Tasks
Task List
For a list of tasks that are linked to an object (contact or deal), you must request a detailed page on the object. All related tasks will be automatically returned in the XML-response.
Adding a task
To add a task, you must turn the page /private/api/task_add.php and pass mark. options:
- ACTION = ADD_TASK
- BODY => text about task
- END_DATE => date in the format of the task DD.MM.YYYY HH: MI: SS (eg, 01/14/2011 2:00:00)
- MAIN_USER => ID the user to whom the task
- ID => ID associated object (not required)
- ELEMENT_TYPE => 1 for contacts, 2 for deals (required if ID is defined)
- TASK_TYPE => type of problem, maybe CALL / LETTER / MEETING
Editing tasks
To edit a task, make a request to the page /private/api/task_add.php to trace. parameters:
- ACTION = EDIT_TASK
- ID = ID editing tasks
- BODY => Text problem
- END_DATE => date in the format of the task DD.MM.YYYY HH:MM:SS (eg, 01/14/2011 2:00:00)
- MAIN_USER => ID of the user to whom the task is primarily assigned
- TASK_OBJECT => ID of associated object (not required)
- ELEMENT_TYPE => 1 for contacts, 2 for deals (required if ID is defined)
- TASK_TYPE => type of problem, maybe CALL / LETTER / MEETING
Deleting tasks
Inquiry is necessary to make page /private/api/task_add.php. Command Line Options:
- ACTION = TASK_DELETE
- ID = ID Removes
Completing tasks
To set a task as complete, you must request the page /private/api/task_add.php and pass the following parameters:
- ACTION = COMPLATE_TASK
- ID = ID Removes