Create shipment for an existing order - Fabric

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Skip to main content

Create shipment for an existing order

cURL

curl --request POST \
  --url https://api.fabric.inc/v3/shipments/create-order-shipment \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-fabric-channel-id: <x-fabric-channel-id>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
  --data '
{
  "shipmentNumber": 78974156816152,
  "shipmentExternalId": "123k4h123k",
  "poNumber": 1125,
  "vendorId": 56,
  "statusCode": "SHIPMENT_CREATED",
  "type": "STANDARD",
  "subtype": "COD",
  "reshipmentReasonCode": "Order is missing",
  "shippedAt": "2023-04-06T07:58:30.996Z",
  "locationNumber": 132412,
  "locationType": "DC",
  "totalCartons": 2,
  "masterTrackingNumber": "TX112345678",
  "shipToId": "sg6683620405",
  "recipients": [\
    {\
      "email": "support@example.inc",\
      "name": {\
        "firstName": "Alex",\
        "lastName": "Doe",\
        "middleName": "E"\
      },\
      "phone": {\
        "number": "123-456-7890",\
        "type": "MOBILE"\
      }\
    }\
  ],
  "attributes": {
    "attribute1": "value"
  },
  "cartons": [\
    {\
      "items": [\
        {\
          "lineItemId": "1",\
          "shippedQuantity": 2,\
          "attributes": {\
            "attribute1": "value"\
          },\
          "fees": [\
            {\
              "amount": 34.56,\
              "amountInCurrencies": [\
                {\
                  "currency": "USD",\
                  "group": "SHOPPER",\
                  "amount": 123.45\
                }\
              ],\
              "name": "RETURN_FEE",\
              "reason": "Return fee",\
              "type": "FEE"\
            }\
          ],\
          "giftCards": [\
            {\
              "amount": 50,\
              "giftCardNumber": "453456765"\
            }\
          ],\
          "itemId": 100023,\
          "orderId": "6413e370cb0dc859b6c0dcb0",\
          "orderNumber": "309020213",\
          "shipmentExternalId": "123k4h123k",\
          "orderedQuantity": 2,\
          "refundAmount": 10,\
          "refundAmountInCurrencies": [\
            {\
              "currency": "USD",\
              "group": "SHOPPER",\
              "amount": 123.45\
            }\
          ],\
          "returnQuantity": 1,\
          "returnRequestCounter": 1,\
          "segment": "segment",\
          "sku": "SKU0023",\
          "uom": "EA",\
          "vendorId": "56"\
        }\
      ],\
      "cartonNumber": 1,\
      "cartonType": "Package",\
      "promisedDeliveryDate": "2023-03-26T07:58:30.996Z",\
      "estimatedShipDate": "2023-03-25T07:58:30.996Z",\
      "estimatedDeliveryDate": "2023-03-26T07:58:30.996Z",\
      "shipmentMethod": "ground",\
      "shipmentCarrier": "FEDEX",\
      "weight": 500,\
      "trackingNumber": "1Z999AA10123456784",\
      "trackingURL": "https://fedex.com/tracking",\
      "tracking": [\
        {\
          "event": "picked up",\
          "eventId": "627963716b19511e8a3a631b",\
          "eventRecordedAt": "2019-09-30T07:58:30.996Z",\
          "location": "Reno, NV",\
          "notes": {\
            "description": "Shipment picked up"\
          },\
          "shipmentCarrier": "FEDEX"\
        }\
      ]\
    }\
  ],
  "scratchedItems": [\
    {\
      "lineItemId": 2,\
      "quantity": 1,\
      "reasonCode": "ReasonCode23454",\
      "orderId": "6413e370cb0dc859b6c0dcb0",\
      "orderNumber": 309020213,\
      "orderExternalId": "123k4h123k",\
      "itemId": 100043,\
      "sku": "SKU00043",\
      "uom": "EA",\
      "subReasonCode": "SubReasonCode23242",\
      "attributes": {\
        "attribute1": "value"\
      }\
    }\
  ]
}
'
import requests

url = "https://api.fabric.inc/v3/shipments/create-order-shipment"

payload = {
    "shipmentNumber": 78974156816152,
    "shipmentExternalId": "123k4h123k",
    "poNumber": 1125,
    "vendorId": 56,
    "statusCode": "SHIPMENT_CREATED",
    "type": "STANDARD",
    "subtype": "COD",
    "reshipmentReasonCode": "Order is missing",
    "shippedAt": "2023-04-06T07:58:30.996Z",
    "locationNumber": 132412,
    "locationType": "DC",
    "totalCartons": 2,
    "masterTrackingNumber": "TX112345678",
    "shipToId": "sg6683620405",
    "recipients": [\
        {\
            "email": "support@example.inc",\
            "name": {\
                "firstName": "Alex",\
                "lastName": "Doe",\
                "middleName": "E"\
            },\
            "phone": {\
                "number": "123-456-7890",\
                "type": "MOBILE"\
            }\
        }\
    ],
    "attributes": { "attribute1": "value" },
    "cartons": [\
        {\
            "items": [\
                {\
                    "lineItemId": "1",\
                    "shippedQuantity": 2,\
                    "attributes": { "attribute1": "value" },\
                    "fees": [\
                        {\
                            "amount": 34.56,\
                            "amountInCurrencies": [\
                                {\
                                    "currency": "USD",\
                                    "group": "SHOPPER",\
                                    "amount": 123.45\
                                }\
                            ],\
                            "name": "RETURN_FEE",\
                            "reason": "Return fee",\
                            "type": "FEE"\
                        }\
                    ],\
                    "giftCards": [\
                        {\
                            "amount": 50,\
                            "giftCardNumber": "453456765"\
                        }\
                    ],\
                    "itemId": 100023,\
                    "orderId": "6413e370cb0dc859b6c0dcb0",\
                    "orderNumber": "309020213",\
                    "shipmentExternalId": "123k4h123k",\
                    "orderedQuantity": 2,\
                    "refundAmount": 10,\
                    "refundAmountInCurrencies": [\
                        {\
                            "currency": "USD",\
                            "group": "SHOPPER",\
                            "amount": 123.45\
                        }\
                    ],\
                    "returnQuantity": 1,\
                    "returnRequestCounter": 1,\
                    "segment": "segment",\
                    "sku": "SKU0023",\
                    "uom": "EA",\
                    "vendorId": "56"\
                }\
            ],\
            "cartonNumber": 1,\
            "cartonType": "Package",\
            "promisedDeliveryDate": "2023-03-26T07:58:30.996Z",\
            "estimatedShipDate": "2023-03-25T07:58:30.996Z",\
            "estimatedDeliveryDate": "2023-03-26T07:58:30.996Z",\
            "shipmentMethod": "ground",\
            "shipmentCarrier": "FEDEX",\
            "weight": 500,\
            "trackingNumber": "1Z999AA10123456784",\
            "trackingURL": "https://fedex.com/tracking",\
            "tracking": [\
                {\
                    "event": "picked up",\
                    "eventId": "627963716b19511e8a3a631b",\
                    "eventRecordedAt": "2019-09-30T07:58:30.996Z",\
                    "location": "Reno, NV",\
                    "notes": { "description": "Shipment picked up" },\
                    "shipmentCarrier": "FEDEX"\
                }\
            ]\
        }\
    ],
    "scratchedItems": [\
        {\
            "lineItemId": 2,\
            "quantity": 1,\
            "reasonCode": "ReasonCode23454",\
            "orderId": "6413e370cb0dc859b6c0dcb0",\
            "orderNumber": 309020213,\
            "orderExternalId": "123k4h123k",\
            "itemId": 100043,\
            "sku": "SKU00043",\
            "uom": "EA",\
            "subReasonCode": "SubReasonCode23242",\
            "attributes": { "attribute1": "value" }\
        }\
    ]
}
headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "x-fabric-channel-id": "<x-fabric-channel-id>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    'x-fabric-channel-id': '<x-fabric-channel-id>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    shipmentNumber: 78974156816152,
    shipmentExternalId: '123k4h123k',
    poNumber: 1125,
    vendorId: 56,
    statusCode: 'SHIPMENT_CREATED',
    type: 'STANDARD',
    subtype: 'COD',
    reshipmentReasonCode: 'Order is missing',
    shippedAt: '2023-04-06T07:58:30.996Z',
    locationNumber: 132412,
    locationType: 'DC',
    totalCartons: 2,
    masterTrackingNumber: 'TX112345678',
    shipToId: 'sg6683620405',
    recipients: [\
      {\
        email: 'support@example.inc',\
        name: {firstName: 'Alex', lastName: 'Doe', middleName: 'E'},\
        phone: {number: '123-456-7890', type: 'MOBILE'}\
      }\
    ],
    attributes: {attribute1: 'value'},
    cartons: [\
      {\
        items: [\
          {\
            lineItemId: '1',\
            shippedQuantity: 2,\
            attributes: {attribute1: 'value'},\
            fees: [\
              {\
                amount: 34.56,\
                amountInCurrencies: [{currency: 'USD', group: 'SHOPPER', amount: 123.45}],\
                name: 'RETURN_FEE',\
                reason: 'Return fee',\
                type: 'FEE'\
              }\
            ],\
            giftCards: [{amount: 50, giftCardNumber: '453456765'}],\
            itemId: 100023,\
            orderId: '6413e370cb0dc859b6c0dcb0',\
            orderNumber: '309020213',\
            shipmentExternalId: '123k4h123k',\
            orderedQuantity: 2,\
            refundAmount: 10,\
            refundAmountInCurrencies: [{currency: 'USD', group: 'SHOPPER', amount: 123.45}],\
            returnQuantity: 1,\
            returnRequestCounter: 1,\
            segment: 'segment',\
            sku: 'SKU0023',\
            uom: 'EA',\
            vendorId: '56'\
          }\
        ],\
        cartonNumber: 1,\
        cartonType: 'Package',\
        promisedDeliveryDate: '2023-03-26T07:58:30.996Z',\
        estimatedShipDate: '2023-03-25T07:58:30.996Z',\
        estimatedDeliveryDate: '2023-03-26T07:58:30.996Z',\
        shipmentMethod: 'ground',\
        shipmentCarrier: 'FEDEX',\
        weight: 500,\
        trackingNumber: '1Z999AA10123456784',\
        trackingURL: 'https://fedex.com/tracking',\
        tracking: [\
          {\
            event: 'picked up',\
            eventId: '627963716b19511e8a3a631b',\
            eventRecordedAt: '2019-09-30T07:58:30.996Z',\
            location: 'Reno, NV',\
            notes: {description: 'Shipment picked up'},\
            shipmentCarrier: 'FEDEX'\
          }\
        ]\
      }\
    ],
    scratchedItems: [\
      {\
        lineItemId: 2,\
        quantity: 1,\
        reasonCode: 'ReasonCode23454',\
        orderId: '6413e370cb0dc859b6c0dcb0',\
        orderNumber: 309020213,\
        orderExternalId: '123k4h123k',\
        itemId: 100043,\
        sku: 'SKU00043',\
        uom: 'EA',\
        subReasonCode: 'SubReasonCode23242',\
        attributes: {attribute1: 'value'}\
      }\
    ]
  })
};

fetch('https://api.fabric.inc/v3/shipments/create-order-shipment', 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://api.fabric.inc/v3/shipments/create-order-shipment",\
  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([\
    'shipmentNumber' => 78974156816152,\
    'shipmentExternalId' => '123k4h123k',\
    'poNumber' => 1125,\
    'vendorId' => 56,\
    'statusCode' => 'SHIPMENT_CREATED',\
    'type' => 'STANDARD',\
    'subtype' => 'COD',\
    'reshipmentReasonCode' => 'Order is missing',\
    'shippedAt' => '2023-04-06T07:58:30.996Z',\
    'locationNumber' => 132412,\
    'locationType' => 'DC',\
    'totalCartons' => 2,\
    'masterTrackingNumber' => 'TX112345678',\
    'shipToId' => 'sg6683620405',\
    'recipients' => [\
        [\
                'email' => 'support@example.inc',\
                'name' => [\
                                'firstName' => 'Alex',\
                                'lastName' => 'Doe',\
                                'middleName' => 'E'\
                ],\
                'phone' => [\
                                'number' => '123-456-7890',\
                                'type' => 'MOBILE'\
                ]\
        ]\
    ],\
    'attributes' => [\
        'attribute1' => 'value'\
    ],\
    'cartons' => [\
        [\
                'items' => [\
                                [\
                                                                'lineItemId' => '1',\
                                                                'shippedQuantity' => 2,\
                                                                'attributes' => [\
                                                                                                                                'attribute1' => 'value'\
                                                                ],\
                                                                'fees' => [\
                                                                                                                                [\
                                                                                                                                                                                                                                                                'amount' => 34.56,\
                                                                                                                                                                                                                                                                'amountInCurrencies' => [\
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [\
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'currency' => 'USD',\
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'group' => 'SHOPPER',\
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'amount' => 123.45\
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]\
                                                                                                                                                                                                                                                                ],\
                                                                                                                                                                                                                                                                'name' => 'RETURN_FEE',\
                                                                                                                                                                                                                                                                'reason' => 'Return fee',\
                                                                                                                                                                                                                                                                'type' => 'FEE'\
                                                                                                                                ]\
                                                                ],\
                                                                'giftCards' => [\
                                                                                                                                [\
                                                                                                                                                                                                                                                                'amount' => 50,\
                                                                                                                                                                                                                                                                'giftCardNumber' => '453456765'\
                                                                                                                                ]\
                                                                ],\
                                                                'itemId' => 100023,\
                                                                'orderId' => '6413e370cb0dc859b6c0dcb0',\
                                                                'orderNumber' => '309020213',\
                                                                'shipmentExternalId' => '123k4h123k',\
                                                                'orderedQuantity' => 2,\
                                                                'refundAmount' => 10,\
                                                                'refundAmountInCurrencies' => [\
                                                                                                                                [\
                                                                                                                                                                                                                                                                'currency' => 'USD',\
                                                                                                                                                                                                                                                                'group' => 'SHOPPER',\
                                                                                                                                                                                                                                                                'amount' => 123.45\
                                                                                                                                ]\
                                                                ],\
                                                                'returnQuantity' => 1,\
                                                                'returnRequestCounter' => 1,\
                                                                'segment' => 'segment',\
                                                                'sku' => 'SKU0023',\
                                                                'uom' => 'EA',\
                                                                'vendorId' => '56'\
                                ]\
                ],\
                'cartonNumber' => 1,\
                'cartonType' => 'Package',\
                'promisedDeliveryDate' => '2023-03-26T07:58:30.996Z',\
                'estimatedShipDate' => '2023-03-25T07:58:30.996Z',\
                'estimatedDeliveryDate' => '2023-03-26T07:58:30.996Z',\
                'shipmentMethod' => 'ground',\
                'shipmentCarrier' => 'FEDEX',\
                'weight' => 500,\
                'trackingNumber' => '1Z999AA10123456784',\
                'trackingURL' => 'https://fedex.com/tracking',\
                'tracking' => [\
                                [\
                                                                'event' => 'picked up',\
                                                                'eventId' => '627963716b19511e8a3a631b',\
                                                                'eventRecordedAt' => '2019-09-30T07:58:30.996Z',\
                                                                'location' => 'Reno, NV',\
                                                                'notes' => [\
                                                                                                                                'description' => 'Shipment picked up'\
                                                                ],\
                                                                'shipmentCarrier' => 'FEDEX'\
                                ]\
                ]\
        ]\
    ],\
    'scratchedItems' => [\
        [\
                'lineItemId' => 2,\
                'quantity' => 1,\
                'reasonCode' => 'ReasonCode23454',\
                'orderId' => '6413e370cb0dc859b6c0dcb0',\
                'orderNumber' => 309020213,\
                'orderExternalId' => '123k4h123k',\
                'itemId' => 100043,\
                'sku' => 'SKU00043',\
                'uom' => 'EA',\
                'subReasonCode' => 'SubReasonCode23242',\
                'attributes' => [\
                                'attribute1' => 'value'\
                ]\
        ]\
    ]\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json",\
    "x-fabric-channel-id: <x-fabric-channel-id>",\
    "x-fabric-tenant-id: <x-fabric-tenant-id>"\
  ],\
]);

$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://api.fabric.inc/v3/shipments/create-order-shipment"

payload := strings.NewReader("{\n  \"shipmentNumber\": 78974156816152,\n  \"shipmentExternalId\": \"123k4h123k\",\n  \"poNumber\": 1125,\n  \"vendorId\": 56,\n  \"statusCode\": \"SHIPMENT_CREATED\",\n  \"type\": \"STANDARD\",\n  \"subtype\": \"COD\",\n  \"reshipmentReasonCode\": \"Order is missing\",\n  \"shippedAt\": \"2023-04-06T07:58:30.996Z\",\n  \"locationNumber\": 132412,\n  \"locationType\": \"DC\",\n  \"totalCartons\": 2,\n  \"masterTrackingNumber\": \"TX112345678\",\n  \"shipToId\": \"sg6683620405\",\n  \"recipients\": [\n    {\n      \"email\": \"support@example.inc\",\n      \"name\": {\n        \"firstName\": \"Alex\",\n        \"lastName\": \"Doe\",\n        \"middleName\": \"E\"\n      },\n      \"phone\": {\n        \"number\": \"123-456-7890\",\n        \"type\": \"MOBILE\"\n      }\n    }\n  ],\n  \"attributes\": {\n    \"attribute1\": \"value\"\n  },\n  \"cartons\": [\n    {\n      \"items\": [\n        {\n          \"lineItemId\": \"1\",\n          \"shippedQuantity\": 2,\n          \"attributes\": {\n            \"attribute1\": \"value\"\n          },\n          \"fees\": [\n            {\n              \"amount\": 34.56,\n              \"amountInCurrencies\": [\n                {\n                  \"currency\": \"USD\",\n                  \"group\": \"SHOPPER\",\n                  \"amount\": 123.45\n                }\n              ],\n              \"name\": \"RETURN_FEE\",\n              \"reason\": \"Return fee\",\n              \"type\": \"FEE\"\n            }\n          ],\n          \"giftCards\": [\n            {\n              \"amount\": 50,\n              \"giftCardNumber\": \"453456765\"\n            }\n          ],\n          \"itemId\": 100023,\n          \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n          \"orderNumber\": \"309020213\",\n          \"shipmentExternalId\": \"123k4h123k\",\n          \"orderedQuantity\": 2,\n          \"refundAmount\": 10,\n          \"refundAmountInCurrencies\": [\n            {\n              \"currency\": \"USD\",\n              \"group\": \"SHOPPER\",\n              \"amount\": 123.45\n            }\n          ],\n          \"returnQuantity\": 1,\n          \"returnRequestCounter\": 1,\n          \"segment\": \"segment\",\n          \"sku\": \"SKU0023\",\n          \"uom\": \"EA\",\n          \"vendorId\": \"56\"\n        }\n      ],\n      \"cartonNumber\": 1,\n      \"cartonType\": \"Package\",\n      \"promisedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"estimatedShipDate\": \"2023-03-25T07:58:30.996Z\",\n      \"estimatedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"shipmentMethod\": \"ground\",\n      \"shipmentCarrier\": \"FEDEX\",\n      \"weight\": 500,\n      \"trackingNumber\": \"1Z999AA10123456784\",\n      \"trackingURL\": \"https://fedex.com/tracking\",\n      \"tracking\": [\n        {\n          \"event\": \"picked up\",\n          \"eventId\": \"627963716b19511e8a3a631b\",\n          \"eventRecordedAt\": \"2019-09-30T07:58:30.996Z\",\n          \"location\": \"Reno, NV\",\n          \"notes\": {\n            \"description\": \"Shipment picked up\"\n          },\n          \"shipmentCarrier\": \"FEDEX\"\n        }\n      ]\n    }\n  ],\n  \"scratchedItems\": [\n    {\n      \"lineItemId\": 2,\n      \"quantity\": 1,\n      \"reasonCode\": \"ReasonCode23454\",\n      \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n      \"orderNumber\": 309020213,\n      \"orderExternalId\": \"123k4h123k\",\n      \"itemId\": 100043,\n      \"sku\": \"SKU00043\",\n      \"uom\": \"EA\",\n      \"subReasonCode\": \"SubReasonCode23242\",\n      \"attributes\": {\n        \"attribute1\": \"value\"\n      }\n    }\n  ]\n}")

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

req.Header.Add("x-fabric-tenant-id", "<x-fabric-tenant-id>")
    req.Header.Add("x-fabric-channel-id", "<x-fabric-channel-id>")
    req.Header.Add("Authorization", "Bearer <token>")
    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://api.fabric.inc/v3/shipments/create-order-shipment")
  .header("x-fabric-tenant-id", "<x-fabric-tenant-id>")
  .header("x-fabric-channel-id", "<x-fabric-channel-id>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"shipmentNumber\": 78974156816152,\n  \"shipmentExternalId\": \"123k4h123k\",\n  \"poNumber\": 1125,\n  \"vendorId\": 56,\n  \"statusCode\": \"SHIPMENT_CREATED\",\n  \"type\": \"STANDARD\",\n  \"subtype\": \"COD\",\n  \"reshipmentReasonCode\": \"Order is missing\",\n  \"shippedAt\": \"2023-04-06T07:58:30.996Z\",\n  \"locationNumber\": 132412,\n  \"locationType\": \"DC\",\n  \"totalCartons\": 2,\n  \"masterTrackingNumber\": \"TX112345678\",\n  \"shipToId\": \"sg6683620405\",\n  \"recipients\": [\n    {\n      \"email\": \"support@example.inc\",\n      \"name\": {\n        \"firstName\": \"Alex\",\n        \"lastName\": \"Doe\",\n        \"middleName\": \"E\"\n      },\n      \"phone\": {\n        \"number\": \"123-456-7890\",\n        \"type\": \"MOBILE\"\n      }\n    }\n  ],\n  \"attributes\": {\n    \"attribute1\": \"value\"\n  },\n  \"cartons\": [\n    {\n      \"items\": [\n        {\n          \"lineItemId\": \"1\",\n          \"shippedQuantity\": 2,\n          \"attributes\": {\n            \"attribute1\": \"value\"\n          },\n          \"fees\": [\n            {\n              \"amount\": 34.56,\n              \"amountInCurrencies\": [\n                {\n                  \"currency\": \"USD\",\n                  \"group\": \"SHOPPER\",\n                  \"amount\": 123.45\n                }\n              ],\n              \"name\": \"RETURN_FEE\",\n              \"reason\": \"Return fee\",\n              \"type\": \"FEE\"\n            }\n          ],\n          \"giftCards\": [\n            {\n              \"amount\": 50,\n              \"giftCardNumber\": \"453456765\"\n            }\n          ],\n          \"itemId\": 100023,\n          \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n          \"orderNumber\": \"309020213\",\n          \"shipmentExternalId\": \"123k4h123k\",\n          \"orderedQuantity\": 2,\n          \"refundAmount\": 10,\n          \"refundAmountInCurrencies\": [\n            {\n              \"currency\": \"USD\",\n              \"group\": \"SHOPPER\",\n              \"amount\": 123.45\n            }\n          ],\n          \"returnQuantity\": 1,\n          \"returnRequestCounter\": 1,\n          \"segment\": \"segment\",\n          \"sku\": \"SKU0023\",\n          \"uom\": \"EA\",\n          \"vendorId\": \"56\"\n        }\n      ],\n      \"cartonNumber\": 1,\n      \"cartonType\": \"Package\",\n      \"promisedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"estimatedShipDate\": \"2023-03-25T07:58:30.996Z\",\n      \"estimatedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"shipmentMethod\": \"ground\",\n      \"shipmentCarrier\": \"FEDEX\",\n      \"weight\": 500,\n      \"trackingNumber\": \"1Z999AA10123456784\",\n      \"trackingURL\": \"https://fedex.com/tracking\",\n      \"tracking\": [\n        {\n          \"event\": \"picked up\",\n          \"eventId\": \"627963716b19511e8a3a631b\",\n          \"eventRecordedAt\": \"2019-09-30T07:58:30.996Z\",\n          \"location\": \"Reno, NV\",\n          \"notes\": {\n            \"description\": \"Shipment picked up\"\n          },\n          \"shipmentCarrier\": \"FEDEX\"\n        }\n      ]\n    }\n  ],\n  \"scratchedItems\": [\n    {\n      \"lineItemId\": 2,\n      \"quantity\": 1,\n      \"reasonCode\": \"ReasonCode23454\",\n      \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n      \"orderNumber\": 309020213,\n      \"orderExternalId\": \"123k4h123k\",\n      \"itemId\": 100043,\n      \"sku\": \"SKU00043\",\n      \"uom\": \"EA\",\n      \"subReasonCode\": \"SubReasonCode23242\",\n      \"attributes\": {\n        \"attribute1\": \"value\"\n      }\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/shipments/create-order-shipment")

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

request = Net::HTTP::Post.new(url)
request["x-fabric-tenant-id"] = '<x-fabric-tenant-id>'
request["x-fabric-channel-id"] = '<x-fabric-channel-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"shipmentNumber\": 78974156816152,\n  \"shipmentExternalId\": \"123k4h123k\",\n  \"poNumber\": 1125,\n  \"vendorId\": 56,\n  \"statusCode\": \"SHIPMENT_CREATED\",\n  \"type\": \"STANDARD\",\n  \"subtype\": \"COD\",\n  \"reshipmentReasonCode\": \"Order is missing\",\n  \"shippedAt\": \"2023-04-06T07:58:30.996Z\",\n  \"locationNumber\": 132412,\n  \"locationType\": \"DC\",\n  \"totalCartons\": 2,\n  \"masterTrackingNumber\": \"TX112345678\",\n  \"shipToId\": \"sg6683620405\",\n  \"recipients\": [\n    {\n      \"email\": \"support@example.inc\",\n      \"name\": {\n        \"firstName\": \"Alex\",\n        \"lastName\": \"Doe\",\n        \"middleName\": \"E\"\n      },\n      \"phone\": {\n        \"number\": \"123-456-7890\",\n        \"type\": \"MOBILE\"\n      }\n    }\n  ],\n  \"attributes\": {\n    \"attribute1\": \"value\"\n  },\n  \"cartons\": [\n    {\n      \"items\": [\n        {\n          \"lineItemId\": \"1\",\n          \"shippedQuantity\": 2,\n          \"attributes\": {\n            \"attribute1\": \"value\"\n          },\n          \"fees\": [\n            {\n              \"amount\": 34.56,\n              \"amountInCurrencies\": [\n                {\n                  \"currency\": \"USD\",\n                  \"group\": \"SHOPPER\",\n                  \"amount\": 123.45\n                }\n              ],\n              \"name\": \"RETURN_FEE\",\n              \"reason\": \"Return fee\",\n              \"type\": \"FEE\"\n            }\n          ],\n          \"giftCards\": [\n            {\n              \"amount\": 50,\n              \"giftCardNumber\": \"453456765\"\n            }\n          ],\n          \"itemId\": 100023,\n          \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n          \"orderNumber\": \"309020213\",\n          \"shipmentExternalId\": \"123k4h123k\",\n          \"orderedQuantity\": 2,\n          \"refundAmount\": 10,\n          \"refundAmountInCurrencies\": [\n            {\n              \"currency\": \"USD\",\n              \"group\": \"SHOPPER\",\n              \"amount\": 123.45\n            }\n          ],\n          \"returnQuantity\": 1,\n          \"returnRequestCounter\": 1,\n          \"segment\": \"segment\",\n          \"sku\": \"SKU0023\",\n          \"uom\": \"EA\",\n          \"vendorId\": \"56\"\n        }\n      ],\n      \"cartonNumber\": 1,\n      \"cartonType\": \"Package\",\n      \"promisedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"estimatedShipDate\": \"2023-03-25T07:58:30.996Z\",\n      \"estimatedDeliveryDate\": \"2023-03-26T07:58:30.996Z\",\n      \"shipmentMethod\": \"ground\",\n      \"shipmentCarrier\": \"FEDEX\",\n      \"weight\": 500,\n      \"trackingNumber\": \"1Z999AA10123456784\",\n      \"trackingURL\": \"https://fedex.com/tracking\",\n      \"tracking\": [\n        {\n          \"event\": \"picked up\",\n          \"eventId\": \"627963716b19511e8a3a631b\",\n          \"eventRecordedAt\": \"2019-09-30T07:58:30.996Z\",\n          \"location\": \"Reno, NV\",\n          \"notes\": {\n            \"description\": \"Shipment picked up\"\n          },\n          \"shipmentCarrier\": \"FEDEX\"\n        }\n      ]\n    }\n  ],\n  \"scratchedItems\": [\n    {\n      \"lineItemId\": 2,\n      \"quantity\": 1,\n      \"reasonCode\": \"ReasonCode23454\",\n      \"orderId\": \"6413e370cb0dc859b6c0dcb0\",\n      \"orderNumber\": 309020213,\n      \"orderExternalId\": \"123k4h123k\",\n      \"itemId\": 100043,\n      \"sku\": \"SKU00043\",\n      \"uom\": \"EA\",\n      \"subReasonCode\": \"SubReasonCode23242\",\n      \"attributes\": {\n        \"attribute1\": \"value\"\n      }\n    }\n  ]\n}"

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

201

400

401

500

{
  "version": 2,
  "allocationId": "6413e3d3fd03a35efccb426e",
  "auditLogs": [\
    {\
      "auditId": "a05b72dc-78d8-4ea4-90fc-2fe6a1fe1111",\
      "auditType": "CANCEL",\
      "auditedAt": "2023-03-12T09:24:54.804Z",\
      "employeeId": "6227",\
      "lineItemId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",\
      "note": "Note",\
      "reasonCode": "Scratched item",\
      "source": "POS",\
      "subReasonCode": "Scratched item",\
      "updatedFields": [\
        {\
          "fieldName": "UOM",\
          "fieldOriginalValue": "PK"\
        }\
      ]\
    }\
  ],
  "cartons": [\
    {\
      "cartonNumber": "1",\
      "cartonType": "Package",\
      "estimatedDeliveryDate": "2023-04-26T07:58:30.996Z",\
      "estimatedShipmentDate": "2023-03-25T07:58:30.996Z",\
      "items": [\
        {\
          "fees": [\
            {\
              "amount": 34.56,\
              "amountInCurrencies": [\
                {\
                  "currency": "USD",\
                  "group": "SHOPPER",\
                  "amount": 123.45\
                }\
              ],\
              "name": "RETURN_FEE",\
              "reason": "Return fee",\
              "type": "FEE"\
            }\
          ],\
          "giftCards": [\
            {\
              "amount": 50,\
              "amountInCurrencies": [\
                {\
                  "currency": "USD",\
                  "group": "SHOPPER",\
                  "amount": 123.45\
                }\
              ],\
              "giftCardActivatedAt": "2023-04-26T07:58:30.996Z",\
              "giftCardActivationRequestedAt": "2023-03-26T07:58:30.996Z",\
              "giftCardNumber": "453456765",\
              "giftCardStatus": "ACTIVE"\
            }\
          ],\
          "itemId": 100023,\
          "lineItemId": "1",\
          "orderId": "6413e370cb0dc859b6c0dcb0",\
          "orderNumber": "309020213",\
          "orderedQuantity": 2,\
          "refundAmount": 10,\
          "refundAmountInCurrencies": [\
            {\
              "currency": "USD",\
              "group": "SHOPPER",\
              "amount": 123.45\
            }\
          ],\
          "returnQuantity": 1,\
          "segment": "segment",\
          "shipmentLineItemId": "607f1f77bcf86cd799439011",\
          "shippedQuantity": 2,\
          "sku": "SKU0023",\
          "uom": "EA",\
          "vendorId": "vend12346667"\
        }\
      ],\
      "promisedDeliveryDate": "2023-03-26T07:58:30.996Z",\
      "shipmentCarrier": "FEDEX",\
      "shipmentMethod": "ground",\
      "tracking": [\
        {\
          "event": "picked up",\
          "eventId": "627963716b19511e8a3a631b",\
          "eventRecordedAt": "2019-09-30T07:58:30.996Z",\
          "location": "Reno, NV",\
          "notes": {\
            "description": "Shipment picked up"\
          },\
          "shipmentCarrier": "FEDEX"\
        }\
      ],\
      "trackingNumber": "1Z999AA10123456784",\
      "trackingURL": "https://example.com/tracking",\
      "weight": "500 grams"\
    }\
  ],
  "createdAt": "2023-04-06T07:58:30.996Z",
  "invoiceId": "63ef4360aafa8a7f5247fe48",
  "locationNumber": "WH334",
  "locationType": "DC",
  "masterTrackingNumber": "TX112345678",
  "orderNumbers": [\
    "309020213, 459020213"\
  ],
  "poNumber": "1125",
  "recipients": [\
    {\
      "email": "support@example.inc",\
      "name": {\
        "firstName": "Alex",\
        "lastName": "Doe",\
        "middleName": "E"\
      },\
      "phone": {\
        "number": "123-456-7890",\
        "type": "MOBILE"\
      }\
    }\
  ],
  "reshipmentReasonCode": "Order is missing",
  "scratchedItems": [\
    {\
      "reasonCode": "ReasonCode23454",\
      "itemId": 100043,\
      "lineItemId": "2",\
      "orderId": "6413e370cb0dc859b6c0dcb0",\
      "quantity": 1,\
      "sku": "SKU00043",\
      "subReasonCode": "SubReasonCode23242",\
      "uom": "EA"\
    }\
  ],
  "shipToAddress": {
    "addressLine1": "123 Main St.",
    "city": "Seattle",
    "countryCode": "US",
    "latitude": 47.6205,
    "longitude": -122.3493,
    "postalCode": "98121",
    "region": "WA",
    "type": "Home",
    "addressLine2": "Suite 100",
    "addressLine3": "Seventh floor",
    "addressLine4": "Attention: Pat E. Kake",
    "email": "test@example.com",
    "name": {
      "firstName": "Alex",
      "lastName": "Doe",
      "middleName": "E"
    },
    "phone": {
      "number": "123-456-7890",
      "type": "MOBILE"
    }
  },
  "shipToId": "1",
  "shipmentId": "627963716b19511e8a3a631b",
  "shipmentNumber": "78974156816152",
  "shipmentExternalId": "123k4h123k",
  "shippedAt": "2023-04-06T07:58:30.996Z",
  "statusCode": "SHIPMENT_CREATED",
  "subtype": "COD",
  "totalCartons": 2,
  "type": "STANDARD",
  "updatedAt": "2023-04-06T07:58:30.996Z",
  "vendorId": "56"
}
{
  "type": "CLIENT_ERROR",
  "errorCode": "SERVICE-4003",
  "message": "Mandatory param(s): `requiredField1` is/are missing",
  "errors": [\
    {\
      "type": "CLIENT_ERROR",\
      "errorCode": "SERVICE-4002",\
      "message": "Invalid value(s) specified for 'requiredField.field3'",\
      "errors": []\
    }\
  ],
  "context": {
    "service": "orders",
    "endpoint": "POST /v3/orders"
  }
}
{
  "type": "CLIENT_ERROR",
  "errorCode": "SERVICE-4001",
  "message": "Unauthorized request",
  "errors": [],
  "context": {
    "service": "orders",
    "endpoint": "POST /v3/orders/OrderId_12345"
  }
}
{
  "type": "SERVER_ERROR",
  "errorCode": "SERVICE-5000",
  "message": "Internal server error",
  "errors": [],
  "context": {
    "service": "inventories",
    "endpoint": "POST /v3/inventories/actions/find-by-geography"
  }
}

POST

/

shipments

/

create-order-shipment

Try it

Create shipment for an existing order

cURL

import requests

url = "https://api.fabric.inc/v3/shipments/create-order-shipment"

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://api.fabric.inc/v3/shipments/create-order-shipment"

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

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://api.fabric.inc/v3/shipments/create-order-shipment")

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

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

201

400

401

500

Authorizations

Authorization

string

header

required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-fabric-tenant-id

string

required

A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.

x-fabric-channel-id

string

required

x-fabric-channel-id identifies the sales channel where the API request is being made; primarily for multichannel use cases. The channel ids are 12 corresponding to US and 13 corresponding to Canada. The default channel id is 12. This field is required.

x-fabric-request-id

string

Unique request ID

Body

application/json

Request payload to create a shipment for an order.

shipmentNumber

string

required

Unique shipment identifier defined by the merchant.

Example:

78974156816152

shipmentExternalId

string

Unique shipment identifier defined by the merchant. This value can be used to track or reconcile shipments in external systems and serves as a reference between fabric and the merchant's order management or fulfillment system.

Example:

"123k4h123k"

poNumber

string

Merchant-defined purchase order number associated with the shipment.

Example:

1125

vendorId

string

Vendor identifier. In dropshipping scenarios, indicates the vendor responsible for fulfilling the shipment.

Example:

56

statusCode

enum

Current status of the shipment.

Available options:

SHIPMENT_CREATED,

SHIPMENT_UPDATED,

SHIPMENT_CANCELLED,

PICKUP_CREATED,

PICKUP_COMPLETED,

SHIPMENT_RETURN_PENDING,

SHIPMENT_RETURN_RECEIVED,

SHIPMENT_PARTIALLY_DELIVERED,

SHIPMENT_DELIVERED,

SHIPMENT_ERROR

Example:

"SHIPMENT_CREATED"

type

enum

Type of shipment.

Available options:

STANDARD,

RESHIP,

RETURN,

SCRATCH,

PENDING_RETURN,

PICKUP,

TRANSFER

Example:

"STANDARD"

subtype

string

Free-form text to provide an additional classification for the shipment, if required.

Example:

"COD"

reshipmentReasonCode

string

Code indicating the reason for a reshipment.

Example:

"Order is missing"

shippedAt

string

UTC timestamp indicating when the shipment was created or shipped.

Example:

"2023-04-06T07:58:30.996Z"

locationNumber

string

Identifier of the ship-from location. Must match the locationNumber stored in the fabric Location service.

Example:

132412

locationType

string

Type of the ship-from location (for example, distribution center (DC) or warehouse). Must match the value stored in the fabric Location service.

Example:

"DC"

totalCartons

integer

Total number of cartons included in the shipment.

Example:

2

masterTrackingNumber

string

Carrier-provided master tracking number that applies to all cartons in the shipment.

Example:

"TX112345678"

shipToId

string

Ship-to identifier generated in the response of the Create Shipping endpoint in the Shipping service.

Example:

"sg6683620405"

shipToAddress

object

Address details

Showchild attributes

recipients

object[]

List of recipients for the shipment.

Showchild attributes

attributes

object

Merchant-defined custom attributes, represented as key-value pairs. Useful for storing additional information.

Example:

{ "attribute1": "value" }

cartons

object[]

Details of cartons included in the shipment.

Showchild attributes

scratchedItems

object[]

Details of items marked as scratched from the shipment.

Showchild attributes

Response

201

application/json

Created

Shipment details

version

integer

required

The current version of the shipment document. This integer indicates the number of times the shipment has been updated by any operation.

Example:

2

allocationId

string

System-generated allocation ID (UUID) from the Create allocation endpoint of fabric Allocation service. It refers to the given shipment. Note: Allocation occurs prior to Shipment Creation. allocationId is mandatory to create a Shipment.

Example:

"6413e3d3fd03a35efccb426e"

auditLogs

object[]

Audit log details

Showchild attributes

cartons

object[]

Carton details

Showchild attributes

createdAt

string

Shipment creation time (UTC)

Example:

"2023-04-06T07:58:30.996Z"

invoiceId

string

Invoice ID generated from fabric Invoice service during shipment creation. Note: Invoices are only created for Shipments where merchants have payment Capture at Shipment feature enabled. The value will be “Null” if merchants don't have “Capture at Shipment” feature enabled.

Example:

"63ef4360aafa8a7f5247fe48"

locationNumber

string

Unique value to identify ship-from location. This must be the locationNumber stored in the fabric Location service.

Example:

"WH334"

locationType

string

Location type, such as distribution center (DC) or warehouse

Example:

"DC"

masterTrackingNumber

string

Master tracking number for all cartons in the shipment

Example:

"TX112345678"

orderNumbers

string[]

List of order numbers associated with a shipment. Note: Currently, a shipment can be associated with only one order. In the future, this property will support a scenario where a customer places a second order for the same product immediately after their first order. Multiple order numbers can be linked to one shipment in such cases.

poNumber

string

Merchant-defined purchase order number

Example:

"1125"

recipients

object[]

Recipient details

Showchild attributes

reshipmentReasonCode

string

The reshipment reason code.

Example:

"Order is missing"

scratchedItems

object[]

Details of scratched items

Showchild attributes

shipToAddress

object

Address details

Showchild attributes

shipToId

string

Ship-to ID generated in the response of Create shipping endpoint of Shipping service

Example:

"1"

shipmentId

string

System-generated shipment ID (UUID)

Example:

"627963716b19511e8a3a631b"

shipmentNumber

string

Merchant-defined unique shipment identifier. Note: It can be optionally generated by fabric by using resource generator feature in the Configuration service

Example:

"78974156816152"

shipmentExternalId

string

Example:

"123k4h123k"

shippedAt

string

Order shipment time (UTC)

Example:

"2023-04-06T07:58:30.996Z"

statusCode

enum

Current shipment status (fabric-defined codes). Note: For standard shipments, the status would be SHIPMENT_CREATED. For pickup shipment, the initial status would be PICKUP_CREATED and once the customer picks up, the status changes to PICKUP_COMPLETED

Available options:

SHIPMENT_CREATED,

SHIPMENT_UPDATED,

SHIPMENT_CANCELLED,

PICKUP_CREATED,

PICKUP_COMPLETED,

SHIPMENT_DELIVERED,

SHIPMENT_RETURN_PENDING,

SHIPMENT_RETURN_RECEIVED,

SHIPMENT_PARTIALLY_DELIVERED

Example:

"SHIPMENT_CREATED"

subtype

string

Shipment subtype, for another layer of classification. There are no pre-defined values; the possible value is Cash On Delivery (COD)

Example:

"COD"

totalCartons

integer

Total number of cartons in the given shipment. There can be only one carton per trackingNumber.

Example:

2

type

enum

Shipment types

Available options:

STANDARD,

RESHIP,

RETURN,

SCRATCH,

PENDING_RETURN,

PICKUP,

TRANSFER

Example:

"STANDARD"

updatedAt

string

Time of last update to shipment (UTC)

Example:

"2023-04-06T07:58:30.996Z"

vendorId

string

Vendor ID. Applicable in dropshipping scenarios to indicate the vendor responsible for the given item.

Example:

"56"

Was this page helpful?

YesNo

Create new shipment Get shipment by ID

Ctrl+I

Assistant

Responses are generated using AI and may contain mistakes.