Mass deletion setup
Last updated
Was this helpful?
Last updated
Was this helpful?
If the has already elapsed, canceling is not possible.
If not elapsed, you will need to provide a list of the resource IDs you would like to have canceled.
Submitting deletion requests via Support is not a suitable replacement for making deletion requests on your own.
Having a mass delete system in place is essential to avoid unnecessary costs, save time, and protect customer relationships when a campaign is mistakenly triggered. This feature allows you to cancel large amounts of mail associated with a specific campaign, identified by a batch ID, without disrupting other outgoing mail.
In this tutorial, we’ll show you how to property or manage mail campaign information for efficient mass deletion. This helps you quickly stop unintended campaigns before they go to print, preventing early or incorrect mail from reaching customers.
A large number of mail pieces needing to be canceled quickly
The mail pieces have not been sent to printers
In order to delete all postcards from the NEWYORK2022 campaign, use the list function and pass a metadata object with a batch_id
key set to NEWYORK2022. This returns a list of all NEWYORK2022 campaign postcards, loop over each one and pass the postcard id into the cancel function.
If you plan to save details about individual mail pieces in your database, consider including an identifier for the campaign as well. In the example below, we create a new postcard and upon successful completion, we store details in our database.
Create a config using your LOB_API_KEY
found in the lob dashboard.
For extra resiliency, you can pass in the batch id via metadata (see above example), as well as store it locally as seen below.
To mass delete, we fetch a list of mail pieces from our database using a unique id for our campaign and loop over all the mail pieces to cancel them.
Fetch the list ids from your database using your unique group id
The recommended approach for identifying batches of mail sent through Lob is to use the with a unique key-value pair. Below is an example of how to create a single mail piece that includes metadata with a batch_id
set to “NEWYORK2022”. The batch_id
can be anything you want as long as it is unique to the batch, is a maximum length of 500 characters and is used for all mail pieces in the batch.
Create a config using your LOB_API_KEY
found in the . Find more on idempotency keys .
To see the full list of acceptable parameters in the list, visit the .