# Order

![](https://2604198532-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ljb6kldSmEV1tpebdRd%2F-LruC2aTm-ZMy8Rc17ip%2F-LruCWuJfbnVY5ZGE_FD%2FResource%20Map%20-%20Order.png?alt=media\&token=5768aed8-1e8c-463a-bb3c-6bda5abde0d3)

### Order Properties

| Field          | Description                                                                                                                                                      |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `alternate_id` | Custom unique identifier that can be used to lookup an order. This typically is the primary key of the order located in a system outside of the Malomo Platform. |
| `created_at`   | When an `Order` was created on the Malomo Platform.                                                                                                              |
| `customer`     | `Customer` an `Order` belongs to.                                                                                                                                |
| `email`        | Email address that should be used for communication about an order. This email address may be different from the `Customer` email address.                       |
| `id`           | Unique identifier for an `Order`.                                                                                                                                |
| `meta`         | Additional, arbitrary information attached to an `Order`. These can be useful for storing additional information about an order in a structured format.          |
| `number`       | A number identifying an order placed by a customer.                                                                                                              |
| `shipments`    | Shipments associated with an `Order`.                                                                                                                            |
| `updated_at`   | When an `Order` was last updated.                                                                                                                                |

## Create an Order

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

#### Request Body

| Name          | Type   | Description                                                                        |
| ------------- | ------ | ---------------------------------------------------------------------------------- |
| alternate\_id | string | Custom unique identifier that can be used to lookup an `Order`.                    |
| customer      | object | `Customer` object used to assign a `Customer` to an `Order`.                       |
| email         | string | Email address to be used for communication with a customer about a specific order. |
| meta          | object | Additional, arbitrary information attached to an `Order`.                          |
| number        | string | A number identifying an order placed by a customer.                                |
| shipments     | array  | An array of `Shipment` objects containing both a `carrier` and `tracking_code`.    |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve an Order

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders/:id`

#### Path Parameters

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| id   | string | Unique identifier of the desired order |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve an Order by Alternate Id

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders/?alternate_id=:alternate_id`

#### Query Parameters

| Name          | Type   | Description                                                      |
| ------------- | ------ | ---------------------------------------------------------------- |
| alternate\_id | string | Custom, unique identifier that can be used to lookup an `Order`. |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve an Order by Tracking Code

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders/?tracking_code=:tracking_code`

#### Query Parameters

| Name           | Type   | Description                                          |
| -------------- | ------ | ---------------------------------------------------- |
| tracking\_code | string | Code provided by the carrier to tracking a shipment. |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve an Order by Order Number and Customer Email Address

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders/?number=:number&customer_email=:customer_email`

#### Query Parameters

| Name            | Type   | Description                                                              |
| --------------- | ------ | ------------------------------------------------------------------------ |
| number          | string | Number of the `Order` to retrieve.                                       |
| customer\_email | string | Email address of the `Customer` associated with the `Order` to retrieve. |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve a List of Orders

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders`

#### Query Parameters

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| prev | string | Retrieve orders before a given cursor. |
| next | string | Retrieve orders after a given cursor.  |

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

```javascript
[
  {
    "alternate_id": "450789469",
    "created_at": "2019-01-30T13:30:00Z",
    "customer": {
      "email": "john@example.com",
      "first_name": "John",
      "last_name": "Smith"
    },
    "email": "john@example.com",
    "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
    "meta": {
      "shopify_order": {
        "order_id": 450789469
      }
    }
    "number": "1000",
    "shipments": [
      {
        "alternative_carrier_identifier": null,
        "carrier": "usps",
        "carrier_name": "USPS",
        "carrier_service": "First-Class Package Service",
        "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
        "container_type": null,
        "delivered_at": "2019-01-30T13:30:00",
        "destination": {
          "city": "INDIANAPOLIS",
          "country": null,
          "postal_code": "46203",
          "state": "IN"
        },
        "estimated_delivered_at": "2019-01-30T13:30:00",
        "estimated_local_delivered_at": null,
        "estimated_local_delivered_on": null,
        "guaranteed_delivered_at": null,
        "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
        "initial_delivery_attempted_at": "2019-01-30T13:30:00",
        "is_return": false,
        "origin": {
          "city": "INDIANAPOLIS",
          "country": null,
          "postal_code": "46203",
          "state": "IN"
        },
        "original_estimated_delivered_at": "2019-01-30T13:30:00",
        "scan_events": [
          {
            "carrier_code": "GX",
            "description": "Shipping Label Created, USPS Awaiting Item",
            "location": {
              "city": "INDIANAPOLIS",
              "country": null,
              "postal_code": "46203",
              "state": "IN",
            },
            "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
            "scanned_at": "2019-01-28T13:23:00",
            "source": "USPS",
            "status": "pre_transit",
            "status_detail": "label_created"
          },
          {
            "carrier_code": "OA",
            "description": "Accepted at USPS Origin Facility",
            "location": {
              "city": "INDIANAPOLIS",
              "country": null,
              "postal_code": "46203",
              "state": "IN"
            },
            "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
            "scanned_at": "2019-01-28T20:29:00",
            "source": "USPS",
            "status": "in_transit",
            "status_detail": "received_at_origin_facility"
          },
          {
            "carrier_code": "OF",
            "description": "Out for Delivery",
            "location": {
              "city": "INDIANAPOLIS",
              "country": null,
              "postal_code": "46203",
              "state": "IN"
            },
            "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
            "scanned_at": "2019-01-30T09:16:00",
            "source": "USPS",
            "status": "out_for_delivery",
            "status_detail": "out_for_delivery"
          },
          {
            "carrier_code": "01",
            "description": "Delivered, In/At Mailbox",
            "location": {
              "city": "INDIANAPOLIS",
              "country": null,
              "postal_code": "46203",
              "state": "IN"
            },
            "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
            "scanned_at": "2019-01-30T13:30:00",
            "source": "USPS",
            "status": "delivered",
            "status_detail": "arrived_at_destination"
          }
        ],
        "signed_by": "null",
        "status": "delivered",
        "tracking_code": "9400000000000000000000",
        "weight": null
      }
    ],
    "updated_at": "2019-01-30T13:30:00Z"
  }
]
```

{% endtab %}
{% endtabs %}

## Update an Order

<mark style="color:orange;">`PUT`</mark> `https://api.gomalomo.com/orders/:id`

#### Path Parameters

| Name | Type   | Description                              |
| ---- | ------ | ---------------------------------------- |
| id   | string | Unique identifier of the order to update |

#### Request Body

| Name      | Type   | Description                                                                                                                                                                                                                                                                                                        |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| customer  | object | `Customer` object used to assign a `Customer` to an `Order`. If a value of `null` is provided the customer will be removed from the order.                                                                                                                                                                         |
| email     | string | Email address to be used for communication with a customer about a specific order.                                                                                                                                                                                                                                 |
| meta      | object | Additional, arbitrary information attached to an `Order`.                                                                                                                                                                                                                                                          |
| shipments | array  | An array of objects containing both a `carrier` and `tracking_code`. Note that this must be a complete list of `carrier` and `tracking_code` combinations for an `Order`. If a `carrier` and `tracking_code` that currently exist on an `Order` are not supplied that `Shipment` will be removed from the `Order`. |

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

```javascript
{
  "alternate_id": "450789469",
  "created_at": "2019-01-30T13:30:00Z",
  "customer": {
    "email": "john@example.com",
    "first_name": "John",
    "last_name": "Smith"
  },
  "email": "john@example.com",
  "id": "58f3d13f-2979-462b-92f8-4b85c6ee6abe",
  "meta": {
    "shopify_order": {
      "order_id": 450789469
    }
  }
  "number": "1000",
  "shipments": [
    {
      "alternative_carrier_identifier": null,
      "carrier": "usps",
      "carrier_name": "USPS",
      "carrier_service": "First-Class Package Service",
      "carrier_url": "https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=9400000000000000000000"
      "container_type": null,
      "delivered_at": "2019-01-30T13:30:00",
      "destination": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "estimated_delivered_at": "2019-01-30T13:30:00",
      "estimated_local_delivered_at": null,
      "estimated_local_delivered_on": null,
      "guaranteed_delivered_at": null,
      "id": "ef1e8884-5188-457a-950a-6247c5e59e91",
      "initial_delivery_attempted_at": "2019-01-30T13:30:00",
      "is_return": false,
      "origin": {
        "city": "INDIANAPOLIS",
        "country": null,
        "postal_code": "46203",
        "state": "IN"
      },
      "original_estimated_delivered_at": "2019-01-30T13:30:00",
      "scan_events": [
        {
          "carrier_code": "GX",
          "description": "Shipping Label Created, USPS Awaiting Item",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN",
          },
          "message": "January 28 1:23 pm Shipping Label Created, USPS Awaiting Item in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T13:23:00",
          "source": "USPS",
          "status": "pre_transit",
          "status_detail": "label_created"
        },
        {
          "carrier_code": "OA",
          "description": "Accepted at USPS Origin Facility",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 28 8:29 pm Accepted at USPS Origin Facility in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-28T20:29:00",
          "source": "USPS",
          "status": "in_transit",
          "status_detail": "received_at_origin_facility"
        },
        {
          "carrier_code": "OF",
          "description": "Out for Delivery",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 9:16 am Out for Delivery in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T09:16:00",
          "source": "USPS",
          "status": "out_for_delivery",
          "status_detail": "out_for_delivery"
        },
        {
          "carrier_code": "01",
          "description": "Delivered, In/At Mailbox",
          "location": {
            "city": "INDIANAPOLIS",
            "country": null,
            "postal_code": "46203",
            "state": "IN"
          },
          "message": "January 30 1:30 pm Delivered, In/At Mailbox in INDIANAPOLIS, IN",
          "scanned_at": "2019-01-30T13:30:00",
          "source": "USPS",
          "status": "delivered",
          "status_detail": "arrived_at_destination"
        }
      ],
      "signed_by": "null",
      "status": "delivered",
      "tracking_code": "9400000000000000000000",
      "weight": null
    }
  ],
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Delete an Order

<mark style="color:red;">`DELETE`</mark> `https://api.gomalomo.com/orders/:id`

#### Path Parameters

| Name | Type   | Description                           |
| ---- | ------ | ------------------------------------- |
| id   | string | Unique identifier of the order delete |

{% tabs %}
{% tab title="204 " %}

{% endtab %}
{% endtabs %}

## Create an Event for an Order

<mark style="color:green;">`POST`</mark> `https://api.gomalomo.com/orders/:order_id/events`

#### Path Parameters

| Name      | Type   | Description                                        |
| --------- | ------ | -------------------------------------------------- |
| order\_id | string | Unique id of the `Order` to create an `Event` for. |

#### Request Body

| Name            | Type    | Description                                                                                                           |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
| label           | string  | Human-friendly text describing the event.                                                                             |
| link\_back\_url | string  | URL pointing to a 3rd party resources that may be relevant to an event.                                               |
| properties      | object  | Arbitrary data relevant to the event.                                                                                 |
| timestamp       | integer | A unix timestamp of when the event occurred. If not provided the timestamp will default to the current date and time. |
| type            | string  | Type of event. This value should be consistent for the same types of event.                                           |

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

```javascript
{
  "created_at": "2019-01-30T13:30:00Z",
  "id": "1a3c1090-efd1-11eb-9a03-0242ac130003",
  "label": "Order #1000 fulfilled",
  "link_back_url": "https://goodest-boi.myshopify.com/admin/orders/5555555555555",
  "properties": {
    "shopify_order": {
      "id": "5555555555555"
    }
  },
  "timestamp": 1548855000
  "type": "ShopifyOrderFulfilled",
  "updated_at": "2019-01-30T13:30:00Z",
}
```

{% endtab %}
{% endtabs %}

## Retrieve a List of Order Events

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/orders/:order_id/events`

#### Path Parameters

| Name      | Type   | Description                                      |
| --------- | ------ | ------------------------------------------------ |
| order\_id | string | Unique id of the `Order` to retrieve events for. |

#### Query Parameters

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| prev | string | Retrieve events before a given cursor. |
| next | string | Retrieve events after a given cursor.  |

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

```javascript
[
  {
    "created_at": "2019-01-30T13:30:00Z",
    "id": "1a3c1090-efd1-11eb-9a03-0242ac130003",
    "label": "Order #1000 fulfilled",
    "link_back_url": "https://goodest-boi.myshopify.com/admin/orders/5555555555555",
    "properties": {
      "shopify_order": {
        "id": "5555555555555"
      }
    },
    "timestamp": 1548855000
    "type": "ShopifyOrderFulfilled",
    "updated_at": "2019-01-30T13:30:00Z",
  }
]
```

{% endtab %}
{% endtabs %}
