# Доставки

## Работа с доставками

## Получение списка доставок

<mark style="color:blue;">`GET`</mark> `https://api.lpmotor.ru/v1/delivery/site/{site_id}`

#### Path Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| site\_id | string | ID сайта    |

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| X-Api-User-Id | string | ID пользователя |
| Authorization | string | API-токен       |

{% tabs %}
{% tab title="200 Для доставок, у которых template\_id от 1 до 4, в ответе будет "internal\_info": null" %}

```
[
  {
    "id": 0,
    "template_id": 0,
    "site_id": 0,
    "title": "string",
    "price": "string",
    "free_start_from": "string",
    "creator_id": 0,
    "d_created": "2021-08-04T15:28:46.655Z",
    "d_updated": "2021-08-04T15:28:46.655Z",
    "enabled": true,
    "deleted": true,
    "points": [
      {
        "id": 0,
        "title": "string",
        "price": "string",
        "free_start_from": "string",
        "country": "string",
        "city": "string",
        "zip": "string",
        "street": "string",
        "building_number": "string",
        "office_number": "string",
        "floor": 0,
        "comment": "string",
        "enabled": true,
        "deleted": true
      }
    ],
    "regions": [
      {
        "id": 0,
        "title": "string",
        "price": "string",
        "free_start_from": "string",
        "comment": "string",
        "enabled": true,
        "deleted": true,
        "coordinates": [[0, 0],[0, 0],[0, 0]]
      }
    ],
    "additional_fields": [
      {
        "id": 0,
        "name": "string",
        "label": "string",
        "parent_id": "string"
      }
    ],
    "cities": [
      {
        "id": 0,
        "city_type": "string",
        "city": "string"
      }
    ],
    "pos": 0,
    "internal_info": {
      "tariff_code": 0,
      "from_city_code": 0,
      "pvz_code": "string",
      "sender_address": "string",
      "company_name": "string",
      "sender_name": "string",
      "sender_email": "string",
      "sender_phone": "string",
      "medium_width": 0,
      "medium_length": 0,
      "medium_height": 0,
      "medium_weight": 0,
      "calculation_type": "string",
      "added_value": 0,
      "need_create_order": true
    }
  }
]
```

{% endtab %}

{% tab title="403 Could not find a cake matching this query." %}

```
{
    "title": "user hasnt access to delivery",
    "error": 24,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/delivery/site/11111"
```

{% endtab %}

{% tab title="PHP CURL" %}

```
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->get(
    '/v1/delivery/site/' . $siteId
);
$statusCode = $response->getStatusCode();
$deliveries = json_decode((string) $response->getBody(), true);
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.get("/v1/delivery/site/" + siteId);
```

{% endtab %}
{% endtabs %}

## Создание доставки

<mark style="color:green;">`POST`</mark> `https://api.lpmotor.ru/v1/delivery`

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| X-Api-User-Id | string | ID пользователя |
| Authorization | string | API-токен       |

#### Request Body

| Name                               | Type    | Description                                                                                                                                                             |
| ---------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| template\_id                       | integer | ID шаблона доставки. Возможные значения: *1* - универсальный, *2* - самовывоз, *3* - курьером, *4* - курьером с автоматическим подсчетом стоимости, *5* - через ТК CDEK |
| title                              | string  | Название доставки                                                                                                                                                       |
| site\_id                           | integer | ID сайта                                                                                                                                                                |
| price                              | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                                                 |
| free\_start\_from                  | number  | Минимальная стоимость заказа, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                                                          |
| enabled                            | boolean | Флаг доступности доставки                                                                                                                                               |
| regions                            | array   | Районы доставки. Обязателен для шаблонов *3* и *4*                                                                                                                      |
| regions\[].title                   | string  | Название района доставки                                                                                                                                                |
| regions\[].price                   | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                                                 |
| regions\[].free\_start\_from       | number  | Минимальная стоимость заказа, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                                                          |
| regions\[].comment                 | string  | Подсказка для доставки. **По умолчанию: null**                                                                                                                          |
| regions\[].enabled                 | boolean | Флаг доступности доставки                                                                                                                                               |
| regions\[].coordinates             | array   | Массив координат точек, определяющих район доставки. **По умолчанию: null**                                                                                             |
| points                             | array   | Точки самовывоза. Обязателен для шаблона *2*                                                                                                                            |
| points\[].title                    | string  | Название точки самовывоза                                                                                                                                               |
| points\[].price                    | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                                                 |
| points\[].free\_start\_from        | number  | Минимальная стоимость заказа, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                                                          |
| points\[].enabled                  | boolean | Флаг доступности доставки                                                                                                                                               |
| points\[].comment                  | string  | Подсказка для доставки. **По умолчанию: null**                                                                                                                          |
| additional\_fields                 | array   | Дополнительные поля для доставки                                                                                                                                        |
| additional\_fields\[].id           | integer | ID дополнительного поля. Возможные значения: *1* - поле Адрес, *2* - поле с обязательным вводом адреса, *3* - поле Комментарий                                          |
| cities                             | array   | Города, в которых доступна доставка                                                                                                                                     |
| cities\[].id                       | integer | ID города                                                                                                                                                               |
| internal\_info                     | object  | Дополнительные данные для доставки. Обязателен для шаблона *5*                                                                                                          |
| internal\_info.tariff\_code        | integer | Код тарифа в CDEK                                                                                                                                                       |
| internal\_info.from\_city\_code    | integer | Код города, из которого будет осуществлена доставка                                                                                                                     |
| internal\_info.pvz\_code           | string  | Код ПВЗ, на который будет доставлен заказ отправителем                                                                                                                  |
| internal\_info.sender\_address     | string  | Адрес отправителя                                                                                                                                                       |
| internal\_info.company\_name       | string  | Название компании отправителя                                                                                                                                           |
| internal\_info.sender\_name        | string  | Имя отправителя                                                                                                                                                         |
| internal\_info.sender\_email       | string  | Электронный адрес отправителя                                                                                                                                           |
| internal\_info.sender\_phone       | string  | Телефон отправителя                                                                                                                                                     |
| internal\_info.medium\_width       | integer | Средняя ширина товара                                                                                                                                                   |
| internal\_info.medium\_length      | integer | Средняя длина товара                                                                                                                                                    |
| internal\_info.medium\_height      | integer | Средняя высота товара                                                                                                                                                   |
| internal\_info.medium\_weight      | integer | Средний вес товара                                                                                                                                                      |
| internal\_info.calculation\_type   | string  | Тип стоимости доставки. Возможные значения: *CALCULATION* - расчет стоимости через CDEK, *FIX\_PRICE* - фиксированная стоимость доставки                                |
| internal\_info.added\_value        | number  | Добавочная стоимость к текущей стоимости доставки                                                                                                                       |
| internal\_info.need\_create\_order | boolean | Флаг автоматического создания доставки в CDEK                                                                                                                           |

{% tabs %}
{% tab title="201 Для доставок, у которых template\_id от 1 до 4, в ответе будет "internal\_info": null " %}

```
{
  "id": 0,
  "template_id": 0,
  "site_id": 0,
  "title": "string",
  "price": "string",
  "free_start_from": "string",
  "creator_id": 0,
  "d_created": "2021-08-06T11:49:34.828Z",
  "d_updated": "2021-08-06T11:49:34.828Z",
  "enabled": true,
  "deleted": true,
  "points": [
    {
      "id": 0,
      "title": "string",
      "price": "string",
      "free_start_from": "string",
      "country": "string",
      "city": "string",
      "zip": "string",
      "street": "string",
      "building_number": "string",
      "office_number": "string",
      "floor": 0,
      "comment": "string",
      "enabled": true,
      "deleted": true
    }
  ],
  "regions": [
    {
      "id": 0,
      "title": "string",
      "price": "string",
      "free_start_from": "string",
      "comment": "string",
      "enabled": true,
      "deleted": true,
      "coordinates": [[0, 0],[0, 0],[0, 0]]
    }
  ],
  "additional_fields": [
    {
      "id": 0,
      "name": "string",
      "label": "string",
      "parent_id": "string"
    }
  ],
  "cities": [
    {
      "id": 0,
      "city_type": "string",
      "city": "string"
    }
  ],
  "pos": 0,
  "internal_info": {
    "tariff_code": 0,
    "from_city_code": 0,
    "pvz_code": "string",
    "sender_address": "string",
    "company_name": "string",
    "sender_name": "string",
    "sender_email": "string",
    "sender_phone": "string",
    "medium_width": 0,
    "medium_length": 0,
    "medium_height": 0,
    "medium_weight": 0,
    "calculation_type": "string",
    "added_value": 0,
    "need_create_order": true
  }
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "title": "cant create delivery",
    "error": 26,
    "code": 400
}
```

{% endtab %}

{% tab title="403 " %}

```
{
    "title": "user hasnt access to delivery",
    "error": 24,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X POST "https://api.lpmotor.ru/v1/delivery" \ 
-d '{"template_id":2,"title":"delivery name","site_id":11111,"enabled":true,"regions":[],"points":[{"title":"test point","comment":"this is comment","enabled":true}],"additional_fields":[{"id":1},{"id":2}]}'
```

{% endtab %}

{% tab title="PHP CURL" %}

```
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->post(
    '/v1/delivery',
    [
        'json' => [
            'template_id' => 2,
            'site_id' => $siteId,
            'title' => 'my delivery',
            'enabled' => true,
            'regions' => [],
            'points' => [
                [
                    'title' => 'test point',
                    'comment' => 'this is comment',
                    'enabled' => true
                ],
            ],
            'additional_fields' => [
                ['id' => 1],
                ['id' => 2],
            ],
        ],
    ]
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.post('/v1/delivery', {
    "template_id": 1,
    "title": "delivery name",
    "site_id": 11111,
    "enabled": true,
    "regions": [],
    "points": [
        {
            "title": "test point",
            "comment": "this is comment",
            "enabled": true
        }
    ],
    "additional_fields": [
        {
            "id": 1
        },
        {
            "id": 2
        }
    ]
});
```

{% endtab %}
{% endtabs %}

## Получение доставки по ID

<mark style="color:blue;">`GET`</mark> `https://api.lpmotor.ru/v1/delivery/{delivery_id}`

#### Path Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| delivery\_id | string | ID доставки |

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| X-Api-User-Id | string | ID пользователя |
| Authorization | string | API-токен       |

{% tabs %}
{% tab title="200 Для доставок, у которых template\_id от 1 до 4, в ответе будет "internal\_info": null" %}

```
{
  "id": 0,
  "template_id": 0,
  "site_id": 0,
  "title": "string",
  "price": "string",
  "free_start_from": "string",
  "creator_id": 0,
  "d_created": "2021-08-06T13:13:39.239Z",
  "d_updated": "2021-08-06T13:13:39.239Z",
  "enabled": true,
  "deleted": true,
  "points": [
    {
      "id": 0,
      "title": "string",
      "price": "string",
      "free_start_from": "string",
      "country": "string",
      "city": "string",
      "zip": "string",
      "street": "string",
      "building_number": "string",
      "office_number": "string",
      "floor": 0,
      "comment": "string",
      "enabled": true,
      "deleted": true
    }
  ],
  "regions": [
    {
      "id": 0,
      "title": "string",
      "price": "string",
      "free_start_from": "string",
      "comment": "string",
      "enabled": true,
      "deleted": true,
      "coordinates": [[0, 0],[0, 0],[0, 0]]
    }
  ],
  "additional_fields": [
    {
      "id": 0,
      "name": "string",
      "label": "string",
      "parent_id": "string"
    }
  ],
  "cities": [
    {
      "id": 0,
      "city_type": "string",
      "city": "string"
    }
  ],
  "pos": 0,
  "internal_info": {
    "tariff_code": 0,
    "from_city_code": 0,
    "pvz_code": "string",
    "sender_address": "string",
    "company_name": "string",
    "sender_name": "string",
    "sender_email": "string",
    "sender_phone": "string",
    "medium_width": 0,
    "medium_length": 0,
    "medium_height": 0,
    "medium_weight": 0,
    "calculation_type": "string",
    "added_value": 0,
    "need_create_order": true
  }
}
```

{% endtab %}

{% tab title="403 " %}

```
{
    "title": "user hasnt access to delivery",
    "error": 24,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X GET "https://api.lpmotor.ru/v1/delivery/1" 
```

{% endtab %}

{% tab title="PHP CURL" %}

```
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->get(
    '/v1/delivery/' . $deliveryId
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.get("/v1/delivery/" + deliveryId);
```

{% endtab %}
{% endtabs %}

## Изменение доставки

<mark style="color:orange;">`PUT`</mark> `https://api.lpmotor.ru/v1/delivery`

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| X-Api-User-Id | string | ID пользователя |
| Authorization | string | API-токен       |

#### Request Body

| Name                               | Type    | Description                                                                                                                              |
| ---------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| id                                 | integer | ID доставки                                                                                                                              |
| title                              | string  | Название доставки                                                                                                                        |
| price                              | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                  |
| free\_start\_from                  | number  | Минимальная стоимость заказа, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                           |
| enabled                            | boolean | Флаг доступности доставки                                                                                                                |
| pos                                | integer | Позиция доставки в списке                                                                                                                |
| regions                            | array   | Районы доставки. Обязателен для шаблонов *3* и *4*                                                                                       |
| regions\[].id                      | integer | ID района доставки                                                                                                                       |
| regions\[].title                   | string  | Название района доставки                                                                                                                 |
| regions\[].price                   | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                  |
| regions\[].free\_start\_from       | number  | Минимальная стоимость доставки, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                         |
| regions\[].comment                 | string  | Подсказка для доставки. **По умолчанию: null**                                                                                           |
| regions\[].enabled                 | boolean | Флаг доступности района доставки                                                                                                         |
| regions\[].coordinates             | array   | Массив координат точек, определяющих район доставки. **По умолчанию: null**                                                              |
| points                             | array   | Точки самовывоза. Обязателен для шаблона *2*                                                                                             |
| points\[].id                       | integer | ID точки самовывоза                                                                                                                      |
| points\[].title                    | string  | Название точки самовывоза                                                                                                                |
| points\[].price                    | number  | Стоимость доставки. **По умолчанию: 0**                                                                                                  |
| points\[].free\_start\_from        | number  | Минимальная стоимость заказа, начиная с которой доставка будет бесплатной. **По умолчанию: 0**                                           |
| points\[].enabled                  | boolean | Флаг доступности доставки                                                                                                                |
| points\[].comment                  | string  | Подсказка для доставки. **По умолчанию: null**                                                                                           |
| additional\_fields                 | array   | Дополнительные поля для доставки                                                                                                         |
| additional\_fields\[].id           | integer | ID дополнительного поля. Возможные значения: *1* - поле Адрес, *2* - поле с обязательным вводом адреса, *3* - поле Комментарий           |
| cities                             | array   | Города, в которых доступна доставка                                                                                                      |
| cities\[].id                       | integer | ID города                                                                                                                                |
| internal\_info                     | object  | Дополнительные данные для доставки. Обязателен для шаблона *5*                                                                           |
| internal\_info.tariff\_code        | integer | Код тарифа в CDEK                                                                                                                        |
| internal\_info.from\_city\_code    | integer | Код города, из которого будет осуществлена доставка                                                                                      |
| internal\_info.pvz\_code           | string  | Код ПВЗ, в который будет доставлен заказ отправителем                                                                                    |
| internal\_info.sender\_address     | string  | Адрес отправителя                                                                                                                        |
| internal\_info.company\_name       | string  | Название компании отправителя                                                                                                            |
| internal\_info.sender\_name        | string  | Имя отправителя                                                                                                                          |
| internal\_info.sender\_email       | string  | Электронный адрес отправителя                                                                                                            |
| internal\_info.sender\_phone       | string  | Телефон отправителя                                                                                                                      |
| internal\_info.medium\_width       | integer | Средняя ширина товара                                                                                                                    |
| internal\_info.medium\_length      | integer | Средняя длина товара                                                                                                                     |
| internal\_info.medium\_height      | integer | Средняя высота товара                                                                                                                    |
| internal\_info.medium\_weight      | integer | Средний вес товара                                                                                                                       |
| internal\_info.calculation\_type   | string  | Тип стоимости доставки. Возможные значения: *CALCULATION* - расчет стоимости через CDEK, *FIX\_PRICE* - фиксированная стоимость доставки |
| internal\_info.added\_value        | number  | Добавочная стоимость к текущей стоимости доставки                                                                                        |
| internal\_info.need\_create\_order | boolean | Флаг автоматического создания доставки в CDEK                                                                                            |

{% tabs %}
{% tab title="201 Для доставок, у которых template\_id от 1 до 4, в ответе будет "internal\_info": null " %}

```
{
  "id": 0,
  "title": "string",
  "price": 0,
  "free_start_from": 0,
  "enabled": true,
  "pos": 0,
  "regions": [
    {
      "id": 0,
      "title": "string",
      "price": 0,
      "free_start_from": 0,
      "comment": "string",
      "enabled": true,
      "coordinates": [
        [
          0, 0
        ]
      ]
    }
  ],
  "points": [
    {
      "id": 0,
      "title": "string",
      "price": 0,
      "free_start_from": 0,
      "country": "string",
      "city": "string",
      "zip": "string",
      "street": "string",
      "building_number": "string",
      "office_number": "string",
      "floor": 0,
      "comment": "string",
      "enabled": true
    }
  ],
  "additional_fields": [
    {
      "id": 0
    }
  ],
  "cities": [
    {
      "id": 0
    }
  ],
  "internal_info": {
    "tariff_code": 0,
    "from_city_code": 0,
    "pvz_code": "string",
    "sender_address": "string",
    "company_name": "string",
    "sender_name": "string",
    "sender_email": "string",
    "sender_phone": "string",
    "medium_width": 0,
    "medium_length": 0,
    "medium_height": 0,
    "medium_weight": 0,
    "calculation_type": "string",
    "added_value": 0,
    "need_create_order": true
  }
}
```

{% endtab %}

{% tab title="403 " %}

```
{
    "title": "user hasnt access to delivery",
    "error": 24,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X PUT "https://api.lpmotor.ru/v1/delivery" \ 
-d '{"id":1,"title":"new delivery name","enabled":false,"pos":1,"points":[],"regions":[{"id":1,"title":"new region name","enabled":true}]}'
```

{% endtab %}

{% tab title="PHP CURL" %}

```
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->put(
    '/v1/delivery',
    [
        'json' => [
            'id' => 1,
            'title' => 'my delivery',
            'enabled' => true,
            'pos' => 1,
            'regions' => [
                [
                    'id' => 1,
                    'title' => 'test point',
                    'comment' => 'this is comment',
                    'enabled' => true
                ],
            ],
        ],
    ]
);
$statusCode = $response->getStatusCode();
$delivery = json_decode((string) $response->getBody(), true);
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.put('/v1/delivery', {
    "id": 1,
    "title": "delivery name",
    "pos": 1,
    "enabled": true,
    "regions": [
        {
            "id": 1,
            "title": "test point",
            "comment": "this is comment",
            "enabled": true
        }
    ],
});
```

{% endtab %}
{% endtabs %}

## Удаление доставки

<mark style="color:red;">`DELETE`</mark> `https://api.lpmotor.ru/v1/delivery/{delivery_id}`

#### Path Parameters

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| delivery\_id | string | ID доставки |

#### Headers

| Name          | Type   | Description     |
| ------------- | ------ | --------------- |
| X-Api-User-Id | string | ID пользователя |
| Authorization | string | API-токен       |

{% tabs %}
{% tab title="204 " %}

```
```

{% endtab %}

{% tab title="403 " %}

```
{
    "title": "user hasnt access to delivery",
    "error": 24,
    "code": 403
}
```

{% endtab %}
{% endtabs %}

#### Пример запроса

{% tabs %}
{% tab title="CURL" %}

```bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-User-Id: <<Your-user-id>>" \
-H "Authorization: Bearer <<Your-API-token>>" \
-X DELETE "https://api.lpmotor.ru/v1/delivery/1" 
```

{% endtab %}

{% tab title="PHP CURL" %}

```
```

{% endtab %}

{% tab title="PHP Guzzle" %}

```php
<?php
$client = new GuzzleHttp\Client([
    'base_uri' => 'https://api.lpmotor.ru',
    'headers'  => [
        'Content-Type'  => 'application/json',
        'Accept'        => 'application/json',
        'X-Api-User-Id' => $userId,
        'Authorization' => 'Bearer ' . $apiKey,
    ],
]);
$response = $client->delete(
    '/v1/delivery/1'
);
$statusCode = $response->getStatusCode();
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
http = Axios.create({
    baseURL: "https://api.lpmotor.ru",
    timeout: 60000,
    headers: {
        "Content-Type" : "application/json",
        "Accept"       : "application/json",
        "Cache-Control": "no-cache, no-store, must-revalidate",
        "X-Api-User-Id": userId,
        "Authorization": "Bearer " + myApiKey,
    }
});
http.delete("/v1/delivery/1");
```

{% endtab %}
{% endtabs %}
