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
  • Billing
  • If you have less than 10 cost centers
  • If you have over 10 cost centers
  • Try before you buy
  • Use the test environment
  • Preview mailpieces
  • Give insight into the delivery process

Was this helpful?

Export as PDF
  1. Resources

Private labeling Lob

Best practices on building atop of Lob's APIs

PreviousSustainabilityNextDirect mail glossary

Last updated 1 year ago

Was this helpful?

If you are a company that is building and selling software solutions, you may want to consider leveraging Lob’s direct mail or address verification capabilities to unlock additional value, which can be repackaged and resold as part of your broader offering to your own customers.

In such cases, while there are many ways to integrate with our platform as a backend, the following are some best practices we highly recommend you follow.

Interested in private labeling Lob? Reach out to

Billing

Your standard Lob invoice will be a single invoice, broken out into two categories: Subscription (annual) and Usage (monthly). Our resellers often have a need to further segment their usage by different cost centers within their broader organization, in a way that's more reflective of their business operations (e.g. by use case, teams, states, or customer groups). There are two ways to achieve this:

If you have less than 10 cost centers

If you are an Enterprise customer, you may request to to differentiate your monthly usage between various cost centers. Engage your CSM to receive separate invoices.

If you have over 10 cost centers

Another way to segment usage is to attribute your campaign mailings to the responsible cost centers within your organization, so you may accurately keep track during end-of-month reconciliation processes. We recommend using along with page count where applicable.

  • Postcards/self-mailers: When submitting a request to create the mailpiece, include a metadata tag with a key for identifying your billing recipient (e.g., customer_id or institution_id), and insert a value accordingly. This way, you can filter for all the mailings sent by that particular customer or institution later and bill accordingly.

  • Letters/checks: Since the number of pages sent in a campaign may vary and therefore the cost, you will need a way to calculate the final price. Below is a sample (Python) script for how to pull a list of letters by metadata, and parse out the number of pages each.

'''
USAGE: python3 pdf_page_count.py

This file will go and fetch mail from the LIST endpoints and basically fetch the letters, load 
them into memory and count the # of pages, Spitting out a CSV with the summary.
'''

from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import resolve1
from io import BytesIO
import pandas as pd
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
import multiprocessing
from functools import partial
import numpy as np
import requests
import json
import sys

def retry_session(retries, session=None, backoff_factor=1):
    session = session or requests.Session()
    retry = Retry(
        total=retries,
        read=retries,
        connect=retries,
        backoff_factor=backoff_factor,
        status_forcelist=[500, 502, 503, 504, 429],
        allowed_methods=['GET']
    )
    adapter = HTTPAdapter(max_retries=retry)
    session.mount('http://', adapter)
    session.mount('https://', adapter)
    return session

def parse_pdf(item_list):
    result_csv = pd.DataFrame(columns=['id','page_count','double_sided'])
    session = retry_session(retries=5)
    for item in item_list:
        id = item['id']
        print(id)
        r = session.get(f"{item['url']}")
        if r.status_code in (200,204,202):  
            f = BytesIO(r.content)
            f = PDFParser(f)
            document = PDFDocument(f)
            # This will give you the count of pages
            result_csv = result_csv.append({'id' : id, 'page_count' : resolve1(document.catalog['Pages'])['Count'], 'double_sided' : item['double_sided']}, ignore_index=True)

    return result_csv

def parse_data(api_key):
    url = f"https://api.lob.com/v1/letters"
    creative_url = url
    #TODO: add in any filtering you see fit (metadata, extra services, etc)
    params = {'send_date[gte]' : '2021-10-01', 'send_date[lte]' : '2021-10-12' }
    params['limit'] = '100'

    session = retry_session(retries=5)
    r = session.get(url, auth=requests.auth.HTTPBasicAuth(api_key, ''), params=params)
    j = r.json()
    # print(j)
    results = pd.DataFrame(columns=['id','page_count','double_sided'])

    results = parallelize_data(results, j['data'])

    url = j['next_url']

    #Run through the pagination
    if url is not None:
        while url is not None:
            r = session.get(url, auth=requests.auth.HTTPBasicAuth(api_key, ''))
            j = r.json()
            results = pd.concat([results,parallelize_data(results, j['data'])], ignore_index=True)
            url = j['next_url']

    results.to_csv('results_pdf_parse.csv', index=False)

def parallelize_data(results, data_list):
    num_cores = int(multiprocessing.cpu_count() - 1)  #leave one free to not freeze machine
    num_partitions = num_cores * 2 #number of partitions to split dataframe
    df_split = np.array_split(data_list, num_partitions)
    pool = multiprocessing.Pool(4)
    func = partial(parse_pdf)
    results = pd.concat(pool.map(func, df_split))
    pool.close()
    pool.join()
    return results

if __name__ == '__main__':
    ##Get API Key
    api_key = input('Enter in your API key (use your live API key to delete live resources): ')

    ##Delete
    parse_data(api_key)y

Now that you can identify who is sending mail and the total cost of mailpieces sent by each of your customers, you’re ready to bill them accurately.

Try before you buy

In the world of direct mail, there are guidelines and specifications that must be followed to ensure the quality of mailpieces submitted. This is why the auditing process is so important. Your customers will likely want to see the mailpieces they’re submitting before any purchases are made. Lob enables this by providing a test environment along with ways to preview mailpieces:

Use the test environment

We recommend that you use the Test environment to create digital proofs which you can then surface back to your customers before submitting Live.

Preview mailpieces

  1. The url parameter provides a full-scale digital proof of the mailpiece.

2. The thumbnail parameter provides smaller depictions of the mailpiece generated in small, medium, or large sizes.

Give insight into the delivery process

Learn more about to segment your mailings.

With your Lob account, you have access to both a live environment (in which mailpieces will be printed and sent) and a test environment, where you can try our API and view digital proofs without needing to cancel any mailpieces from being delivered. For more information, see .

We provide two ways to preview a mailpiece via each form factor’s endpoint. GET(Retrieve) can provide the details of an existing mailpiece (postcard request and response example ).

Lob provides visibility of every step of the mail delivery process with , for example “in transit” or “processed for delivery.” In turn, we highly recommend you surface these tracking events back to your end-customers so they can be in the loop as well.

GET (Retrieve) can provide the details of an existing mailpiece (postcard GET request and response example ); the tracking_events parameter can be used:

can also be set up to receive and store tracking events in real-time.

📞
partners@lob.com
modify your invoice
metadata
utilizing metadata tags
Test vs Live Environments
here
mail tracking events
here
Webhook notifications
Webhook notifications can provide granular visibility into each stage of the mail delivery process, from when the order is submitted to when it arrives to the recipients' doorstep.