# Create an order

Method : <mark style="color:green;">**POST**</mark> &#x20;

{% code fullWidth="false" %}

```url
https://os.vucustom.com/api/v1/orders
```

{% endcode %}

<details>

<summary>Example Request </summary>

{% code fullWidth="true" %}

```json
    "order": {
        "currency": "USD",
        "custom_attributes": {},
        "note": "Sample note.",
        "order_date": "2022-10-31T01:54:56.271Z",
        "order_lines": [
            {
                "custom_attributes": {},
                "customer_requested_date": "2023-05-23",
                "factory_code": "factory123",
                "line_reference": "59861396",
                "price": 70,
                "product_description": "My Widget",
                "quantity": 1,
                "recipe_token": "1609c0e8",
                "sku": "SKU123",
                "tags": [
                    "tag1",
                    "tag2"
                ],
                "upc": "UPC123"
            }
        ],
        "order_number": "ord-12345",
        "purchase_order_number": "po-12345",
        "sales_order_number": "so-12345",
        "ship_method_carrier": "UPS",
        "ship_method_code": "XY12",
        "ship_method_description": "UPS Ground Residential",
        "sales_channel": "b2b",
        "ship_to": {
            "account_number": "SHPTO123",
            "address_1": "123 Main St",
            "address_2": "",
            "city": "Ridgewood",
            "company_name": "VU Custom",
            "country": "US",
            "first_name": "John",
            "last_name": "Smith",
            "phone": "2011231234",
            "postal_code": "07450",
            "state_region": "NJ"
        },
        "sold_to": {
            "account_number": "SLDTO123",
            "address_1": "123 Main St",
            "address_2": "",
            "city": "Ridgewood",
            "company_name": "VU Custom",
            "country": "US",
            "first_name": "John",
            "last_name": "Smith",
            "phone": "2011231234",
            "postal_code": "07450",
            "state_region": "NJ"
        },
        "tags": [
            "tag1",
            "tag2"
        ]
    }
}
```

{% endcode %}

</details>

Request Body Schema (Order)

<table><thead><tr><th width="244">Field Name</th><th width="86">Type</th><th width="109">Required</th><th>Description</th></tr></thead><tbody><tr><td>currency</td><td>string</td><td>Yes</td><td>Unique identifier for the sold-to account</td></tr><tr><td>custom_attributes</td><td>object</td><td>No</td><td>Key-value pairs of custom data. this can be empty</td></tr><tr><td>note</td><td>string</td><td>No</td><td>Order notes. this can be empty</td></tr><tr><td>order_date</td><td>string</td><td>Yes</td><td>ISO 8601 datetime</td></tr><tr><td>order_number</td><td>string</td><td>Yes</td><td>Unique order identifier</td></tr><tr><td>purchase_order_number</td><td>string</td><td>No</td><td>PO reference number. this can be empty</td></tr><tr><td>ship_method_carrier</td><td>string</td><td>Yes</td><td>Carrier code</td></tr><tr><td>ship_method_code</td><td>string</td><td>Yes</td><td>Service level code</td></tr><tr><td>ship_method_description</td><td>string</td><td>Yes</td><td>Service description</td></tr><tr><td>sales_channel</td><td>string</td><td>Yes</td><td>Channel type (b2b/b2c)</td></tr><tr><td>tags</td><td>array</td><td>No</td><td>Order tags</td></tr><tr><td>order_lines</td><td>array</td><td>Yes</td><td>Order line items</td></tr><tr><td>ship_to</td><td>object</td><td>Yes</td><td>Shipping details</td></tr><tr><td>sold_to</td><td>object</td><td>Yes</td><td>Billing details</td></tr><tr><td>b2b</td><td>object</td><td>Yes</td><td>B2B specific information. required only for b2b</td></tr></tbody></table>

Request Body Schema (Order lines)

<table><thead><tr><th width="252">Field Name</th><th width="92">Type</th><th width="106">Required</th><th width="298">Description</th></tr></thead><tbody><tr><td>custom_attributes</td><td>object</td><td>No</td><td>Line item custom data</td></tr><tr><td>customer_requested_date</td><td>string</td><td>No</td><td>Requested delivery date</td></tr><tr><td>factory_code</td><td>string</td><td>No</td><td>Manufacturing facility code</td></tr><tr><td>line_reference</td><td>string</td><td>No</td><td>External reference</td></tr><tr><td>price</td><td>Integer</td><td>yes</td><td>Unit price</td></tr><tr><td>product_description</td><td>string</td><td>Yes</td><td>Product description</td></tr><tr><td>quantity</td><td>Integer</td><td>Yes</td><td>Order quantity</td></tr><tr><td>recipe_token</td><td>string</td><td>Yes</td><td>Customization reference</td></tr><tr><td>sku</td><td>string</td><td>Yes</td><td>Product SKU</td></tr><tr><td>tags</td><td>array</td><td>No</td><td>Line item tags. this array an be empty</td></tr><tr><td>upc</td><td>string</td><td>No</td><td>Product UPC</td></tr></tbody></table>

Request Body Schema (ship\_to) and (sold\_to)

<table><thead><tr><th width="255">Field Name</th><th width="92">Type</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>account_number</td><td>string</td><td>Yes</td><td>Unique identifier for the sold-to account</td></tr><tr><td>address_1</td><td>string</td><td>Yes</td><td>Primary address line</td></tr><tr><td>address_2</td><td>string</td><td>No</td><td>Secondary address line, can be empty</td></tr><tr><td>city</td><td>string</td><td>Yes</td><td>City name</td></tr><tr><td>company_name</td><td>string</td><td>No</td><td>Business or company name, can be empty</td></tr><tr><td>country</td><td>string</td><td>Yes</td><td>Two-letter country code (ISO 3166-1 alpha-2)</td></tr><tr><td>first_name</td><td>string</td><td>Yes</td><td>Customer's first name</td></tr><tr><td>last_name</td><td>string</td><td>Yes</td><td>Customer's last name</td></tr><tr><td>phone</td><td>string</td><td>No</td><td>Phone number with optional formatting</td></tr><tr><td>postal_code</td><td>string</td><td>Yes</td><td>Postal/ZIP code</td></tr><tr><td>state_region</td><td>string</td><td>Yes</td><td>State/province/region code</td></tr></tbody></table>

{% tabs %}
{% tab title="200" %}
**`200 Successful response example`**

```json
{
  "order": {
    "created_at": "2022-10-31T01:54:56.271Z",
    "currency": "USD",
    "custom_attributes": {},
    "id": 12345,
    "note": "Sample note.",
    "order_date": "2022-10-31T01:54:56.271Z",
    "order_lines": [
      {
        "custom_attributes": {},
        "customer_requested_date": "2024-03-31",
        "estimated_arrival_date": "2024-03-31",
        "ex_factory_date": {
          "current": "2024-03-09",
          "changes": [
            {
              "reason_code": "initial",
              "reason_description": "Initial Value",
              "created_at": "2024-02-23T08:00:40.773Z",
              "estimated_arrival_date": "2024-03-31",
              "ex_factory_date": "2024-03-09"
            }
          ]
        },
        "factory_code": "factory123",
        "id": 12345,
        "line_reference": "59861396",
        "price": 70,
        "product_description": "My Widget",
        "product_id": 12345,
        "quantity": 1,
        "recipe_token": "1609c0e8",
        "status": "new_order",
        "sku": "SKU123",
        "tags": [
          "tag1",
          "tag2"
        ],
        "upc": "UPC123",
        "fulfillments": [
          {
            "created_at": "2024-03-21T08:31:48.653Z",
            "updated_at": "2024-03-21T08:31:48.653Z",
            "quantity": 1,
            "id": 79,
            "tracking_number": "test1",
            "carrier_name": "test",
            "carrier_code": "test",
            "service_name": "test",
            "service_code": "test",
            "recipient_address_1": "test",
            "recipient_city": "test",
            "recipient_name": "test",
            "recipient_state_region": "test",
            "recipient_country": "test",
            "recipient_postal_code": "test",
            "recipient_phone": "test",
            "weight": 0,
            "width": 0,
            "height": 0,
            "length": 0
          }
        ]
      }
    ],
    "order_number": "ord-12345",
    "purchase_order_number": "po-12345",
    "sales_order_number": "so-12345",
    "ship_method_carrier": "UPS",
    "ship_method_code": "XY12",
    "ship_method_description": "UPS Ground Residential",
    "sales_channel": "b2b",
    "ship_to": {
      "account_number": "SHPTO123",
      "address_1": "123 Main St",
      "address_2": "",
      "city": "Ridgewood",
      "company_name": "VU Custom",
      "country": "US",
      "created_at": "2022-10-31T01:54:56.271Z",
      "email": "test@test.com",
      "first_name": "John",
      "id": 12345,
      "last_name": "Smith",
      "phone": "2011231234",
      "postal_code": "07450",
      "state_region": "NJ",
      "updated_at": "2022-10-31T01:54:56.271Z"
    },
    "sold_to": {
      "account_number": "SLDTO123",
      "address_1": "123 Main St",
      "address_2": "",
      "city": "Ridgewood",
      "company_name": "VU Custom",
      "country": "US",
      "created_at": "2022-10-31T01:54:56.271Z",
      "email": "test@test.com",
      "first_name": "John",
      "id": 12345,
      "last_name": "Smith",
      "phone": "2011231234",
      "postal_code": "07450",
      "state_region": "NJ",
      "updated_at": "2022-10-31T01:54:56.271Z"
    },
    "tags": [
      "tag1",
      "tag2"
    ],
    "updated_at": "2022-10-31T01:54:56.271Z"
  }
}
```

{% endtab %}

{% tab title="401 " %}
**`401 Unauthorized`**

`The client doesn’t have correct authentication credentials.`

```
{
"errors": "[API] Invalid API key or secret (unrecognized login or wrong password)"
}
```

{% endtab %}

{% tab title="403" %}
**`403 Forbidden`**

`The server is refusing to respond. This is typically caused by incorrect access.`
{% endtab %}

{% tab title="404" %}
**`404 Not Found`**

`The requested resource was not found but could be available again in the future.`
{% endtab %}

{% tab title="422" %}
**`422 Unprocessable Entity`**
{% endtab %}

{% tab title="5xx" %}
**`5xx Errors`**

`An internal error occurred in VU Admin.`
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vu-custom.gitbook.io/vu-custom/admin-api/orders/create-an-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
