1. Contacts
  2. Create & Update Contacts

Contacts

Create & Update Contacts

Create Contact(s)

POST
`/v1/contacts`

This API will allow you to create a single contact using a traditional REST approach.

Create Single Contact

The only required property for a contact is the name, but we recommend adding some more information like the email or phone.

js
        const data = {
  name: "Jamie Jones",
};

fetch(`https://api.packagex.io/v1/contacts`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
});

      

Update Contact

POST
`/v1/contacts/:contact`

To update a contact, you'll need to pass the contact's ID along with any properties that you want to manage.

Update Contact

The address field can also include the address ID or location ID and we'll parse it successfully.

js
        const data = {
  name: "Jamie Jones",
  email: "jamie@packagex.xyz",
  phone: "+11234567890",
  address: "500 7th Ave, New York, NY 10018",
  address_line2: "Floor 14",
  metadata: {
    prop: "Whatever I want",
  },
  notes: "Will be out of town until Friday",
};

fetch(`https://api.packagex.io/v1/contacts/${contact.id}`, {
  method: "POST",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
});