|  | Mailing. Server response and error codesThe server sends the response as a string:
 If an error occurred, the response will be one of the following:
 
 When fmt = 0:
 
When fmt = 1:ERROR = N (description) – for 1,2,3,4,5,9 errors.
 
When fmt = 2:0,-N – for errors 1,2,3,4,5,9.
 
When fmt = 3:For 1 errors,2,3,4,5,9:
| <result> <error>description</error>
 <error_code>N</error_code>
 </result>
 | 
 
N – error number, can take the following values:For 1 errors,2,3,4,5,9:
| { "error": "description",
 "error_code": N
 }
 | 
 
 
 
| The value | Description | 
|---|
 | 1 | Error in parameters. | 
|---|
 | 2 | Invalid username or password. Also occurs when trying to send a message from an IP address that is not included in the list of allowed by the Client (if such a list was previously configured by the Client). | 
|---|
 | 3 | Error saving a record. | 
|---|
 | 4 | IP address is temporarily blocked due to frequent errors in the queries. read More | 
|---|
 | 5 | Invalid date format. | 
|---|
 | 9 | Sending more than one identical request for actions with mailing lists within a minute. This error also occurs when you try to send fifteen or more requests simultaneously from different connections under the same username (too many concurrent requests).
 | 
|---|
 If the request is processed successfully, a string of the following format is returned:
 
 When creating a mailing list:
 
 
when cost = 0 and fmt = 0: OK, ID - <id>
 
when cost = 1 and fmt = 0: OK, ID - <id>, COST - <cost>
 
when cost = 0 and fmt = 1: <id>
 
when cost = 1 and fmt = 1: <id>,<cost>
 
when cost = 0 and fmt = 2:
| <result> <id>id</id>
 </result>
 | 
 
when cost = 1 and fmt = 2:
| <result> <id>id</id>
 <cost>cost</cost>
 </result>
 | 
 
when cost = 0 and fmt = 3:
when cost = 1 and fmt = 3:
| { "id": <id>,
 "cost": "<cost>"
 }
 | 
 When you disable or delete a mailing list:
 
 
 
when fmt = 0,1: OK
 
when fmt = 2:| <result>OK</result> | 
 
when fmt = 3:
 When receiving information about a specific mailing list (when mail=1, the "phones" parameter is replaced with " emails"):
 
 
 
when fmt = 0: <id>|<name>|<subject>|<repeat_send>|<repeat_cnt>|<created>|<changed>|<need_date>|<last_sent>|<phones>|<message>|<format>|<validity>|<period>|<frequency>|<status>|<sender_id>
 
when fmt = 1: <id>;<name>;<subject>;<repeat_send>;<repeat_cnt>;<created>;<changed>;<need_date>;<last_sent>;<phones>;<message>;<format>;<validity>;<period>;<frequency>;<status>;<sender_id>
 
when fmt = 2:
| <job> <id>id</id>
 <name>name</name>
 <subject>subject</subject>
 <repeat_send>repeat_send</repeat_send>
 <repeat_cnt>repeat_cnt</repeat_cnt>
 <created>created</created>
 <changed>changed</changed>
 <need_date>need_date</need_date>
 <last_sent>last_sent</last_sent>
 <phones>phones</phones>
 <message>message</message>
 <format>format</format>
 <validity>validity</validity>
 <period>period</period>
 <frequency>frequency</frequency>
 <status>status</status>
 <sender_id>sender_id</sender_id>
 </job>
 | 
 
when fmt = 3:
| [ {
 "id": <id>,
 "name": "<name>",
 "subject": "<subject>",
 "repeat_send": <repeat_send>,
 "repeat_cnt": <repeat_cnt>,
 "created": "<created>",
 "changed": "<changed>",
 "need_date": "<need_date>",
 "last_sent": "<last_sent>",
 "phones": "<phones>",
 "message": "<message>",
 "format": <format>,
 "validity": <validity>,
 "period": "<period>",
 "frequency": <frequency>,
 "status": <status>,
 "cost": "<cost>",
 "sms_sent": <sms_sent>,
 "sms_ok": <sms_ok>,
 "sender_id": "<sender_id>"
 }
 ]
 | 
 
 When receiving a mailing list (when mail=1, the "phones" parameter is replaced with " emails"):
 
 
 
Where:when fmt = 0: <id>|<name>|<changed>|<need_date>|<last_sent>|<phones>|<message>|<phones_cnt>|<cost>|<status>|<sender_id>|<format>
 
when fmt = 1: <id>;<name>;<changed>;<need_date>;<last_sent>;<phones>;<message>;<phones_cnt>;<cost>;<status>;<sender_id>;<format>
 
when fmt = 2:
| <sms_jobs> <job>
 <id>id</id>
 <name>name</name>
 <changed>changed</changed>
 <need_date>need_date</need_date>
 <last_sent>last_sent</last_sent>
 <phones>phones</phones>
 <message>message</message>
 <phones_cnt>phones_cnt</phones_cnt>
 <cost>cost</cost>
 <status>status</status>
 <sender_id>sender_id</sender_id>
 <format>format</format>
 </job>
 ...
 </sms_jobs>
 
 | 
 
when fmt = 3:
| [ {
 "id": <id>,
 "name": "<name>",
 "changed": "<changed>",
 "need_date": "<need_date>",
 "last_sent": "<last_sent>",
 "phones": "<phones>",
 "message": "<message>",
 "phones_cnt": <phones_cnt>,
 "cost": "<cost>",
 "status": <status>,
 "sender_id": "<sender_id>",
 "format": <format>,
 "sms_sent": <sms_sent>,
 "sms_ok": <sms_ok>
 },
 ...
 ]
 | 
 
 <id> – the distribution ID sent by the Client or assigned by the Server automatically.
 <name> – mailing list name.
 <subject> – subject (for e-mail newsletters).
 <repeat_send> – repeat period.
 <repeat_cnt> – the number of repetitions of the mailing list.
 <created> – mailing list creation date.
 <changed> – date of mailing list change.
 <need_date> – scheduled date of dispatch.
 <last_sent> – last sent date.
 <phones> (<emails>) – list of phone numbers (e-mail addresses) of message recipients.
 <message> – the text of the message.
 <format> – message format.
 <validity> – "lifetime" of the message.
 <period> – message sending interval.
 <frequency> – frequency of sending messages.
 <status> – mailing list status.
 <sender_id> – sender ID.
 <phones_cnt> – number of recipients.
 <cost> – cost of sending.
 <sms_sent> – number of messages sent.
 <sms_ok> – number of messages delivered.
 |