> ## Documentation Index
>
> Fetch the complete documentation index at: [/llms.txt](https://developer.fabric.inc/llms.txt)
>
> Use this file to discover all available pages before exploring further.

[Skip to main content](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#content-area)

Create order draft

cURL

```
curl --request POST \
  --url https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data @- <<EOF
{
  "paymentDetails": [\
    {\
      "connectorName": "Authorizenet",\
      "paymentToken": 534234543,\
      "amount": 10.5,\
      "currency": "USD",\
      "conversion": 0.5,\
      "billToAddress": {\
        "street1": "100 NE 100th St.",\
        "city": "Seattle",\
        "state": "Washington",\
        "country": "USA",\
        "postalCode": "98125",\
        "customerId": 98121,\
        "name": {\
          "first": "Pat",\
          "middle": "E",\
          "last": "Kake"\
        },\
        "phone": {\
          "number": "123-456-7899",\
          "kind": "MOBILE"\
        },\
        "email": "test@mail.com",\
        "street2": "Suite 710",\
        "street3": "Seventh floor",\
        "street4": "Attention: Pat E. Kake",\
        "type": "Residence",\
        "latitude": 35.294952,\
        "longitude": 32.294952\
      },\
      "paymentMethod": "card",\
      "paymentMethodType": "tamara or tabby",\
      "attributes": {\
        "Attribute1": "620d8896058edb0009385311"\
      }\
    }\
  ],
  "estimatedTax": {
    "itemsTaxes": [\
      {\
        "type": "state_tax",\
        "amount": 2.5,\
        "rateType": "rateType",\
        "rate": 10,\
        "lineItemId": 1\
      }\
    ],
    "shipToTaxes": [\
      {\
        "shipToId": "a1b26d22-cad2-6242-a2b4-e3c4282bad4",\
        "type": "state_tax",\
        "amount": 2.5,\
        "rateType": "rateType",\
        "rate": 10\
      }\
    ],
    "feeTaxes": [\
      {\
        "feeId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
        "type": "state_tax",\
        "amount": 2.5,\
        "rateType": "rateType",\
        "rate": 10\
      }\
    ]
  },
  "orderNumber": 123123123,
  "orderSequence": {
    "sequenceName": "ORDER_NUMBER_SEQUENCE",
    "sequenceKey": "WHBM"
  },
  "customer": {
    "id": "8fb78749",
    "type": "employee",
    "segments": "{subscription: ['premium']}",
    "attributes": "{email: John.doe@foo.com}"
  },
  "orderType": "WEB",
  "orderSubType": "Android"
}
EOF
```

```
import requests

url = "https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts"

payload = {
    "paymentDetails": [\
        {\
            "connectorName": "Authorizenet",\
            "paymentToken": 534234543,\
            "amount": 10.5,\
            "currency": "USD",\
            "conversion": 0.5,\
            "billToAddress": {\
                "street1": "100 NE 100th St.",\
                "city": "Seattle",\
                "state": "Washington",\
                "country": "USA",\
                "postalCode": "98125",\
                "customerId": 98121,\
                "name": {\
                    "first": "Pat",\
                    "middle": "E",\
                    "last": "Kake"\
                },\
                "phone": {\
                    "number": "123-456-7899",\
                    "kind": "MOBILE"\
                },\
                "email": "test@mail.com",\
                "street2": "Suite 710",\
                "street3": "Seventh floor",\
                "street4": "Attention: Pat E. Kake",\
                "type": "Residence",\
                "latitude": 35.294952,\
                "longitude": 32.294952\
            },\
            "paymentMethod": "card",\
            "paymentMethodType": "tamara or tabby",\
            "attributes": { "Attribute1": "620d8896058edb0009385311" }\
        }\
    ],
    "estimatedTax": {
        "itemsTaxes": [\
            {\
                "type": "state_tax",\
                "amount": 2.5,\
                "rateType": "rateType",\
                "rate": 10,\
                "lineItemId": 1\
            }\
        ],
        "shipToTaxes": [\
            {\
                "shipToId": "a1b26d22-cad2-6242-a2b4-e3c4282bad4",\
                "type": "state_tax",\
                "amount": 2.5,\
                "rateType": "rateType",\
                "rate": 10\
            }\
        ],
        "feeTaxes": [\
            {\
                "feeId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
                "type": "state_tax",\
                "amount": 2.5,\
                "rateType": "rateType",\
                "rate": 10\
            }\
        ]
    },
    "orderNumber": 123123123,
    "orderSequence": {
        "sequenceName": "ORDER_NUMBER_SEQUENCE",
        "sequenceKey": "WHBM"
    },
    "customer": {
        "id": "8fb78749",
        "type": "employee",
        "segments": "{subscription: ['premium']}",
        "attributes": "{email: John.doe@foo.com}"
    },
    "orderType": "WEB",
    "orderSubType": "Android"
}
headers = {
    "x-site-context": "<x-site-context>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

```
const options = {
  method: 'POST',
  headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    paymentDetails: [\
      {\
        connectorName: 'Authorizenet',\
        paymentToken: 534234543,\
        amount: 10.5,\
        currency: 'USD',\
        conversion: 0.5,\
        billToAddress: {\
          street1: '100 NE 100th St.',\
          city: 'Seattle',\
          state: 'Washington',\
          country: 'USA',\
          postalCode: '98125',\
          customerId: 98121,\
          name: {first: 'Pat', middle: 'E', last: 'Kake'},\
          phone: {number: '123-456-7899', kind: 'MOBILE'},\
          email: 'test@mail.com',\
          street2: 'Suite 710',\
          street3: 'Seventh floor',\
          street4: 'Attention: Pat E. Kake',\
          type: 'Residence',\
          latitude: 35.294952,\
          longitude: 32.294952\
        },\
        paymentMethod: 'card',\
        paymentMethodType: 'tamara or tabby',\
        attributes: {Attribute1: '620d8896058edb0009385311'}\
      }\
    ],
    estimatedTax: {
      itemsTaxes: [\
        {type: 'state_tax', amount: 2.5, rateType: 'rateType', rate: 10, lineItemId: 1}\
      ],
      shipToTaxes: [\
        {\
          shipToId: 'a1b26d22-cad2-6242-a2b4-e3c4282bad4',\
          type: 'state_tax',\
          amount: 2.5,\
          rateType: 'rateType',\
          rate: 10\
        }\
      ],
      feeTaxes: [\
        {\
          feeId: 'fef78121-bee3-4448-bf1c-d5b5461dbda2',\
          type: 'state_tax',\
          amount: 2.5,\
          rateType: 'rateType',\
          rate: 10\
        }\
      ]
    },
    orderNumber: 123123123,
    orderSequence: {sequenceName: 'ORDER_NUMBER_SEQUENCE', sequenceKey: 'WHBM'},
    customer: {
      id: '8fb78749',
      type: 'employee',
      segments: '{subscription: [\'premium\']}',
      attributes: '{email: John.doe@foo.com}'
    },
    orderType: 'WEB',
    orderSubType: 'Android'
  })
};

fetch('https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "POST",\
  CURLOPT_POSTFIELDS => json_encode([\
    'paymentDetails' => [\
        [\
                'connectorName' => 'Authorizenet',\
                'paymentToken' => 534234543,\
                'amount' => 10.5,\
                'currency' => 'USD',\
                'conversion' => 0.5,\
                'billToAddress' => [\
                                'street1' => '100 NE 100th St.',\
                                'city' => 'Seattle',\
                                'state' => 'Washington',\
                                'country' => 'USA',\
                                'postalCode' => '98125',\
                                'customerId' => 98121,\
                                'name' => [\
                                                                'first' => 'Pat',\
                                                                'middle' => 'E',\
                                                                'last' => 'Kake'\
                                ],\
                                'phone' => [\
                                                                'number' => '123-456-7899',\
                                                                'kind' => 'MOBILE'\
                                ],\
                                'email' => 'test@mail.com',\
                                'street2' => 'Suite 710',\
                                'street3' => 'Seventh floor',\
                                'street4' => 'Attention: Pat E. Kake',\
                                'type' => 'Residence',\
                                'latitude' => 35.294952,\
                                'longitude' => 32.294952\
                ],\
                'paymentMethod' => 'card',\
                'paymentMethodType' => 'tamara or tabby',\
                'attributes' => [\
                                'Attribute1' => '620d8896058edb0009385311'\
                ]\
        ]\
    ],\
    'estimatedTax' => [\
        'itemsTaxes' => [\
                [\
                                'type' => 'state_tax',\
                                'amount' => 2.5,\
                                'rateType' => 'rateType',\
                                'rate' => 10,\
                                'lineItemId' => 1\
                ]\
        ],\
        'shipToTaxes' => [\
                [\
                                'shipToId' => 'a1b26d22-cad2-6242-a2b4-e3c4282bad4',\
                                'type' => 'state_tax',\
                                'amount' => 2.5,\
                                'rateType' => 'rateType',\
                                'rate' => 10\
                ]\
        ],\
        'feeTaxes' => [\
                [\
                                'feeId' => 'fef78121-bee3-4448-bf1c-d5b5461dbda2',\
                                'type' => 'state_tax',\
                                'amount' => 2.5,\
                                'rateType' => 'rateType',\
                                'rate' => 10\
                ]\
        ]\
    ],\
    'orderNumber' => 123123123,\
    'orderSequence' => [\
        'sequenceName' => 'ORDER_NUMBER_SEQUENCE',\
        'sequenceKey' => 'WHBM'\
    ],\
    'customer' => [\
        'id' => '8fb78749',\
        'type' => 'employee',\
        'segments' => '{subscription: [\'premium\']}',\
        'attributes' => '{email: John.doe@foo.com}'\
    ],\
    'orderType' => 'WEB',\
    'orderSubType' => 'Android'\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Content-Type: application/json",\
    "x-site-context: <x-site-context>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts"

payload := strings.NewReader("{\n  \"paymentDetails\": [\n    {\n      \"connectorName\": \"Authorizenet\",\n      \"paymentToken\": 534234543,\n      \"amount\": 10.5,\n      \"currency\": \"USD\",\n      \"conversion\": 0.5,\n      \"billToAddress\": {\n        \"street1\": \"100 NE 100th St.\",\n        \"city\": \"Seattle\",\n        \"state\": \"Washington\",\n        \"country\": \"USA\",\n        \"postalCode\": \"98125\",\n        \"customerId\": 98121,\n        \"name\": {\n          \"first\": \"Pat\",\n          \"middle\": \"E\",\n          \"last\": \"Kake\"\n        },\n        \"phone\": {\n          \"number\": \"123-456-7899\",\n          \"kind\": \"MOBILE\"\n        },\n        \"email\": \"test@mail.com\",\n        \"street2\": \"Suite 710\",\n        \"street3\": \"Seventh floor\",\n        \"street4\": \"Attention: Pat E. Kake\",\n        \"type\": \"Residence\",\n        \"latitude\": 35.294952,\n        \"longitude\": 32.294952\n      },\n      \"paymentMethod\": \"card\",\n      \"paymentMethodType\": \"tamara or tabby\",\n      \"attributes\": {\n        \"Attribute1\": \"620d8896058edb0009385311\"\n      }\n    }\n  ],\n  \"estimatedTax\": {\n    \"itemsTaxes\": [\n      {\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10,\n        \"lineItemId\": 1\n      }\n    ],\n    \"shipToTaxes\": [\n      {\n        \"shipToId\": \"a1b26d22-cad2-6242-a2b4-e3c4282bad4\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ],\n    \"feeTaxes\": [\n      {\n        \"feeId\": \"fef78121-bee3-4448-bf1c-d5b5461dbda2\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ]\n  },\n  \"orderNumber\": 123123123,\n  \"orderSequence\": {\n    \"sequenceName\": \"ORDER_NUMBER_SEQUENCE\",\n    \"sequenceKey\": \"WHBM\"\n  },\n  \"customer\": {\n    \"id\": \"8fb78749\",\n    \"type\": \"employee\",\n    \"segments\": \"{subscription: ['premium']}\",\n    \"attributes\": \"{email: John.doe@foo.com}\"\n  },\n  \"orderType\": \"WEB\",\n  \"orderSubType\": \"Android\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-site-context", "<x-site-context>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
HttpResponse<String> response = Unirest.post("https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts")
  .header("x-site-context", "<x-site-context>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": [\n    {\n      \"connectorName\": \"Authorizenet\",\n      \"paymentToken\": 534234543,\n      \"amount\": 10.5,\n      \"currency\": \"USD\",\n      \"conversion\": 0.5,\n      \"billToAddress\": {\n        \"street1\": \"100 NE 100th St.\",\n        \"city\": \"Seattle\",\n        \"state\": \"Washington\",\n        \"country\": \"USA\",\n        \"postalCode\": \"98125\",\n        \"customerId\": 98121,\n        \"name\": {\n          \"first\": \"Pat\",\n          \"middle\": \"E\",\n          \"last\": \"Kake\"\n        },\n        \"phone\": {\n          \"number\": \"123-456-7899\",\n          \"kind\": \"MOBILE\"\n        },\n        \"email\": \"test@mail.com\",\n        \"street2\": \"Suite 710\",\n        \"street3\": \"Seventh floor\",\n        \"street4\": \"Attention: Pat E. Kake\",\n        \"type\": \"Residence\",\n        \"latitude\": 35.294952,\n        \"longitude\": 32.294952\n      },\n      \"paymentMethod\": \"card\",\n      \"paymentMethodType\": \"tamara or tabby\",\n      \"attributes\": {\n        \"Attribute1\": \"620d8896058edb0009385311\"\n      }\n    }\n  ],\n  \"estimatedTax\": {\n    \"itemsTaxes\": [\n      {\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10,\n        \"lineItemId\": 1\n      }\n    ],\n    \"shipToTaxes\": [\n      {\n        \"shipToId\": \"a1b26d22-cad2-6242-a2b4-e3c4282bad4\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ],\n    \"feeTaxes\": [\n      {\n        \"feeId\": \"fef78121-bee3-4448-bf1c-d5b5461dbda2\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ]\n  },\n  \"orderNumber\": 123123123,\n  \"orderSequence\": {\n    \"sequenceName\": \"ORDER_NUMBER_SEQUENCE\",\n    \"sequenceKey\": \"WHBM\"\n  },\n  \"customer\": {\n    \"id\": \"8fb78749\",\n    \"type\": \"employee\",\n    \"segments\": \"{subscription: ['premium']}\",\n    \"attributes\": \"{email: John.doe@foo.com}\"\n  },\n  \"orderType\": \"WEB\",\n  \"orderSubType\": \"Android\"\n}")
  .asString();
```

```
require 'uri'
require 'net/http'

url = URI("https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": [\n    {\n      \"connectorName\": \"Authorizenet\",\n      \"paymentToken\": 534234543,\n      \"amount\": 10.5,\n      \"currency\": \"USD\",\n      \"conversion\": 0.5,\n      \"billToAddress\": {\n        \"street1\": \"100 NE 100th St.\",\n        \"city\": \"Seattle\",\n        \"state\": \"Washington\",\n        \"country\": \"USA\",\n        \"postalCode\": \"98125\",\n        \"customerId\": 98121,\n        \"name\": {\n          \"first\": \"Pat\",\n          \"middle\": \"E\",\n          \"last\": \"Kake\"\n        },\n        \"phone\": {\n          \"number\": \"123-456-7899\",\n          \"kind\": \"MOBILE\"\n        },\n        \"email\": \"test@mail.com\",\n        \"street2\": \"Suite 710\",\n        \"street3\": \"Seventh floor\",\n        \"street4\": \"Attention: Pat E. Kake\",\n        \"type\": \"Residence\",\n        \"latitude\": 35.294952,\n        \"longitude\": 32.294952\n      },\n      \"paymentMethod\": \"card\",\n      \"paymentMethodType\": \"tamara or tabby\",\n      \"attributes\": {\n        \"Attribute1\": \"620d8896058edb0009385311\"\n      }\n    }\n  ],\n  \"estimatedTax\": {\n    \"itemsTaxes\": [\n      {\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10,\n        \"lineItemId\": 1\n      }\n    ],\n    \"shipToTaxes\": [\n      {\n        \"shipToId\": \"a1b26d22-cad2-6242-a2b4-e3c4282bad4\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ],\n    \"feeTaxes\": [\n      {\n        \"feeId\": \"fef78121-bee3-4448-bf1c-d5b5461dbda2\",\n        \"type\": \"state_tax\",\n        \"amount\": 2.5,\n        \"rateType\": \"rateType\",\n        \"rate\": 10\n      }\n    ]\n  },\n  \"orderNumber\": 123123123,\n  \"orderSequence\": {\n    \"sequenceName\": \"ORDER_NUMBER_SEQUENCE\",\n    \"sequenceKey\": \"WHBM\"\n  },\n  \"customer\": {\n    \"id\": \"8fb78749\",\n    \"type\": \"employee\",\n    \"segments\": \"{subscription: ['premium']}\",\n    \"attributes\": \"{email: John.doe@foo.com}\"\n  },\n  \"orderType\": \"WEB\",\n  \"orderSubType\": \"Android\"\n}"

response = http.request(request)
puts response.read_body
```

201

400

404

500

```
{
  "cartId": "b8a64b52-dab4-8137-8d6a-f2c2337abc1",
  "orderStatus": {
    "paymentStatus": "<unknown>",
    "ready": true
  },
  "orderTotal": 60,
  "orderSubTotal": 60,
  "taxTotal": 60,
  "orderDiscount": 60,
  "currency": "USD",
  "createdAt": "2022-02-18T15:12:40.974580",
  "items": [\
    {\
      "itemId": "1000000001",\
      "sku": "16B2GS8LD5FDS",\
      "items": [\
        {\
          "sku": "13B9CL6WT2SLW",\
          "quantity": 15,\
          "items": [\
            "<unknown>"\
          ],\
          "cartItemId": "12gved0f-7645-40cb-y7b0-167f8bggdb3z",\
          "itemId": "1730902008",\
          "title": "Light Cover",\
          "attributes": [\
            {\
              "attributeId": "60c2a358eb2ec30008ae70a1",\
              "name": "gift wrapping (small)",\
              "type": "GIFT",\
              "price": 10,\
              "description": "Gift wrapping for a small package",\
              "mapping": "ITEM",\
              "value": "true",\
              "level": "order",\
              "items": [\
                "1000000001"\
              ]\
            }\
          ],\
          "createdAt": "2022-02-18T15:12:40.974580",\
          "updatedAt": "2022-02-18T15:12:40.974580",\
          "type": "WEB_SHIP",\
          "subType": "Border-free",\
          "priceListId": "108674",\
          "lineItemId": 1,\
          "isActive": true,\
          "unitPrice": {\
            "currency": "USD",\
            "amount": 100,\
            "discount": {\
              "price": 80,\
              "promosApplied": [\
                {\
                  "promoId": "fza065tdr787",\
                  "promoCode": "coupon123",\
                  "value": "20",\
                  "unit": "%OFF"\
                }\
              ],\
              "discounts": [\
                {\
                  "promoId": "fza065tdr787",\
                  "promoCode": "coupon123",\
                  "promoTitle": "New Year discount",\
                  "quantity": 1,\
                  "amount": 20,\
                  "value": 20,\
                  "groupId": "new-items",\
                  "promotionType": "PROMOTION",\
                  "priority": 1,\
                  "stackable": false,\
                  "sku": "16B2GS8LD5FDS",\
                  "itemId": "1000000001",\
                  "itemKey": "Key1234",\
                  "message": "New Year Promotion",\
                  "unit": "%OFF",\
                  "proratedQuantity": 1,\
                  "proratedAmount": 3.33\
                }\
              ],\
              "discountAmount": 20\
            },\
            "sale": 80\
          },\
          "totalPrice": {\
            "currency": "USD",\
            "amount": 100,\
            "discount": {\
              "price": 80,\
              "promosApplied": [\
                {\
                  "promoId": "fza065tdr787",\
                  "promoCode": "coupon123",\
                  "value": "20",\
                  "unit": "%OFF"\
                }\
              ],\
              "discounts": [\
                {\
                  "promoId": "fza065tdr787",\
                  "promoCode": "coupon123",\
                  "promoTitle": "New Year discount",\
                  "quantity": 1,\
                  "amount": 20,\
                  "value": 20,\
                  "groupId": "new-items",\
                  "promotionType": "PROMOTION",\
                  "priority": 1,\
                  "stackable": false,\
                  "sku": "16B2GS8LD5FDS",\
                  "itemId": "1000000001",\
                  "itemKey": "Key1234",\
                  "message": "New Year Promotion",\
                  "unit": "%OFF",\
                  "proratedQuantity": 1,\
                  "proratedAmount": 3.33\
                }\
              ],\
              "discountAmount": 20\
            },\
            "sale": 80\
          },\
          "attributeTotalPrice": 10,\
          "group": [\
            "61d38e117162b7dba69c3d6d"\
          ],\
          "extra": {\
            "productFamily": "Laptop computers"\
          },\
          "channel": 12,\
          "isPickup": true,\
          "warehouseId": "XYZ-1234",\
          "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
          "shipTo": {\
            "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
            "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",\
            "createdAt": "2022-02-18T15:12:40.974580",\
            "updatedAt": "2022-02-18T15:12:40.974580",\
            "shipMethod": {\
              "cost": {\
                "amount": 10,\
                "currency": "USD",\
                "discount": 5\
              },\
              "shipMethodId": "1234",\
              "shipmentCarrier": "FedEx",\
              "shipmentMethod": "Next Day"\
            },\
            "address": {\
              "attention": "Billing manager",\
              "street1": "100 NE 100th St.",\
              "street2": "Suite 710",\
              "street3": "Seventh floor",\
              "street4": "Attention: Pat E. Kake",\
              "city": "Seattle",\
              "state": "Washington",\
              "country": "USA",\
              "zipCode": "98125",\
              "email": "test@mail.com",\
              "kind": "shipping",\
              "name": {\
                "first": "Pat",\
                "middle": "E",\
                "last": "Kake"\
              },\
              "phone": {\
                "number": "123-456-7899",\
                "kind": "MOBILE"\
              }\
            },\
            "shipToType": "SHIP_TO_ADDRESS",\
            "taxCode": "FR1000",\
            "isPickup": true,\
            "altPickupPerson": {\
              "name": {\
                "first": "Pat",\
                "middle": "E",\
                "last": "Kake"\
              },\
              "phone": {\
                "number": "123-456-7899",\
                "kind": "MOBILE"\
              },\
              "email": "test@mail.com"\
            },\
            "pickupPerson": {\
              "name": {\
                "first": "Pat",\
                "middle": "E",\
                "last": "Kake"\
              },\
              "phone": {\
                "number": "123-456-7899",\
                "kind": "MOBILE"\
              },\
              "email": "test@mail.com"\
            },\
            "warehouseId": "XYZ-1234",\
            "storeId": "ABC-123"\
          },\
          "fulfillment": {\
            "type": "WEB_SHIP",\
            "networkCode": "ShipToCNC",\
            "channelId": "12",\
            "inventoryType": "availablePreorder",\
            "inventory": {\
              "virtualCounters": {\
                "availableToPurchase": 10\
              },\
              "id": "62272e917b12209e68751d94",\
              "sku": "SKU00025",\
              "itemId": 4225678911,\
              "locationNum": 473746,\
              "channelId": 12,\
              "vendorId": "vendor123",\
              "leadTime": 1234,\
              "inventoryType": "Safety stock",\
              "infiniteInventory": true,\
              "counters": {\
                "on-hand": 10\
              },\
              "attributes": {\
                "buy online, pick up in-store (bopis)": true\
              },\
              "backOrderDate": "2022-08-08T00:00:00.000Z",\
              "preOrderDate": "2022-08-08T00:00:00.000Z",\
              "backOrderLimit": 100,\
              "preOrderLimit": 100,\
              "safetyStock": 10,\
              "lowStock": 10,\
              "segment": "Clothing",\
              "region": "US"\
            }\
          }\
        }\
      ],\
      "quantity": 1,\
      "lineItemId": 1,\
      "isPickup": true,\
      "cartItemId": "88cded0f-1439-40eb-a7a0-167e8bffdb3b",\
      "title": "Varnet Garden Light Kit",\
      "attributeTotalPrice": 10,\
      "createdAt": "2022-02-18T15:12:40.974580",\
      "updatedAt": "2022-02-18T15:12:40.974580",\
      "priceListId": "100000",\
      "isActive": true,\
      "unitPrice": {\
        "currency": "USD",\
        "amount": 100,\
        "discount": {\
          "price": 80,\
          "promosApplied": [\
            {\
              "promoId": "fza065tdr787",\
              "promoCode": "coupon123",\
              "value": "20",\
              "unit": "%OFF"\
            }\
          ],\
          "discounts": [\
            {\
              "promoId": "fza065tdr787",\
              "promoCode": "coupon123",\
              "promoTitle": "New Year discount",\
              "quantity": 1,\
              "amount": 20,\
              "value": 20,\
              "groupId": "new-items",\
              "promotionType": "PROMOTION",\
              "priority": 1,\
              "stackable": false,\
              "sku": "16B2GS8LD5FDS",\
              "itemId": "1000000001",\
              "itemKey": "Key1234",\
              "message": "New Year Promotion",\
              "unit": "%OFF",\
              "proratedQuantity": 1,\
              "proratedAmount": 3.33\
            }\
          ],\
          "discountAmount": 20\
        },\
        "sale": 80\
      },\
      "totalPrice": {\
        "currency": "USD",\
        "amount": 100,\
        "discount": {\
          "price": 80,\
          "promosApplied": [\
            {\
              "promoId": "fza065tdr787",\
              "promoCode": "coupon123",\
              "value": "20",\
              "unit": "%OFF"\
            }\
          ],\
          "discounts": [\
            {\
              "promoId": "fza065tdr787",\
              "promoCode": "coupon123",\
              "promoTitle": "New Year discount",\
              "quantity": 1,\
              "amount": 20,\
              "value": 20,\
              "groupId": "new-items",\
              "promotionType": "PROMOTION",\
              "priority": 1,\
              "stackable": false,\
              "sku": "16B2GS8LD5FDS",\
              "itemId": "1000000001",\
              "itemKey": "Key1234",\
              "message": "New Year Promotion",\
              "unit": "%OFF",\
              "proratedQuantity": 1,\
              "proratedAmount": 3.33\
            }\
          ],\
          "discountAmount": 20\
        },\
        "sale": 80\
      },\
      "attributes": [\
        {\
          "attributeId": "60c2a358eb2ec30008ae70a1",\
          "name": "gift wrapping (small)",\
          "type": "GIFT",\
          "price": 10,\
          "description": "Gift wrapping for a small package",\
          "mapping": "ITEM",\
          "value": "true",\
          "level": "order",\
          "items": [\
            "1000000001"\
          ]\
        }\
      ],\
      "priceAdjustments": [\
        {\
          "id": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",\
          "reason": "compensation for delay",\
          "amount": 20,\
          "attributes": {\
            "goldMember": [\
              false\
            ]\
          }\
        }\
      ],\
      "warehouseId": "XYZ-1234",\
      "shipTo": {\
        "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
        "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",\
        "createdAt": "2022-02-18T15:12:40.974580",\
        "updatedAt": "2022-02-18T15:12:40.974580",\
        "shipMethod": {\
          "cost": {\
            "amount": 10,\
            "currency": "USD",\
            "discount": 5\
          },\
          "shipMethodId": "1234",\
          "shipmentCarrier": "FedEx",\
          "shipmentMethod": "Next Day"\
        },\
        "address": {\
          "attention": "Billing manager",\
          "street1": "100 NE 100th St.",\
          "street2": "Suite 710",\
          "street3": "Seventh floor",\
          "street4": "Attention: Pat E. Kake",\
          "city": "Seattle",\
          "state": "Washington",\
          "country": "USA",\
          "zipCode": "98125",\
          "email": "test@mail.com",\
          "kind": "shipping",\
          "name": {\
            "first": "Pat",\
            "middle": "E",\
            "last": "Kake"\
          },\
          "phone": {\
            "number": "123-456-7899",\
            "kind": "MOBILE"\
          }\
        },\
        "shipToType": "SHIP_TO_ADDRESS",\
        "taxCode": "FR1000",\
        "isPickup": true,\
        "altPickupPerson": {\
          "name": {\
            "first": "Pat",\
            "middle": "E",\
            "last": "Kake"\
          },\
          "phone": {\
            "number": "123-456-7899",\
            "kind": "MOBILE"\
          },\
          "email": "test@mail.com"\
        },\
        "pickupPerson": {\
          "name": {\
            "first": "Pat",\
            "middle": "E",\
            "last": "Kake"\
          },\
          "phone": {\
            "number": "123-456-7899",\
            "kind": "MOBILE"\
          },\
          "email": "test@mail.com"\
        },\
        "warehouseId": "XYZ-1234",\
        "storeId": "ABC-123"\
      },\
      "channel": 12,\
      "group": [\
        "61d38e117162b7dba69c3d6d"\
      ],\
      "fees": [\
        {\
          "feeId": "73bc09d0-874a-4c3d-84d0-df1670d03578",\
          "name": "gift",\
          "type": "gift_wrap",\
          "amount": 10.5,\
          "attributes": "{'from': 'sam', 'to': 'david' }"\
        }\
      ],\
      "type": "WEB_SHIP",\
      "subType": "Borderfree",\
      "uom": "ITEM",\
      "itemTaxTotal": 123,\
      "taxCode": "FR1000",\
      "taxDetail": {\
        "type": "state_tax",\
        "amount": 2.5,\
        "rateType": "rateType",\
        "rate": 10\
      }\
    }\
  ],
  "shipInfo": [\
    {\
      "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",\
      "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",\
      "createdAt": "2022-02-18T15:12:40.974580",\
      "updatedAt": "2022-02-18T15:12:40.974580",\
      "shipMethod": {\
        "cost": {\
          "amount": 10,\
          "currency": "USD",\
          "discount": 5\
        },\
        "shipMethodId": "1234",\
        "shipmentCarrier": "FedEx",\
        "shipmentMethod": "Next Day"\
      },\
      "address": {\
        "attention": "Billing manager",\
        "street1": "100 NE 100th St.",\
        "street2": "Suite 710",\
        "street3": "Seventh floor",\
        "street4": "Attention: Pat E. Kake",\
        "city": "Seattle",\
        "state": "Washington",\
        "country": "USA",\
        "zipCode": "98125",\
        "email": "test@mail.com",\
        "kind": "shipping",\
        "name": {\
          "first": "Pat",\
          "middle": "E",\
          "last": "Kake"\
        },\
        "phone": {\
          "number": "123-456-7899",\
          "kind": "MOBILE"\
        }\
      },\
      "shipToType": "SHIP_TO_ADDRESS",\
      "taxCode": "FR1000",\
      "isPickup": true,\
      "altPickupPerson": {\
        "name": {\
          "first": "Pat",\
          "middle": "E",\
          "last": "Kake"\
        },\
        "phone": {\
          "number": "123-456-7899",\
          "kind": "MOBILE"\
        },\
        "email": "test@mail.com"\
      },\
      "pickupPerson": {\
        "name": {\
          "first": "Pat",\
          "middle": "E",\
          "last": "Kake"\
        },\
        "phone": {\
          "number": "123-456-7899",\
          "kind": "MOBILE"\
        },\
        "email": "test@mail.com"\
      },\
      "warehouseId": "XYZ-1234",\
      "storeId": "ABC-123",\
      "estimatedShipDate": "2022-02-18T15:12:40.974580",\
      "estimatedDeliveryDate": "2022-02-18T15:12:40.974580",\
      "shipmentInstructions": "Additional user instructions for shipping"\
    }\
  ],
  "orderNumber": 123123123,
  "orderType": "WEB",
  "orderSubType": "Android",
  "customer": {
    "id": "8fb78749",
    "type": "employee",
    "segments": "{subscription: ['premium']}",
    "attributes": "{email: John.doe@foo.com}"
  },
  "attributes": {
    "approver": "620d8896058edb0009385311"
  },
  "payments": [\
    {\
      "connectorName": "Authorizenet",\
      "paymentToken": 534234543,\
      "amount": 10.5,\
      "currency": "USD",\
      "conversion": 0.5,\
      "billToAddress": {\
        "street1": "100 NE 100th St.",\
        "city": "Seattle",\
        "state": "Washington",\
        "country": "USA",\
        "postalCode": "98125",\
        "customerId": 98121,\
        "name": {\
          "first": "Pat",\
          "middle": "E",\
          "last": "Kake"\
        },\
        "phone": {\
          "number": "123-456-7899",\
          "kind": "MOBILE"\
        },\
        "email": "test@mail.com",\
        "street2": "Suite 710",\
        "street3": "Seventh floor",\
        "street4": "Attention: Pat E. Kake",\
        "type": "Residence",\
        "latitude": 35.294952,\
        "longitude": 32.294952\
      },\
      "paymentMethod": "card",\
      "paymentMethodType": "tamara or tabby",\
      "attributes": {\
        "Attribute1": "620d8896058edb0009385311"\
      }\
    }\
  ],
  "accountId": "5f689caa4216e7000750d1ef",
  "totalItems": 3,
  "totalUniqueItems": 2,
  "configuration": {
    "allowAnonymousUser": true,
    "softReserve": false,
    "addItemBySku": false,
    "inventory": {
      "ttl": 60
    }
  },
  "fees": [\
    {\
      "feeId": "73bc09d0-874a-4c3d-84d0-df1670d03578",\
      "name": "gift",\
      "type": "gift_wrap",\
      "amount": 10.5,\
      "attributes": "{'from': 'sam', 'to': 'david' }"\
    }\
  ],
  "orderTotalFees": 60,
  "error": {
    "detail": "Item is out of stock",
    "itemId": "1000000001",
    "sku": "16B2GS8LD5FDS",
    "lineItemId": 1
  }
}
```

```
{
  "code": "Bad Request",
  "message": "User ID or Cart ID does not exist"
}
```

```
{
  "code": "Cart or item not found",
  "message": "If the issue persists please contact support@fabric.inc."
}
```

```
{
  "code": "Internal Server Error",
  "message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
```

POST

/

v2

/

carts

/

{cartId}

/

order-drafts

Try it

Create order draft

cURL

```
import requests

url = "https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts"

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

```
<?php

$curl = curl_init();

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts"

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-site-context", "<x-site-context>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
require 'uri'
require 'net/http'

url = URI("https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

response = http.request(request)
puts response.read_body
```

201

400

404

500

```
{
  "code": "Bad Request",
  "message": "User ID or Cart ID does not exist"
}
```

```
{
  "code": "Cart or item not found",
  "message": "If the issue persists please contact support@fabric.inc."
}
```

```
{
  "code": "Internal Server Error",
  "message": "An internal error occurred. If the issue persists please contact support@fabric.inc."
}
```

#### Headers

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#parameter-x-site-context)

x-site-context

string

required

The `x-site-context` header is a JSON object that contains information about the source you wish to pull from. The mandatory `account` is the 24 character identifier found in Copilot. The `channel` (Sales channel ID), `stage` (environment name), and `date` attributes can be used to further narrow the scope of your data source.

Example:

`"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"`

#### Path Parameters

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#parameter-cart-id)

cartId

string

required

ID of the cart for which order draft will be generated

Example:

`"d7e78a21-bee3-4448-bf1c-d5b5461dbda2"`

#### Body

application/json

Request body to create order draft

Sample request to create order draft

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-payment-details)

paymentDetails

object\[\]

required

Payment details

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-estimated-tax)

estimatedTax

object

required

Estimated tax object

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-order-number-one-of-0)

orderNumber

string \| null

Order number

Example:

`123123123`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-order-sequence-one-of-0)

orderSequence

object \| null

Order sequence details

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-customer-one-of-0)

customer

object \| null

Customer details

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-order-type-one-of-0)

orderType

string \| null

Order type (WEB, CSC, MOBILE\_APP, POS)

Example:

`"WEB"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#body-order-sub-type-one-of-0)

orderSubType

string \| null

Order sub type (Android/IOS/International)

Example:

`"Android"`

#### Response

201

application/json

OK

Order draft response

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-cart-id)

cartId

string

required

Cart ID

Example:

`"b8a64b52-dab4-8137-8d6a-f2c2337abc1"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-status)

orderStatus

object

required

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-total)

orderTotal

number<double>

required

Total amount for the order

Example:

`60`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-sub-total)

orderSubTotal

number<double>

required

Total amount for the order without discounts

Example:

`60`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-tax-total)

taxTotal

number<double>

required

Total tax applied on the order

Example:

`60`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-discount)

orderDiscount

number<double>

required

Total discount applied on the order

Example:

`60`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-currency)

currency

string

required

Currency code

Example:

`"USD"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-created-at)

createdAt

string<date-time>

required

Time order draft was created

Example:

`"2022-02-18T15:12:40.974580"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-items)

items

object\[\]

required

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-ship-info)

shipInfo

object\[\]

required

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-number-one-of-0)

orderNumber

string \| null

Order number

Example:

`123123123`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-type-one-of-0)

orderType

string \| null

Order type (WEB, CSC, MOBILE\_APP, POS)

Example:

`"WEB"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-sub-type-one-of-0)

orderSubType

string \| null

Order sub type (Android/IOS/International)

Example:

`"Android"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-customer-one-of-0)

customer

object \| null

Customer details

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-attributes-one-of-0)

attributes

object \| null

Cart metadata

Example:

```
{ "approver": "620d8896058edb0009385311" }
```

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-payments-one-of-0)

payments

object\[\] \| null

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-account-id-one-of-0)

accountId

string \| null

Customer account ID

Example:

`"5f689caa4216e7000750d1ef"`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-total-items-one-of-0)

totalItems

integer<int32> \| null

Total number of items in the cart

Example:

`3`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-total-unique-items-one-of-0)

totalUniqueItems

integer<int32> \| null

Total number of unique line items in the cart

Example:

`2`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-configuration-one-of-0)

configuration

object \| null

Cart configuration

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-fees-one-of-0)

fees

object\[\] \| null

Fees associated with a specific cart or an individual line item of a cart

Showchild attributes

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-order-total-fees-one-of-0)

orderTotalFees

number<double> \| null

Total fees applied on the order

Example:

`60`

[​](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/create-order-draft#response-error-one-of-0)

error

object \| null

error object

Showchild attributes

Was this page helpful?

YesNo

[Get order draft by ID](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/get-order-draft-by-id) [Get all order drafts by filter parameters](https://developer.fabric.inc/v2/api-reference/cart-api/order-draft/get-all-order-drafts-by-filter-parameters)

Ctrl+I

Assistant

Responses are generated using AI and may contain mistakes.
