---
sidebar_position: 1
description: Create order and other functions to work with CDEK in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, CDEK]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create order
 Creates an order based on field descriptions



`Function CreateOrder(Val Token, Val OrderDescription, Val OnlineStore = False, Val TestAPI = False) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Auth token |
  | OrderDescription | --order | Structure Of KeyAndValue | &#x2714; | Set of order fields. See GetOrderDescription |
  | OnlineStore | --ostore | Boolean | &#x2716; | Flag of Online store order type |
  | TestAPI | --testapi | Boolean | &#x2716; | Flag to use test API for requests |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from CDEK

:::tip
Method at API documentation: [Order registration](https://api-docs.cdek.ru/33828802.html)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    Token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9. ...";

    OrderDescription = New Structure;

    SendLocation = New Structure;
    SendLocation.Insert("code"   , "44");
    SendLocation.Insert("city"   , "Moscow");
    SendLocation.Insert("address", "Ave. Leningradsky, 4");

    DestLocation = New Structure;
    DestLocation.Insert("code"   , "270");
    DestLocation.Insert("city"   , "Novosibirsk");
    DestLocation.Insert("address", "st. Bluchera, 32");

    Recipient = New Structure;

    Phones = New Array;
    Phones.Add(New Structure("number", "+79134637228"));

    Recipient.Insert("phones", Phones);
    Recipient.Insert("name"  , "Ivaniv Ivan");

    Sender = New Structure("name", "Petrov Petr");

    Services = New Array;

    Service = New Structure;
    Service.Insert("code"     , "SECURE_PACKAGE_A2");
    Service.Insert("parameter", 10);

    Services.Add(Service);

    Packages = New Array;

    Package = New Structure;

    Items = New Array;

    Item = New Structure;

    Payment = New Structure;
    Payment.Insert("value", 3000);

    Item.Insert("payment" , Payment);
    Item.Insert("ware_key", "00055");
    Item.Insert("name"    , "Product");
    Item.Insert("cost"    , 300);
    Item.Insert("amount"  , 2);
    Item.Insert("weight"  , 700);
    Item.Insert("url"     , "www.item.ru");

    Items.Add(Item);

    Package.Insert("items"  , Items);
    Package.Insert("number" , "bar-001");
    Package.Insert("comment", "Packaging");
    Package.Insert("height" , 10);
    Package.Insert("length" , 10);
    Package.Insert("weight" , "4000");
    Package.Insert("width"  , 10);

    Packages.Add(Package);

    OrderDescription.Insert("from_location", SendLocation);
    OrderDescription.Insert("to_location"  , DestLocation);
    OrderDescription.Insert("packages"     , Packages);
    OrderDescription.Insert("recipient"    , Recipient);
    OrderDescription.Insert("sender"       , Sender);
    OrderDescription.Insert("services"     , Services);

    OrderDescription.Insert("number"     , String(New UUID));
    OrderDescription.Insert("comment"    , "New order");
    OrderDescription.Insert("tariff_code", 139);

    OrderDescription.Insert("delivery_recipient_cost"    , New Structure("value"        , 50));
    OrderDescription.Insert("delivery_recipient_cost_adv", New Structure("sum,threshold", 3000, 200));

    Result = OPI_CDEK.CreateOrder(Token, OrderDescription, True, True);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint cdek CreateOrder \
             --token "***" \
             --order "{'from_location':{'code':'44','city':'Moscow','address':'Ave. Leningradsky, 4'},'to_location':{'code':'270','city':'Novosibirsk','address':'st. Bluchera, 32'},'packages':[{'items':[{'payment':{'value':'3000'},'ware_key':'***','name':'Product','cost':'300','amount':'2','weight':'700','url':'www.item.ru'}],'number':'bar-001','comment':'Packaging','height':'10','length':'10','weight':'4000','width':'10'}],'recipient':{'phones':[{'number':'+79134637228'}],'name':'Ivaniv Ivan'},'sender':{'name':'Petrov Petr'},'services':[{'code':'SECURE_PACKAGE_A2','parameter':'10'}],'number':'ec4a1208-fa45-424f-bf3a-7f2e1f3d32ea','comment':'New order','tariff_code':'139','delivery_recipient_cost':{'value':'50'},'delivery_recipient_cost_adv':{'sum':'3000','threshold':'200'}}" \
             --ostore true \
             --testapi "***"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint cdek CreateOrder ^
             --token "***" ^
             --order "{'from_location':{'code':'44','city':'Moscow','address':'Ave. Leningradsky, 4'},'to_location':{'code':'270','city':'Novosibirsk','address':'st. Bluchera, 32'},'packages':[{'items':[{'payment':{'value':'3000'},'ware_key':'***','name':'Product','cost':'300','amount':'2','weight':'700','url':'www.item.ru'}],'number':'bar-001','comment':'Packaging','height':'10','length':'10','weight':'4000','width':'10'}],'recipient':{'phones':[{'number':'+79134637228'}],'name':'Ivaniv Ivan'},'sender':{'name':'Petrov Petr'},'services':[{'code':'SECURE_PACKAGE_A2','parameter':'10'}],'number':'ec4a1208-fa45-424f-bf3a-7f2e1f3d32ea','comment':'New order','tariff_code':'139','delivery_recipient_cost':{'value':'50'},'delivery_recipient_cost_adv':{'sum':'3000','threshold':'200'}}" ^
             --ostore true ^
             --testapi "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "entity": {
  "uuid": "5d3e05be-c41a-40ed-9511-44098c81fcbe"
 },
 "requests": [
  {
   "request_uuid": "bddfc105-0a91-447e-8e5e-d9b1e9dbfdec",
   "type": "CREATE",
   "date_time": "2025-12-10T20:09:58+00:00",
   "state": "ACCEPTED"
  }
 ],
 "related_entities": []
}
```
