Programmatically send physical mail at scale

Join Amazon, Square, Counsyl, and 5,000 other companies using Lob's modern API

Try it Now

Customize

Generate dynamic content to personalize your mailings. Lob makes it possible to do things that simply can't be done manually.

Trigger

Print and send mail with a few lines of code. From trigger-based postcards to on-demand checks and direct mail campaigns, Lob has you covered.

Iterate

Easily A/B test layout, messaging, and more to optimize your campaigns. You have full control over everything.

Track

Monitor your mail as it travels to its destination and add any additional campaign tracking you'd like to assess performance.

Scale

Send a single postcard or a million each month. No minimums or batching required.

Save

Only pay for what you send with printing, postage, and shipping all included at one low price.

Get started with the Lob API in minutes

Lob offers pre-built wrappers in Node, Ruby, Python, PHP, and Java to make integration as easy as possible.

Read the Docs View Libraries
  • curl

  • Node

  • Ruby

  • Python

  • PHP

  • Java

  • 
    curl https://api.lob.com/v1/postcards \
      -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
      -d "description=Demo Postcard job" \
      -d "to[name]=Harry Zhang" \
      -d "to[address_line1]=123 Test Street" \
      -d "to[address_city]=Mountain View" \
      -d "to[address_state]=CA" \
      -d "to[address_zip]=94041" \
      -d "to[address_country]=US" \
      --data-urlencode "front=<html style='padding: 1in; font-size: 50;'>Front HTML for {{name}}</html>" \
      --data-urlencode "back=<html style='padding: 1in; font-size: 20;'>Back HTML for {{name}}</html>" \
      -d "data[name]=Harry"
    
              
    
    Lob.postcards.create({
      description: 'Demo Postcard job',
      to: {
        name: 'Harry Zhang',
        address_line1: '123 Main Street',
        address_city: 'Mountain View',
        address_state: 'CA',
        address_zip: '94041'
      },
      front: '<html style="padding: 1in; font-size: 50;">Front HTML for {{name}}</html>',
      back: '<html style="padding: 1in; font-size: 20;">Back HTML for {{name}}</html>',
      data: {
        name: 'Harry'
      }
    }, function (err, res) {
      console.log(err, res);
    });
    
              
    
    @lob.postcards.create(
      description: "Demo Postcard job",
      to: {
        name: "Harry Zhang",
        address_line1: "123 Test Street",
        address_city: "Mountain View",
        address_state: "CA",
        address_country: "US",
        address_zip: 94041
      },
      front: "<html style='padding: 1in; font-size: 50;'>Front HTML for {{name}}</html>",
      back: "<html style='padding: 1in; font-size: 20;'>Back HTML for {{name}}</html>",
      data: {
        name: "Harry"
      }
    )
    
              
    
    lob.Postcard.create(
      to_address = {
        'name': 'Harry Zhang',
        'address_line1': '123 Test Street',
        'address_city': 'Mountain View',
        'address_state': 'CA',
        'address_zip': '94041',
        'address_country': 'US'
      },
      front = '<html style="padding: 1in; font-size: 50;">Front HTML for {{name}}</html>',
      back = '<html style="padding: 1in; font-size: 20;">Back HTML for {{name}}</html>',
      data = {
        'name': 'Harry'
      }
    )
    
              
    
    $lob->postcards()->create(array(
      'description' => 'Demo Postcard job',
      'to'      => array(
        'name'          => 'Harry Zhang',
        'address_line1' => '123 Main Street',
        'address_city'  => 'Mountain View',
        'address_state' => 'CA',
        'address_zip'   => '94041',
      ),
      'front'       => '<html style="padding: 1in; font-size: 50;">Front HTML for {{name}}</html>',
      'back'        => '<html style="padding: 1in; font-size: 20;">Back HTML for {{name}}</html>',
      'data[name]'  => 'Harry'
    ));
    
              
    
    final Map<String, String> data = Maps.newHashMap();
    data.put("name", "Harry");
    
    final PostcardRequest postcardRequest = PostcardRequest.builder()
      .to(AddressRequest.builder()
        .name("Harry Zhang")
        .line1("123 Test Street")
        .city("Mountain View")
        .state("CA")
        .zip("94041")
        .country("US")
        .build())
      .front("<html style='padding: 1in; font-size: 50;'>Front HTML for {{name}}</html>")
      .back("<html style='padding: 1in; font-size: 20;'>Back HTML for {{name}}</html>")
      .data(data)
      .build();
    final PostcardResponse postcard = client.createPostcard(postcardRequest).get();