---
description: How to fetch a collection of parcels via API
---

# List all parcels

To [fetch](https://docs.commercelayer.io/core/fetching-resources) a collection of parcels, send a `GET` request to the `/api/parcels` endpoint.

## Request

**GET** https://yourdomain.commercelayer.io/api/parcels

### **Example**

{% tabs %}
{% tab title="Request" %}
The following request fetches a collection of parcels:

```shell
curl -g -X GET \
  'https://yourdomain.commercelayer.io/api/parcels/' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token'
```
{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning a paginated collection of resource objects:

```json
{
  "data": [
    {
      "id": "xYZkjABcde",
      "type": "parcels",
      "links": {
        "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde"
      },
      "attributes": {
        "number": "#1234/S/001/P/001",
        "weight": 1000.0,
        "unit_of_weight": "gr",
        "eel_pfc": "EEL",
        "contents_type": "merchandise",
        "contents_explanation": "",
        "customs_certify": false,
        "customs_signer": "John Doe",
        "non_delivery_option": "return",
        "restriction_type": "none",
        "restriction_comments": "",
        "customs_info_required": false,
        "shipping_label_url": "https://bucket.s3-us-west-2.amazonaws.com/files/postage_label/20180101/123.pdf",
        "shipping_label_file_type": "application/pdf",
        "shipping_label_size": "4x7",
        "shipping_label_resolution": "200",
        "tracking_number": "1Z4V2A000000000000",
        "tracking_status": "delivered",
        "tracking_status_detail": "arrived_at_destination",
        "tracking_status_updated_at": "2018-01-01T12:00:00.000Z",
        "tracking_details": [
          {
            "object": "TrackingDetail",
            "message": "Pre-Shipment information received",
            "status": "pre_transit",
            "datetime": "2018-02-27T16:02:17Z",
            "source": "DHLExpress",
            "tracking_location": {
              "object": "TrackingLocation"
            }
          }
        ],
        "carrier_weight_oz": "42.32",
        "signed_by": "John Smith",
        "incoterm": "EXW",
        "delivery_confirmation": "SIGNATURE",
        "created_at": "2018-01-01T12:00:00.000Z",
        "updated_at": "2018-01-01T12:00:00.000Z",
        "reference": "ANY-EXTERNAL-REFEFERNCE",
        "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
        "metadata": {
          "foo": "bar"
        }
      },
      "relationships": {
        "shipment": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/shipment",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/shipment"
          }
        },
        "package": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/package",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/package"
          }
        },
        "parcel_line_items": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/parcel_line_items",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/parcel_line_items"
          }
        },
        "attachments": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/attachments",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/attachments"
          }
        },
        "events": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/events",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/events"
          }
        },
        "versions": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/relationships/versions",
            "related": "https://yourdomain.commercelayer.io/api/parcels/xYZkjABcde/versions"
          }
        }
      },
      "meta": {
        "mode": "test",
        "organization_id": "xRRkjDFafe",
        "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
      }
    },
    {
      "other": "... 9 parcels (first page)"
    }
  ],
  "meta": {
    "record_count": 140,
    "page_count": 14
  },
  "links": {
    "first": "https://yourdomain.commercelayer.io/api/parcels?page[number]=1&page[size]=10",
    "next": "https://yourdomain.commercelayer.io/api/parcels?page[number]=2&page[size]=10",
    "last": "https://yourdomain.commercelayer.io/api/parcels?page[number]=14&page[size]=10"
  }
}
```
{% endtab %}
{% endtabs %}

Remember that when you fetch a list of resources you get [paginated](https://docs.commercelayer.io/core/pagination) result.

### Sortable fields

The list of parcels can be [sorted](https://docs.commercelayer.io/core/sorting-results) by the following fields:

#### Attributes

* `weight`
* `tracking_status`
* `tracking_status_updated_at`
* `carrier_weight_oz`
* `id`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`

#### Relationships

* `shipment`
* `package`

### Filterable fields

The list of parcels can be [filtered](https://docs.commercelayer.io/core/filtering-data) by the following fields:

#### Attributes

* `weight`
* `contents_explanation`
* `shipping_label_url`
* `shipping_label_file_type`
* `shipping_label_size`
* `shipping_label_resolution`
* `tracking_number`
* `tracking_status`
* `tracking_status_detail`
* `tracking_status_updated_at`
* `carrier_weight_oz`
* `incoterm`
* `delivery_confirmation`
* `id`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`
* `metadata`

#### Relationships

* `shipment`
* `package`
* `parcel_line_items`
* `attachments`
* `events`
