# List all addresses

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

## Request

**GET** <https://yourdomain.commercelayer.io/api/addresses>

### **Example**

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

```shell
curl -g -X GET \
  'https://yourdomain.commercelayer.io/api/addresses/' \
  -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": "XAyRWNUzyN",
      "type": "addresses",
      "links": {
        "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN"
      },
      "attributes": {
        "business": false,
        "first_name": "John",
        "last_name": "Smith",
        "company": "The Red Brand Inc.",
        "full_name": "John Smith",
        "line_1": "2883 Geraldine Lane",
        "line_2": "Apt.23",
        "city": "New York",
        "zip_code": "10013",
        "state_code": "NY",
        "country_code": "US",
        "phone": "(212) 646-338-1228",
        "full_address": "2883 Geraldine Lane Apt.23, 10013 New York NY (US) (212) 646-338-1228",
        "name": "John Smith, 2883 Geraldine Lane Apt.23, 10013 New York NY (US) (212) 646-338-1228",
        "email": "john@example.com",
        "notes": "Please ring the bell twice",
        "lat": 40.6971494,
        "lng": -74.2598672,
        "is_localized": true,
        "is_geocoded": true,
        "provider_name": "google",
        "map_url": "https://www.google.com/maps/search/?api=1&query=40.6971494,-74.2598672",
        "static_map_url": "https://maps.googleapis.com/maps/api/staticmap?center=40.6971494,-74.2598672&size=640x320&zoom=15",
        "billing_info": "VAT ID IT02382940977",
        "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": {
        "geocoder": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/relationships/geocoder",
            "related": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/geocoder"
          }
        },
        "events": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/relationships/events",
            "related": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/events"
          }
        },
        "tags": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/relationships/tags",
            "related": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/tags"
          }
        },
        "versions": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/relationships/versions",
            "related": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/versions"
          }
        },
        "event_stores": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/relationships/event_stores",
            "related": "https://yourdomain.commercelayer.io/api/addresses/XAyRWNUzyN/event_stores"
          }
        }
      },
      "meta": {
        "mode": "test",
        "organization_id": "xRRkjDFafe",
        "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
      }
    },
    {
      "other": "... 9 addresses (first page)"
    }
  ],
  "meta": {
    "record_count": 140,
    "page_count": 14
  },
  "links": {
    "first": "https://yourdomain.commercelayer.io/api/addresses?page[number]=1&page[size]=10",
    "next": "https://yourdomain.commercelayer.io/api/addresses?page[number]=2&page[size]=10",
    "last": "https://yourdomain.commercelayer.io/api/addresses?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 addresses can be [sorted](https://docs.commercelayer.io/core/sorting-results) by the following fields:

#### Attributes

* `city`
* `state_code`
* `country_code`
* `id`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`

### Filterable fields

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

#### Attributes

* `business`
* `first_name`
* `last_name`
* `company`
* `line_1`
* `line_2`
* `city`
* `zip_code`
* `state_code`
* `country_code`
* `phone`
* `email`
* `notes`
* `lat`
* `lng`
* `billing_info`
* `id`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`
* `metadata`

#### Relationships

* `events`
* `tags`
