LogoLogo
API DocsTemplate GalleryProduct UpdatesContact Us
  • 📬Print & Mail
    • Ready to get started?
      • Pricing details
      • Fast Track Guide
    • Integrations
      • API integrations
        • Action IQ
        • Adobe Marketo Engage
        • Blueshift
        • Braze
        • Customer.io
        • Hubspot
        • Iterable
        • Jotform
        • Klayvio
        • Listrak
        • Make
        • Optimove
        • Salesforce
        • Salesforce Marketing Cloud
        • Segment
        • Simon Data
        • Zapier
      • No-code integrations
        • Agile CRM
        • Freshsales Suite
        • HubSpot
        • Microsoft Dynamics 365
        • Pipedrive
        • Salesforce
        • Salesforce Marketing Cloud
        • Zoho
      • Creative conversion tools
        • Figma plugin
    • Reaching your audience
      • Lob Audience
        • Target Audiences
        • Lookalike Audiences
        • Purchasing Audiences
      • All about addresses
      • Campaign audience guide
      • Additional Lob NCOA functionality
    • Designing mail creatives
      • Artboard layout
      • Creative formatting
        • PDF preflight checklist
        • Exporting PDFs from InDesign
        • Rendering errors
      • Mail piece design specs
        • Postcards
        • Self-Mailers
        • Letters
        • Letter envelopes
        • Letter add-ons
        • Checks
        • Snap packs
        • Booklets
        • Custom mail
      • Maximizing engagement
        • Dynamic personalization
          • Advanced templating (Handlebars)
            • Dynamic table tutorial
        • Adding QR codes
        • Short URLs
        • Informed Delivery
    • Building a mail strategy
      • One-time campaigns or triggered sends?
      • Choosing a delivery strategy
      • Managing mail settings
        • Using metadata
        • Declaring mail use type
      • USPS Promotions Through Lob
        • Tactile, Sensory & Interactive Promotion
        • Integrated Technology Promotion
        • First Class Mail Advertising Promotion
        • Add-Ons
      • Mailing class and postage
        • Certified Mail or Registered Mail
      • International mail
    • Send mail!
      • Launch your first campaign
      • Send mail via Print & Mail API
      • Send campaigns via the Campaigns API
      • USPS Secure Destruction
    • Getting data & results
      • Tracking your mail
      • Mail analytics
      • Measuring attribution
      • Using webhooks
      • Exporting mail data
  • 🏠Address Verification
    • Ready to start AV?
      • US AV product suite
      • International AV suite
      • AV pricing
    • AV best practices
    • AV integrations & libraries
      • AV Elements
      • Shopify App: Address Cleanser
    • AV FAQs
  • 💻Developer Docs
    • API quickstart guide
    • SDKs & libraries
    • Postman & similar tools
    • Error reference
    • Upgrading API version
    • Technical use case guides
      • Mass deletion setup
      • NCOA responses
      • Override cancellation window
      • Visibility of address changes
      • Ingesting tracking events with webhooks
  • 🔑Account Management
    • Signing into Lob
    • API keys
    • Account settings
      • Account-level data logs
    • User settings
    • Billing
      • Lob Credits
      • Lob Payment Methods
      • Sales Tax FAQ
        • Applicable sales tax by state
          • ​Subscriptions and Services
          • Lob Audience
          • Delivery Location for Operational Mail
          • Customer Billing Address for Operational Mail
          • Delivery Location for Marketing Mail
          • Postage Exemption
          • Professional Services
        • Tax exemption guide
  • 📞Resources
    • Getting support
    • Security & privacy
    • Data retention
    • Sustainability
    • Private labeling Lob
    • Direct mail glossary
Powered by GitBook
On this page
  • Prerequisites
  • How to use Lob’s NCOA functionality
  • Code example
  • Conclusion
  • Further resources

Was this helpful?

Export as PDF
  1. Developer Docs
  2. Technical use case guides

NCOA responses

PreviousMass deletion setupNextOverride cancellation window

Last updated 1 year ago

Was this helpful?

Customers must meet certain requirements to access this additional NCOA functionality. Please review the below and reach out to your Account Manager to see if you are eligible.

Prerequisites

In order to leverage Lob’s NCOA feature, we must have a signed Processing and Acknowledgement Form and the account must meet other volume requirements. If NCOA reporting is not currently enabled for your account, please reach out to your Account Manager or your Customer Success Manager for more information and next steps.

A live API key is also required. In order to get this, refer to step one of .

How to use Lob’s NCOA functionality

Using the NCOA data is simple. When an address is created in the Lob API and a mail piece is created, the recipient and address are used to look up current change of address records.

If there is a currently active COA, then the mail piece created will include the recipient’s new address information and the response from the Lob API will include a representation of the Address record that has a recipient_moved value of true and redacted values for address_line1 and address_line2, but all other values will reflect the COA changes.

Code example

For example, an application is sending a check. Because of the business logic of this application, when the recipient has changed addresses, we want to cancel the check instead of allowing it to be rerouted.

For this, we will assume there is a verified bank account already recorded and the application is aware of the Lob record id for that bank account.

import {
    Configuration,ChecksApi, CheckEditable,CountryExtended, AddressEditable 
} from "@lob/lob-typescript-sdk"; 
  
async function demo() { 
    const config: Configuration = new Configuration({ 
        username: "test_XXXXXXXX", 
    }); 
  
    const checkToCreate = new CheckEditable({ 
        description: "Reimbursement $1", 
        to: new AddressEditable({ 
            name: "HARRY ZHANG", 
            address_line1: "185 BERRY ST", 
            address_line2: "SUITE 6100", 
            address_city: "SAN FRANCISCO", 
            address_state: "CA", 
            address_zip: "94107" 
        }), 
        from: new AddressEditable({ 
            name: "LEORE AVIDAR", 
            address_line1: "210 King Street", 
            address_city: "SAN FRANCISCO", 
            address_state: "CA", 
            address_zip: "94107", 
            address_country: CountryExtended.Us, 
        }), 
        bank_account: "bank_XXXXXXXX", 
        amount: 1, 
    }); 
  
    const checksApi = new ChecksApi(config); 
    try { 
        const newCheck = await checksApi.create(checkToCreate); 
        if (newCheck.to?.recipient_moved) { 
            console.log("Recipient has moved - cancel ") 
            await checksApi.cancel(newCheck.id); 
        } 
    } catch (err) { 
        console.error(err); 
    } 
} 
  
demo().then().catch(); 
import lob
lob.api_key = "test_XXXXXXXX"
 
newCheck = lob.Check.create(
description = 'Reimbursement $1',
   to_address = {
     'name': 'Harry Zhang',
     'address_line1': '185 Berry St',
     'address_line2': '# 6100',
     'address_city': 'San Francisco',
     'address_state': 'CA',
     'address_zip': '94107'
   },
   from_address = {
     'name': 'Leore Avidar',
     'address_line1': '210 King St',
     'address_city': 'San Francisco',
     'address_state': 'CA',
     'address_zip': '94107'
   },
   bank_account = 'bank_XXXXXXXX',
   amount = 1.00,
 )
 
if('recipient_moved' in newCheck.to_address.__dict__):
lob.Check.delete(newCheck.id)
    print("Recipient has moved - cancel")
require 'lob.rb' 
require 'pp'  
 
 @lob = Lob::Client.new(api_key: "test_XXXXXXXX") 
 
newCheck = @lob.checks.create(
description: 'Reimbursement $1',
   to: {
     name: 'Harry Zhang',
     address_line1: '185 Berry St',
     address_line2: '# 6100',
     address_city: 'San Francisco',
     address_state: 'CA',
     address_zip: '94107'
   },
   from: {
     name: 'Leore Avidar',
     address_line1: '210 King St',
     address_city: 'San Francisco',
     address_state: 'CA',
     address_zip: '94107'
   },
   bank_account: 'bank_XXXXXXXX',
   amount: 1.00
 ) 
 
if(newCheck['to']['recipient_moved'])
   @lob.checks.destroy(newCheck.id)
   pp 'Recipient has moved - cancel' 
end
$lob = new \Lob\Lob('test_XXXXXXXX');
 
$newCheck = $lob->checks()->create(array(
    'description' => 'Remimburse $1',
    'to[name]' => 'Harry Zhang',
    'to[address_line1]' => '185 Berry St',
    'to[address_line2]' => '# 6100',
    'to[address_city]' => 'San Francisco',
    'to[address_zip]' => '94107',
    'to[address_state]' => 'CA',
    'from[name]' => 'Leore Avidar',
    'from[address_line1]' => '210 King St',
    'from[address_city]' => 'San Francisco',
    'from[address_zip]' => '94107',
    'from[address_state]' => 'CA',
    'bank_account' => 'bank_XXXXXXXX',
    'amount' => 1.00
 ));
   
$prop = 'recipient_moved';
if (isset($newCheck['to']->$prop)) {
    $lob->checks()->delete($newCheck['id']);
    print_r('Recipient has moved - cancel check');
} else {
    print_r('Check is in the mail');
}
import com.lob.Lob;
import com.lob.model.Address;
import com.lob.model.Check;
import com.lob.net.LobResponse;
public class App 
{
    public static void main( String[] args )
    {
        Lob.init("test_XXXXXXXX");
         try {
LobResponse<Check> response = new Check.RequestBuilder()
                 .setDescription("Remimburse $1")
                 .setAmount("1.00")
                 .setTo(
                         new Address.RequestBuilder()
                                 .setName("Harry Zhang")
                                 .setLine1("185  Berry Street")
                                 .setLine2("Ste 6100")
                                 .setCity("San Francisco")
                                 .setState("CA")
                                 .setZip("94107")
                 )
                 .setFrom(
                         new Address.RequestBuilder()
                                 .setName("Leore Avidar")
                                 .setLine1("210 King St")
                                 .setCity("San Francisco")
                                 .setState("CA")
                                 .setZip("94107")
                 )
                 .setBankAccount("bank_XXXXXXXX")
                 .create();
  
 Check newCheck = response.getResponseBody();
                 if(newCheck.getTo().getRecipientMoved() != null) {
LobResponse<Check> deleteResp = Check.delete(newCheck.getId());
System.out.println("Recipient has moved - cancel check");
                 } else {
System.out.println("Check is in the mail");  
                 }
         } catch (Exception err) {
System.out.println("Error on check creation: " + err);
         }
     }
 }

Conclusion

Lob’s NCOA feature, once enabled for an account, allows a consuming application to more completely manage the behavior of mail pieces when a recipient has moved.

Further resources

💻
Getting Started
All about addresses
Add on: Lob NCOA feature
NCOALink