# List and search your address book

> Find saved addresses in the address book of your ParcelParcel account.

`GET https://services.parcelparcel.com/partners-api/v1/address-book`

This endpoint lists the addresses in the address book of your account. These are the same addresses you see under **Address book** in MyParcelParcel. You can search them, for example by company name or city.

You only see the addresses of your own account.

Use the `id` of an address to [get one address](https://www.parcelparcel.com/api-docs/get-address/), to [update it](https://www.parcelparcel.com/api-docs/update-address/), or as `addressBookId` when you [create a shipment](https://www.parcelparcel.com/api-docs/create-shipment/#address-type).

## Header

Add the following headers:

| Name         | Value                          |
| :----------- | :----------------------------- |
| Content-Type | application/json               |
| X-PP-API     | `{YourAPIKey}@{YourAPISecret}` |

Don't have an API Key and API Secret yet? Check our [Authentication](https://www.parcelparcel.com/api-docs/authentication/) page to see how to get them in under a minute.

## Body

This endpoint does not need a request body. All filters are query parameters.

For example:

```text Search
https://services.parcelparcel.com/partners-api/v1/address-book?search=acme
```
```text Search in one country
https://services.parcelparcel.com/partners-api/v1/address-book?search=acme&country=US&page=1&perPage=50
```

## Query Parameters

All query parameters are optional and can be combined.

| Name    | Type    | Description                                                                                                                       |
| :------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------- |
| search  | string  | Searches the company name, contact person, address line 1, zipcode, city and country name.                                        |
| country | string  | Only addresses in this country. Use ISO 3166-1 alpha-2 codes (e.g. `NL`, `DE`, `US`). An unknown country code gives an empty list. |
| page    | integer | Page number. Defaults to `1`.                                                                                                     |
| perPage | integer | Number of addresses per page. Defaults to `25`, maximum `100`.                                                                    |

## Response

The response body is a JSON object with the following elements:

| Name                 | Value             | Comments                                                                     |
| :------------------- | :---------------- | :--------------------------------------------------------------------------- |
| data                 | (array)           | The addresses on this page. An empty array if nothing matches.               |
| data.id              | (int)             | The id of the address. Use it as `addressBookId` in a shipment.              |
| data.company         | (string \| null)  | Company name.                                                                |
| data.contactPerson   | (string \| null)  | Full name of the contact person.                                             |
| data.phone           | (string \| null)  | Phone number.                                                                |
| data.email           | (string \| null)  | Email address.                                                               |
| data.addressLine1    | (string)          | First line of the street address.                                            |
| data.addressLine2    | (string \| null)  | Second line of the street address.                                           |
| data.zipcode         | (string \| null)  | Postal code.                                                                 |
| data.city            | (string)          | City.                                                                        |
| data.stateOrProvince | (string \| null)  | State or province code, for example `TX`.                                    |
| data.country         | (string)          | ISO 3166-1 alpha-2 country code, for example `NL`.                           |
| data.vatNumber       | (string \| null)  | VAT number.                                                                  |
| data.eoriNumber      | (string \| null)  | EORI number (used for customs clearance).                                    |
| data.defaultPickup   | (bool)            | `true` if this is the default pickup address of your account.                |
| meta.total           | (int)             | Total number of addresses that match your filters.                           |
| meta.page            | (int)             | The current page number.                                                     |
| meta.perPage         | (int)             | The number of addresses per page.                                            |

The address fields have the same names as the addresses in [List your shipments](https://www.parcelparcel.com/api-docs/list-shipments/#address-fields).

### Status codes

| Status code | Meaning                                                                    |
| :---------- | :------------------------------------------------------------------------- |
| 200 OK      | The search worked. `data` is an empty array if no address matches. |

## Examples

Don't know how to test these requests? Check [our guide](https://www.parcelparcel.com/api-docs/postman-guide/).

### Request example - Search the address book

```bash cURL
curl --location --request GET 'https://services.parcelparcel.com/partners-api/v1/address-book?search=acme&country=US' \
--header 'X-PP-API: {YourAPIKey}@{YourAPISecret}' \
--header 'Content-Type: application/json'
```
```http HTTP
GET /partners-api/v1/address-book?search=acme&country=US HTTP/1.1
Host: services.parcelparcel.com
X-PP-API: {YourAPIKey}@{YourAPISecret}
Content-Type: application/json
```

Don't forget to change the **X-PP-API** element in the header, or this request will not work. Leave out the query parameters to list all your addresses.

### Response example - Addresses found (200)

```json
{
  "data": [
    {
      "id": 456,
      "company": "Acme Inc.",
      "contactPerson": "Jane Smith",
      "phone": "+12125550100",
      "email": "jane@acme.com",
      "addressLine1": "350 5th Ave",
      "addressLine2": null,
      "zipcode": "10118",
      "city": "New York",
      "stateOrProvince": "NY",
      "country": "US",
      "vatNumber": null,
      "eoriNumber": null,
      "defaultPickup": false
    }
  ],
  "meta": {
    "total": 1,
    "page": 1,
    "perPage": 25
  }
}
```

### Response example - Nothing found (200)

```json
{
  "data": [],
  "meta": {
    "total": 0,
    "page": 1,
    "perPage": 25
  }
}
```
