POST
/
api-order
/
orders
/
query
curl --request POST \
  --url https://prod01-apigw.{customer_name}.fabric.zone/api-order/orders/query \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '{
  "offset": 0,
  "limit": 10,
  "sortBy": "createdAt",
  "sortDirection": "desc",
  "filters": {
    "status": [
      "ORDER_CREATED",
      "ORDER_PAYMENT_AUTHORIZED"
    ],
    "date": {
      "gte": "2020-11-01T18:12:03.412Z",
      "lte": "2022-12-03T18:12:03.412Z"
    },
    "orderTotal": {},
    "totalQuantity": {},
    "attributes": [
      {
        "attributeId": "60119337cb662800075717f8",
        "value": "blue"
      }
    ],
    "customerUserId": [
      "<string>"
    ],
    "customerEmail": [
      "<string>"
    ],
    "shipTo": [
      {
        "address": {
          "name": {
            "first": "Mark",
            "middle": "p",
            "last": "styler"
          },
          "phone": {
            "number": "555-555-5555",
            "kind": "mobile"
          },
          "isValidated": false,
          "email": "mark@google.com",
          "street1": "10400 NE 4th St",
          "street2": "Suite 500",
          "city": "Bellevue",
          "state": "WA",
          "country": "USA",
          "zipCode": "98004",
          "kind": "Ship to address"
        },
        "delivery": {
          "actual": "<string>"
        },
        "shipping": {
          "actual": "<string>"
        },
        "promosApplied": [
          {
            "name": "test1"
          }
        ],
        "_id": "602c1511fcc5e900078ba4af",
        "shipToId": 1000001,
        "shipToType": "SHIP_TO_ADDRESS",
        "price": 24.87,
        "currency": "USD",
        "estimatedTax": 10,
        "committedTax": 10,
        "total": 34.87,
        "taxCode": "FR020000",
        "shipmentCarrier": "Fedex",
        "shipmentMethod": "Express",
        "shipmentMethodId": "10000001",
        "promisedDeliveryDate": "2021-02-14T00:00:00.000Z",
        "shipmentInstructions": "Leave at back door",
        "shipmentStatus": "Delivered",
        "readyForPickups": [
          "<any>"
        ],
        "id": "602c1511fcc5e900078ba4af"
      }
    ]
  }
}'
{
  "query": {
    "limit": 2,
    "offset": 0,
    "count": 6,
    "orderTotalSum": 13543.5,
    "orderAverage": 2257.25,
    "totalQuantitySum": 82,
    "statusCounts": {
      "ORDER_CREATED": 0,
      "ORDER_CONFIRMED": 0,
      "ORDER_CANCELLED": 0,
      "ORDER_PARTIALLY_SHIPPED": 0,
      "ORDER_SHIPPED": 0,
      "ORDER_PARTIALLY_DELIVERED": 0,
      "ORDER_DELIVERED": 0,
      "ORDER_RETURNED": 0,
      "ORDER_PARTIALLY_RETURNED": 0,
      "ORDER_PAYMENT_AUTHORIZED": 0,
      "ORDER_PAYMENT_INVALID": 0,
      "ORDER_FULFILLED": 0,
      "ORDER_PARTIALLY_FULFILLED": 0,
      "ORDER_REFUNDED": 6
    },
    "paymentStatusCounts": {
      "succeeded": 3
    }
  },
  "orders": [
    {
      "_id": "608c8f995cc215000848a8e0",
      "tags": [
        "<any>"
      ],
      "cartId": "608c8c9e79f00c00080fbacc",
      "attributes": [
        "<any>"
      ],
      "customerEmail": "mike@fabric.inc",
      "orderCurrency": "USD",
      "orderTotal": 950.5,
      "taxTotal": 2.5,
      "channel": 12,
      "status": "ORDER_REFUNDED",
      "statusLog": "Order has been shipped",
      "orderReference": "9975-7559-14446",
      "orderId": "2660-5356-89773",
      "shipTo": [
        {
          "pickupPerson": {
            "name": {
              "first": "John",
              "last": "Doe"
            },
            "phone": {
              "number": 8087769338,
              "kind": "Mobile"
            },
            "email": "johndoe@fabric.inc"
          },
          "altPickupPerson": {
            "name": {
              "first": "first",
              "last": "last"
            },
            "phone": {
              "number": 8087769338,
              "kind": "Mobile"
            },
            "email": "first@fabric.inc"
          },
          "promosApplied": [
            "<any>"
          ],
          "_id": "608c8d2f798c0900083f60ee",
          "shipToType": "BOPIS",
          "taxCode": "FR1000",
          "shipToId": 978,
          "price": 0,
          "currency": null,
          "shipmentMethodId": null,
          "estimatedTax": 0,
          "shipmentCarrier": null,
          "shipmentMethod": null,
          "total": 0,
          "id": "608c8d2f798c0900083f60ee"
        }
      ],
      "items": [
        {
          "group": [
            1.2312312312312322e+23
          ],
          "promosApplied": [
            "<any>"
          ],
          "_id": "608c8cd679f00c00080fbace",
          "price": 900,
          "weightUnit": "lb",
          "isPickup": true,
          "itemId": 1000000051,
          "quantity": 1,
          "priceListId": 100269,
          "sku": 1538910,
          "taxCode": "PH060771",
          "title": "Luminous Cushion Lagoon",
          "weight": 1,
          "lineItemId": 1,
          "attributeTotalPrice": 0,
          "attributes": [
            "<any>"
          ],
          "warehouseId": "605d0c47c87d0e0008a3b5a8",
          "currency": "USD",
          "shipToId": 978,
          "discount": 0,
          "estimatedTax": 1,
          "total": 901,
          "reservedLocation": [
            {
              "_id": "608c8f9de4b526000842505f",
              "warehouseId": "605d0c47c87d0e0008a3b5a8",
              "quantity": 1,
              "id": "608c8f9de4b526000842505f"
            }
          ],
          "id": "608c8cd679f00c00080fbace"
        }
      ],
      "shipments": [
        {
          "_id": "60936b987d5a2f0008e8bea6",
          "shippedDate": "2021-05-06T04:07:47.654Z",
          "shipToId": 978,
          "shipmentCarrier": "USPS",
          "shipmentCarrierUrl": "https://tools.usps.com/go/TrackConfirmAction?tRef=fullpage&tLc=2&text28777=&tLabels=65765798989",
          "trackingNumber": 65765798989,
          "lineItems": [
            {
              "_id": "60936b987d5a2f0008e8bea7",
              "lineItemId": 1,
              "quantity": 1,
              "id": "60936b987d5a2f0008e8bea7"
            }
          ],
          "shipmentStatus": "ORDER_SHIPPED",
          "id": "60936b987d5a2f0008e8bea6"
        }
      ],
      "revision": 2,
      "totalQuantity": 2,
      "statusDescriptions": [
        "<any>"
      ],
      "events": [
        "<any>"
      ],
      "createdAt": "2021-04-30T23:15:37.094Z",
      "updatedAt": "2021-05-06T04:09:09.970Z",
      "__v": 0
    }
  ]
}

Headers

x-api-key
string
Example:

"0LybWR49k95cCwYh3cu0waCYoh4H2Eux2J52wn4k"

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\"}"

Body

application/json

Response

200
application/json

Returned orders

The response is of type object.