# Orders

## Retrieve order information

<mark style="color:blue;">`GET`</mark> `/order/$id`

#### Query Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Order ID    |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status": "ok",
    "response": {
        "order": {
            "id": "EA8",
            "store": {
                "name": "My TeSt StOrE",
                "order_id": "000000027"
            },
            "status": {
                "code": "F",
                "label": "Fulfilled",
                "since": "2030-05-11 13:19"
            },
            "addresses": {
                "billing": {
                    "fname": "Chris",
                    "name": "Jansen",
                    "street": "Hoofdstraat",
                    "streetNr": "95",
                    "streetNrExt": "",
                    "postcode": "1234 AB",
                    "city": "Amsterdam",
                    "country": "NL",
                    "email": "chris@email.nl",
                    "phone": "0000000000"
                },
                "shipping": {
                    "fname": "Chris",
                    "name": "Jansen",
                    "street": "Hoofdstraat",
                    "streetNr": "95",
                    "streetNrExt": "",
                    "postcode": "1234 AB",
                    "city": "Amsterdam",
                    "country": "NL",
                    "email": "chris@email.nl",
                    "phone": "0000000000"
                }
            },
            "line_items": [
                {
                    "sku": "RS155M-30-L",
                    "name": "RS155M-30-L",
                    "thumb": "",
                    "image": "",
                    "status": "fulfilled",
                    "options": [
                        {
                            "code": "dtg",
                            "attributes": [
                                {
                                    "name": "src",
                                    "value": "https://test1234.com/mydesign.png",
                                    "source": "user"
                                },
                                {
                                    "name": "preview",
                                    "value": "https://test1234.com/a-preview-of-the-design.png",
                                    "source": "user"
                                },
                                {
                                    "name": "position",
                                    "value": "front",
                                    "source": "user"
                                },
                                {
                                    "name": "qty",
                                    "value": 1,
                                    "source": "default"
                                },
                                {
                                    "name": "offsetX",
                                    "value": -1,
                                    "source": "default"
                                },
                                {
                                    "name": "offsetY",
                                    "value": -1,
                                    "source": "default"
                                },
                                {
                                    "name": "dpi",
                                    "value": 150,
                                    "source": "default"
                                },
                                {
                                    "name": "pallet",
                                    "value": "Standard Pallet",
                                    "source": "default"
                                }
                            ],
                            "status": "fulfilled",
                            "source": "api",
                            "sort_order": 2000
                        }
                    ]
                }
            ],
            "transactions": [
             {
                 "items": [
                     {
                         "ID": 47891,
                         "qty": "1.0000",
                         "sku": "RS155M-30-L",
                         "total": "5.7600"
                     },
                     {
                         "ID": 47892,
                         "qty": "1.0000",
                         "sku": "ISF-EU-T-T",
                         "total": "4.7800"
                     }
                 ],
                 "transaction": {
                     "ID": "21895",
                     "date": "07-12-2030 15:30",
                     "orderRef": "EA8",
                     "total": "10.5400"
                 },
                 "invoice": {
                     "ID": 6389
                 }
             }
             ],
                "shipments": [
                {
                    "status": {
                        "code": "N",
                        "label": "New"
                    },
                    "tracking": {
                        "code": "3SCEBU5051344513",
                        "url": "https://jouw.postnl.nl/track-and-trace/3SCEBU5051344513-NL-1234AB"
                    }
                }
            ]
        }
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Create new order

<mark style="color:green;">`POST`</mark> `https://api.cottoncast.com/order`

This endpoint allows you to create a new order.

#### Headers

| Name           | Type   | Description           |
| -------------- | ------ | --------------------- |
| Authentication | string | Basic  Authentication |

#### Request Body

| Name       | Type   | Description                |
| ---------- | ------ | -------------------------- |
| items      | object | Products you want to order |
| shipping   | object | Shipping address           |
| billing    | object | Billing address            |
| order\_ref | string | Your order reference       |
| store      | string | ID of the sales channel    |

{% tabs %}
{% tab title="200 Order received" %}

```javascript
 
{

"store" : "5a2e74fad24826b7836f75c5",

"order_ref" : "100009769",

"billing" : {

    "fname" : "John",

    "name": "Carpenter",

    "street" : "Lange laan",

    "streetNr" : "234",

    "streetNrExt" : "b",

    "postcode" : "1033AZ",

    "city" : "Amsterdam",

    "country" : "NL",

    "phone" : "0612345678",

    "email" : "example@example.com"

  },

 

"shipping" : {

    "fname" : "John",

    "name": "Carpenter",

    "street" : "Lange laan",

    "streetNr" : "234",

    "streetNrExt" : "b",

    "postcode" : "1033AZ",

    "city" : "Amsterdam",

    "country" : "NL",

    "phone" : "0612345678",

    "email" : "example@example.com"

  },

"items": [
    {
      "qty": 1,
      "sku": "RS155M-30-S",
      "options" : [
        {
          "code" : "dtg",
          "attributes" : [
            {
              "name" : "src",
              "value": "https://mydomain.com/design.png"
            },
            {
            "name" : "position",
            "value": "marker: chest; width:80%; top: 1cm"
            },
            {
            "name" : "preview",
            "value": "https://mydomain.com/preview.png"
            }        
          ]
        }
      ]
    },
    {
      "qty": 1,
      "sku": "RS155M-36-L",
      "options" : [
        {
          "code" : "dtg",
          "attributes" : [
            {
              "name" : "src",
              "value": "https://mydomain.com/design2.svg"
            },
            {
            "name" : "position",
            "value": "On the chest, about 80% in width"
            }
          ]
        }
      ]
    },    
    {
      "qty": 1,
      "sku": "7RX-30-L"
    }
  ]
}

```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
    // Response
}
```

{% 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://docs.cottoncast.com/api-reference/api-endpoints/post-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.
