Contact addresses

You can retrieve, create, update, and delete contact addresses through Cloud API.

The endpoints described in this topic can be used when working with contacts that are not account, policy, or job contacts. To work with those types of contacts, you must work with endpoints described in Account contact addresses and Policy contact addresses.

Retrieve contact addresses

Use the following endpoints to retrieve a contact’s addresses:
  • GET /contacts/{contactId}/addresses
  • GET /contacts/{contactId}/addresses/{addressId}

For example, the following retrieves all addresses on a contact:

Command
GET /common/v1/contacts/pc:467/addresses
Response
{
    "count": 1,
    "data": [
        {
            "attributes": {
                "addressLine1": "193 Oak Way",
                "addressType": {
                    "code": "billing",
                    "name": "Billing"
                },
                "city": "San Mateo",
                "country": "US",
                "displayName": "193 Oak Way, San Mateo, CA 94403",
                "id": "pc:SKij3GqoHnes8Mkg_S4Ba",
                "postalCode": "94403",
                "primary": true,
                "state": {
                    "code": "CA",
                    "name": "California"
                }
            },
            ...
        }
    ],
    ...
}

Create a contact address

Create a new address on a contact using the following endpoint:
  • POST /common/v1/contacts/{contactId}/addresses

When you create an address on a contact, unless otherwise specified, it is added as a secondary address.

The following fields are required:
  • addressLine1 - The first line of the address, as a string
  • city - The name of the city, as a string
  • state - The state, as a typekey reference to the State typelist
  • postalCode - The postal code, as a string

The following is a minimal example:

Command
POST /common/v1/contacts/pc:532/addresses
Request body
{
  "data": {
    "attributes": {
      "addressLine1": "456 Hillsdale Blvd",
      "city": "Albany",
      "postalCode": "22222",
      "state": {
        "code": "CA"
      }
    }
  }
}

For organization contacts, if you want the address to be the primary address, set the primary field to true. When this field is set to true, the existing primary address automatically becomes a secondary address.

Update a contact address

You can update an address on a contact.

Do this using the following endpoint:
  • PATCH /common/v1/contacts/{contactId}/addresses/{addressId}

For example, the following updates a contact address to add addressLine2 and addressLine3 properties.

Command
PATCH /common/v1/contacts/pc:532/addresses/pc:873
Request body
{
  "data": {
    "attributes": {
      "addressLine2": "Building 4",
      "addressLine3": "Suite 200"
    }
  }
}

Delete a contact address

Use the following endpoint to delete a contact address:
  • DELETE /contacts/{contactId}/addresses/{addressId}

You cannot delete the primary address for a contact.

For example, the following command deletes a contact address. No request body is required.

Command

DELETE /common/v1/contacts/pc:532/addresses/pc:873