# Request for incoming SMS

## Request for incoming SMS

<mark style="color:green;">`POST`</mark> `http://lk.mysmpp.ru/xml/incoming.php`

#### Headers

| Name                                          | Type   | Description                    |
| --------------------------------------------- | ------ | ------------------------------ |
| Cntent-type<mark style="color:red;">\*</mark> | String | **`text/xml; charset=utf-8;`** |

#### Request Body

| Name                                             | Type   | Description                                                                                                                                                               |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| login.value<mark style="color:red;">\*</mark>    | String | Your login in the system                                                                                                                                                  |
| token.value<mark style="color:red;">\*</mark>    | String | You can use a secret key instead of login and password. To obtain it, please contact your manager                                                                         |
| password.value<mark style="color:red;">\*</mark> | String | Your password in the system                                                                                                                                               |
| time.start<mark style="color:red;">\*</mark>     | String | Time (not inclusive) from which incoming SMS are requested                                                                                                                |
| time.end                                         | String | <p>Time (not inclusive) at which incoming SMS is requested. Not a mandatory parameter. </p><p><mark style="color:orange;">If not set, all SMS will be returned</mark></p> |

{% tabs %}
{% tab title="200: OK If a valid XML document is received" %}

```xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
     <sms id_sms="1234" date_receive="2012-01-31 12:55:55" originator="79612242243" prefix="IGRA" phone="79611111111">Message.</sms>
     <sms id_sms="1234" date_receive="2012-01-31 12:55:55" originator="79612242243" prefix="IGRA" phone="79611111111">Message.</sms>
…
</response>
```

{% endtab %}

{% tab title="400: Bad Request If an error occurs in the sent XML document" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
     <error>Error message</error>
</response>
```

{% endtab %}
{% endtabs %}

### Deciphering parameters in query responses

<table><thead><tr><th width="173.33333333333331">Parameter</th><th width="141">Data type</th><th>Description</th></tr></thead><tbody><tr><td>sms.id_sms</td><td>Int</td><td>A unique number consisting only of digits</td></tr><tr><td>sms.date_receive</td><td>Int</td><td>Date and time of SMS receipt</td></tr><tr><td>sms.originator</td><td>Int</td><td>Phone number of the subscriber who sent the SMS</td></tr><tr><td>sms.prefix</td><td>String</td><td>Prefix. The initial part of the SMS text by which it was determined that this SMS belongs to this particular client. (This is used if the same number is used by different clients).</td></tr><tr><td>sms.phone</td><td>Int</td><td>Phone number to which the SMS was sent</td></tr><tr><td>error</td><td>String</td><td><p>The error text can take the following values:</p><ul><li>Incorrect XML document format </li><li>Incorrect login or password </li><li>POST data is missing</li></ul></td></tr></tbody></table>

### Example XML request

```xml
<?xml version="1.0" encoding="utf-8" ?>
<request>
    <security>
        <login value="login" />
        <password value="password" />
    </security>
    <time start="2012-01-31 12:23:00" end="2012-02-31 12:23:00" />
</request>
```
