1. Contacts
  2. Delete Contacts

Contacts

Delete Contacts

You can delete contacts in two ways. Officially, you can use the standard REST endpoint and delete a contact with its ID. However, because it's possible to overwrite contacts via CSV, uploading an empty CSV with the overwrite property would effectively delete all contacts.

Delete Contact

DELETE
`/v1/contacts/:contact`

Delete a single contact using its id.

js
        const response = await fetch("https://api.packagex.io/v1/contact/contact_rEMzyCyxJzuBzN4LyurAJV", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
});

      

Delete All Contacts

Example

POST
`/v1/contacts`

Uploading an empty CSV encoded as a base64 data URL would delete all contacts.

js
        const data = {
  csv_url: "data:text/csv;base64,", //empty base64 encoded data URL of a CSV
  overwrite: true,
};

const response = await fetch("https://api.packagex.io/v1/contacts", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(data),
}).then((res) => res.json());