ParcelParcelAPI docs

API docs Endpoints

Save an address

Markdown

Add a new address to the address book of your ParcelParcel account.

POSThttps://services.parcelparcel.com/partners-api/v1/address-book

Example request

Save a recipient in the United States

curl --request POST 'https://services.parcelparcel.com/partners-api/v1/address-book' \
  --header 'X-PP-API: {YourAPIKey}@{YourAPISecret}' \
  --header 'Content-Type: application/json' \
  --data '{
  "countryCode": "US",
  "companyName": "Acme Inc.",
  "contactPerson": "Jane Smith",
  "phone": "+12125550100",
  "email": "[email protected]",
  "addressLine1": "350 5th Ave",
  "zipcode": "10118",
  "city": "New York",
  "provinceCode": "NY"
}'

Tip: copy the cURL and paste it in Postman under Import, or straight into the URL bar of a new request. Postman fills in the method, headers and body for you. Replace {YourAPIKey}@{YourAPISecret} with your own API key and secret (use your sandbox key while testing), or import the whole Postman Collection.

This endpoint saves a new address in the address book of your account. The address shows up under Address book in MyParcelParcel, and you can use its id as addressBookId when you create a shipment.

The body uses the same keys as an address in Create a (draft) shipment, so you can save an address exactly as you send it in a shipment.

Add the following headers:

NameValue
Content-Typeapplication/json
X-PP-API{YourAPIKey}@{YourAPISecret}

Don't have an API Key and API Secret yet? Check our Authentication page to see how to get them in under a minute.

Body

The request body is a JSON object with the following elements. Every text field can have at most 255 characters.

NameValueRequiredComments
countryCode(string)requiredISO 3166-1 alpha-2 country code, for example NL or US.
companyName(string)optional
contactPerson(string)requiredFull name of the contact person.
phone(string)required
email(string)optional
addressLine1(string)required
addressLine2(string)optional
zipcode(string)optional
city(string)required
provinceCode(string)optionalState or province code, for example TX for Texas.
vatNumber(string)optional
eoriNumber(string)optionalA 2-letter country code followed by 1 to 15 letters or digits, for example NL123456789.

Saving an address with fewer fields is fine. A shipment still needs all its own required fields, such as email and zipcode. If the saved address does not have them, add them to the address in the shipment.

Response

The response body is the saved address. It has the same elements as Get an address, including the new id.

Note that the response uses the output names: company, stateOrProvince and country (instead of companyName, provinceCode and countryCode). These are the same names as in List your shipments.

If the request is not valid, the response has an errors array with one entry per wrong field:

NameValueComments
errors(array)One entry per wrong field.
errors.field(string)The name of the field in your body.
errors.message(string)What is wrong with the field.

Status codes

Status codeMeaning
201 CreatedThe address is saved. The response is the new address.
400 Bad RequestThe address is not saved. A required field is missing or empty, a field is too long, or a value is not valid. See errors.

Examples

Don't know how to test these requests? Check our guide.

Request example - Save a recipient in the United States

curl --location --request POST 'https://services.parcelparcel.com/partners-api/v1/address-book' \
--header 'X-PP-API: {YourAPIKey}@{YourAPISecret}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "countryCode": "US",
  "companyName": "Acme Inc.",
  "contactPerson": "Jane Smith",
  "phone": "+12125550100",
  "email": "[email protected]",
  "addressLine1": "350 5th Ave",
  "zipcode": "10118",
  "city": "New York",
  "provinceCode": "NY"
}'

Don't forget to change the X-PP-API element in the header, or this request will not work.

Response example - Address saved (201)

JSON
{
  "id": 456,
  "company": "Acme Inc.",
  "contactPerson": "Jane Smith",
  "phone": "+12125550100",
  "email": "[email protected]",
  "addressLine1": "350 5th Ave",
  "addressLine2": null,
  "zipcode": "10118",
  "city": "New York",
  "stateOrProvince": "NY",
  "country": "US",
  "vatNumber": null,
  "eoriNumber": null,
  "defaultPickup": false
}

Response example - Address not valid (400)

JSON
{
  "errors": [
    {
      "field": "contactPerson",
      "message": "contactPerson is required."
    },
    {
      "field": "countryCode",
      "message": "countryCode must be a known 2-letter ISO country code."
    }
  ]
}