Override cancellation window

Anytime you place an order it’s good to understand the cancellation policy. By default, new accounts have a 4-hour cancellation window. Within that time frame, you can cancel mailings, free of charge. Once the cancellation time window has passed for a postcard, self-mailer, letter, or check, the mailing is no longer cancelable.

Note

Customers on higher editions can customize their cancellation windows by mail product in their dashboard settings. Upgrade to the appropriate Print & Mail edition if interested in gaining access to this ability.

Can I programmatically override my cancellation window?

Using a custom send date in your Lob request enables you to override your default cancelation window and set a specific date and time for which you want a mail piece to go into production.

Why is this important?

Some clients may want to create a campaign today with Lob, but have it actually mailed in 2 weeks. This provides them the time to QA and make sure everything is in order. Others may need to dictate when certain mail pieces go out after a trigger, e.g., two weeks after a shopper abandons their cart, a postcard is sent telling them that the item is now on sale. Either way, this feature enables customers to dictate when a mail piece goes into production if a static cancellation window is not sufficient for their needs. They can do this for each specific mail piece and can customize as needed. If this is not used in the request, it will use the default cancellation window as it is not required.

How do we (programmatically) solve this problem?

If a custom send date is desired, you will have to send either a date or a timestamp of the desired send date. If you send a simple date (YYYY-MM-DD) it will evaluate to midnight UTC of that date. If you don't need to send a custom send date, simply do not include it in the payload—or pass null—to use your default cancellation window.

In the code sample below, we want mail to go into production on July 1st at 6:00 am PST which is 2:00 pm UTC.

To do this our send date is "2022-07-01T14:00:00"

import {Configuration, Postcard, PostcardsApi, PostcardEditable, CountryExtended } from "@lob/lob-typescript-sdk"
 
 async function demo() {
    const config: Configuration = new Configuration({
        username: "<YOUR_TEST_KEY>"
    })
 
    const postcardData : PostcardEditable = {
        to: {
          name: "Harry Zhang",
          address_line1: "210 King Street",
          address_city: "San Francisco",
          address_state: "CA",
          address_zip: "94107"
        },
        from: {
          name: "Leore Avidar",
          address_line1: "210 King Street",
          address_city: "San Francisco",
          address_state: "CA",
          address_zip: "94107",
          address_country: CountryExtended.Us
        },
        front:   "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/4x6_pc_template.pdf",
        back:   "https://s3-us-west-2.amazonaws.com/public.lob.com/assets/templates/4x6_pc_template.pdf",
        send_date:   "2022-07-01T14:00:00"
    }
 
    try {
        const result : Postcard = await new PostcardsApi(config).create(postcardData)
        return result
    } catch (err: any) {
        console.error(err)
    }
 }
 
 demo().then((result)=> console.log(result)).catch()

If you are using Lob's free Developer edition, setting the send_date is not available

Message you will receive from Lob's API:

"Your account's Print & Mail Edition does not allow you to use the Scheduled Mailings feature. Upgrade here: https://dashboard.lob.com/#/settings/editions"

Last updated