> For the complete documentation index, see [llms.txt](https://help.lob.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.lob.com/developer-docs/sdks-and-libraries.md).

# SDKs & libraries

## SDKs <a href="#sdks-2" id="sdks-2"></a>

Currently, we have SDKs available for the following languages:

{% tabs %}
{% tab title="TypeScript" %}
![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)  [lob-typescript-sdk](https://github.com/lob/lob-typescript-sdk)

#### Installation <a href="#installation-3" id="installation-3"></a>

Lob's TypeScript SDK can be installed through NPM:\
`$ npm i @lob/lob-typescript-sdk`

To build and install from the latest source:\
`$ git clone git@github.com:lob/lob-typescript-sdk.git`

`$ npm install`

Learn more at the [lob-typescript-sdk](https://www.github.com/lob/lob-typescript-sdk) repository on GitHub.
{% endtab %}

{% tab title="PHP" %}

#### ![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)  [lob-php](https://github.com/lob/lob-php) <a href="#installation-5" id="installation-5"></a>

#### Installation <a href="#installation-5" id="installation-5"></a>

The recommended way to install lob-php is through Composer.

Install Composer

`curl -sS https://getcomposer.org/installer | php`

Add Lob.com PHP client as a dependency

`composer require lob/lob-php`

After installing, you need to require Composer's autoloader:

`require 'vendor/autoload.php';`

Learn more at the [lob-php](https://www.github.com/lob/lob-php) repository on GitHub.
{% endtab %}

{% tab title="Java" %}

#### ![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg) [lob-java](https://github.com/lob/lob-java) <a href="#installation-7" id="installation-7"></a>

#### Installation <a href="#installation-7" id="installation-7"></a>

Include the following in your pom.xml for Maven:

```java
 <dependencies>
  <dependency>
    <groupId>com.lob</groupId>
    <artifactId>lob-java</artifactId>
    <version>13.0.0</version>
  </dependency>
  ...
 </dependencies>
```

Gradle:\
`compile 'com.lob:lob-java:13.0.0'`

Learn more at the [lob-java](https://www.github.com/lob/lob-java) repository on GitHub.
{% endtab %}

{% tab title="Python" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)](https://github.com/lob/lob-python)  [lob-python](https://github.com/lob/lob-python)

#### Installation <a href="#installation-9" id="installation-9"></a>

You can use pip to install the package:

`pip install lob`

To initialize the wrapper, import lob and set the api\_key:

`import lob`&#x20;

`lob.api_key = 'your-api-key'`

Learn more at the [lob-python](https://www.github.com/lob/lob-python) repository on GitHub.
{% endtab %}

{% tab title="Ruby" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)](https://github.com/lob/lob-ruby)  [lob-ruby](https://github.com/lob/lob-ruby)

#### Installation <a href="#installation-11" id="installation-11"></a>

Add this line to your application's Gemfile:\
`gem 'lob'`

And then execute:

`$ bundle`

Or manually install it yourself:

`$ gem install lob`

Learn more at the [lob-ruby](https://www.github.com/lob/lob-ruby) repository on GitHub.
{% endtab %}

{% tab title="Elixir" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)](https://github.com/lob/lob-elixir)  [lob-elixir](https://github.com/lob/lob-elixir)

#### Installation <a href="#installation-13" id="installation-13"></a>

The package can be installed by adding :lob\_elixir to your list of dependencies in mix.exs:

```
def deps do
   [
     {:lob_elixir, "~> 1.5.0"}
   ]
 end
```

Learn more at the [lob-elixir](https://www.github.com/lob/lob-elixir) repository on GitHub.
{% endtab %}

{% tab title="C#/.NET" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)](https://github.com/lob/lob-elixir)  [lob-dotnet](https://github.com/lob/lob-dotnet)
{% endtab %}

{% tab title="Go" %}
[<img src="https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg" alt="" data-size="original">](https://github.com/lob/lob-ruby)  lob-go
{% endtab %}
{% endtabs %}

**Don’t see your favorite language?**

Let us know which language you’d like us to support next.  Drop us an [email.](mailto:lob-openapi@lob.com)

## Sample Scripts

{% tabs %}
{% tab title="Typescript" %}

```
import 'dotenv/config';

const apiKey = process.env.LOB_API_KEY;

if (!apiKey) {
  console.error("Error: LOB_API_KEY is not set in your .env file.");
  process.exit(1);
}

const authString = Buffer.from(`${apiKey}:`).toString('base64');

const letterData = {
  description: "Letter",
  to: {
    name: "Larry Lobster",
    address_line1: "123 Main St",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94105"
  },
  from: {
    name: "Lena Lobster",
    address_line1: "456 Market St",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94105"
  },
  file: "<h1>Hello, World!</h1>",
  qr: {
    position: "relative",
    top: 5,
    left: 4,
    redirect_url: "https://dashboard.lob.com"
  },
  use_type: "marketing"
}

async function sendLetter() {
  try {
    const response = await fetch("https://api.lob.com/v1/letters", {
      method: "POST",
      headers: {
        "Authorization": `Basic ${authString}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify(letterData)
    });

    const data = await response.json();

    if (!response.ok) {
      console.error("Lob API error:", data);
      return;
    }
    console.log("Success! Letter created.");
    console.log("Letter ID:", data.id);
  } catch (error) {
    console.error("Failed to make the request:", error);
  }
}

sendLetter();

```

{% endtab %}

{% tab title="PHP" %}

```
<?php
require 'vendor/autoload.php';

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

$apiKey = $_ENV['LOB_API_KEY'] ?? null;

if (!$apiKey) {
  echo "Error: LOB_API_KEY is not set in your .env file.\n";
  exit(1);
}

$letterData = [
  "description" => "My first PHP Letter",
  "to" => [
    "name" => "Larry Lobster",
    "address_line1" => "123 Main St",
    "address_city" => "San Francisco",
    "address_state" => "CA",
    "address_zip" => "94105"
  ],
  "from" => [
    "name" => "Lena Lobster",
    "address_line1" => "456 Market St",
    "address_city" => "San Francisco",
    "address_state" => "CA",
    "address_zip" => "94105"
  ],
  "file" => "<h1>Hello, World!</h1>",
  "color" => true,
  "use_type" => "operational",
  "qr_code" => [
    "position" => "relative",
    "width" => "1",
    "top" => 4,
    "left" => 5,
    "redirect_url" => "https://dashboard.lob.com"
  ]
];

echo "Sending letter to Lob...\n";

$ch = curl_init("https://api.lob.com/v1/letters");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($letterData));

curl_setopt($ch, CURLOPT_HTTPHEADER, [
  "Content-Type: application/json"
]);

curl_setopt($ch, CURLOPT_USERPWD, $apiKey . ":");

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if (curl_errno($ch)) {
  echo "Request Error: " . curl_error($ch) . "\n";
  curl_close($ch);
  exit(1);
}

curl_close($ch);

$data = json_decode($response, true);

if ($httpCode >= 200 && $httpCode < 300) {
  echo "Success! Letter created.\n";
  echo "Letter ID: " . $data["id"] . "\n";
} else {
  echo "Lob API error:\n";
  print_r($data);
}

```

{% endtab %}

{% tab title="Java" %}

```
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        // 1. Grab the API key from the system environment
        String apiKey = System.getenv("LOB_API_KEY");

        // Safety check
        if (apiKey == null || apiKey.trim().isEmpty()) {
            System.err.println("Error: LOB_API_KEY environment variable is not set.");
            System.exit(1);
        }

        // 2. Encode the Basic Auth header
        // Java requires us to manually encode "username:password" to Base64
        String authString = apiKey + ":";
        String encodedAuth = Base64.getEncoder().encodeToString(authString.getBytes());

        // 3. Define the data payload
        // Java doesn't have JS-style Object literals. For a simple script without adding heavy JSON libraries
        // (like Jackson or Gson), we can use Java's Text Blocks (""") to write raw JSON.
        String jsonPayload = """
            {
              "description": "My First Java Letter",
              "to": {
                "name": "Jane Doe",
                "address_line1": "123 Main St",
                "address_city": "San Francisco",
                "address_state": "CA",
                "address_zip": "94105"
              },
              "from": {
                "name": "Your Name",
                "address_line1": "456 Market St",
                "address_city": "San Francisco",
                "address_state": "CA",
                "address_zip": "94105"
              },
              "file": "<h1>Hello, World</h1>",
              "color": true,
              "use_type": "operational",
              "qr_code": {
                "position": "relative",
                "top": 5,
                "left": 5,
                "width": 1,
                "redirect_url": "https://dashboard.lob.com"
              }
            }
            """;

        System.out.println("Sending letter to Lob...");

        try {
            // 4. Create the HTTP Client and Request
            HttpClient client = HttpClient.newHttpClient();

            HttpRequest request = HttpRequest.newBuilder()
                    .uri(URI.create("https://api.lob.com/v1/letters"))
                    .header("Authorization", "Basic " + encodedAuth)
                    .header("Content-Type", "application/json")
                    .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
                    .build();

            // 5. Execute the request
            // We tell Java to treat the response body as a String
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

            // 6. Handle the Response
            if (response.statusCode() >= 200 && response.statusCode() < 300) {
                System.out.println("Success! Letter created.");

                // Because we aren't using a JSON parsing library, we can use a quick Regex
                // to pluck the ID and expected delivery date out of the response string.
                Matcher idMatcher = Pattern.compile("\"id\":\"(ltr_[^\"]+)\"").matcher(response.body());
                Matcher dateMatcher = Pattern.compile("\"expected_delivery_date\":\"([^\"]+)\"").matcher(response.body());

                if (idMatcher.find()) System.out.println("Letter ID: " + idMatcher.group(1));
                if (dateMatcher.find()) System.out.println("Expected Delivery: " + dateMatcher.group(1));
            } else {
                System.err.println("Lob API Error:");
                System.err.println(response.body());
            }

        } catch (Exception e) {
            // This catches network/thread errors
            System.err.println("Failed to make the request: " + e.getMessage());
        }
    }
}

```

{% endtab %}

{% tab title="Python" %}

```
import os
import sys
import requests
from dotenv import load_dotenv

load_dotenv()

api_key = os.getenv("LOB_API_KEY")

if not api_key:
  print("Error: LOB_API_KEY is not set in your .env file.")
  sys.exit(1)

target_address = {
  "recipient": "Larry Lobster",
  "primary_line": "210 King St",
  "city": "San Francisco",
  "state": "CA",
  "zip_code": "94107"
}

print("Step 1: Verifying address with USPS data...")

try:
  ver_response = requests.post("https://api.lob.com/v1/us_verifications", json=target_address, auth=(api_key, ''))

  if not ver_response.ok:
    print("Address Verification API Error:")
    print(ver_response.json())
    sys.exit(1)

  ver_data = ver_response.json()

  deliverability = ver_data.get("deliverability")

  is_vacant = ver_data.get("components", {}).get("dpv_vacant") == "Y"

  print(f"-> Status: {deliverability}")
  print(f"-> Vacant: {is_vacant}")

  if deliverability == "undeliverable" or is_vacant:
    print("\nResult: Address is either undeliverable or vacant. Aborting letter creation to save postage.")
    sys.exit(0)

  print("\nResult: Address is valid and occupied! Proceeding to Step 2...")

  letter_data = {
    "description": "My first Python letter",
    "to": {
      "name": target_address["recipient"],
      "address_line1": target_address["primary_line"],
      "address_city": target_address["city"],
      "address_state": target_address["state"],
      "address_zip": target_address["zip_code"]
    },
    "from": {
      "name": "Lena Lobster",
      "address_line1": "456 Market St",
      "address_city": "San Francisco",
      "address_state": "CA",
      "address_zip": "94105"
    },
    "file": "<h1>Hello, World!</h1>",
    "color": True,
    "use_type": "operational",
    "qr_code": {
      "position": "relative",
      "top": 5,
      "left": 5,
      "width": 1,
      "redirect_url": "https://dashboard.lob.com"
    }
  }

  letter_response = requests.post("https://api.lob.com/v1/letters", json=letter_data, auth=(api_key, ''))

  if letter_response.ok:
    data = letter_response.json()
    print("\nSuccess! Letter created.")
    print(f"Letter ID: {data.get("id")}")
    print(f"Expected Delivery: {data.get("expected_delivery_date")}")
  else:
    print("\nLob Letters API Error:")
    print(letter_response.json())
except requests.exceptions.RequestException as e:
  print(f"Failed to make the network request: {e}")

```

{% endtab %}

{% tab title="Ruby" %}

```
require 'net/http'
require 'uri'
require 'json'
require 'dotenv'

Dotenv.load

api_key = ENV['LOB_API_KEY']

if api_key.nil? || api_key.empty?
  puts "Error: LOB_API_KEY is not set in your .env file."
  exit(1)
end

target_address = {
  recipient: "Larry Lobster",
  primary_line: "210 King St",
  city: "San Francisco",
  state: "CA",
  zip_code: "94107"
}

puts "Step 1: Verifying address with USPS data..."

av_uri = URI.parse("https://api.lob.com/v1/us_verifications")
av_http = Net::HTTP.new(av_uri.host, av_uri.port)
av_http.use_ssl = true

av_request = Net::HTTP::Post.new(av_uri.request_uri)
av_request['Content-Type'] = 'application/json'
av_request.basic_auth(api_key, '')
av_response = av_http.request(av_request)

unless av_response.is_a?(Net::HTTPSuccess)
  puts "Address Verification API Error:"
  puts JSON.pretty_generate(JSON.parse(av_response.body))
  exit(1)
end

ver_data = JSON.parse(av_response.body)

deliverability = ver_data['deliverability']
is_vacant = ver_data.dig('components', 'dpv_vacant') == 'Y'

puts "-> Status: #{deliverability}"
puts "-> Vacant: #{is_vacant}"

if deliverability == "undeliverable" || is_vacant
  puts "\nResult: Address is either undeliverable or vacant. Aborting letter creation to save postage!"
  exit(0)
end

puts "\nResult: Address is valid and occupied! Proceeding to Step 2..."

letter_data = {
  description: "My first Ruby letter",
  to: {
    name: target_address[:recipient],
    address_line1: target_address[:primary_line],
    address_city: target_address[:city],
    address_state: target_address[:state],
    address_zip: target_address[:zip_code]
  },
  from: {
    name: "Lena Lobster",
    address_line1: "456 Market St",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94105"
  },
  file: "<h1>Hello, World!</h1>",
  color: true,
  use_type: "operational",
  qr_code: {
    position: "relative",
    width: 1,
    top: 5,
    left: 5,
    redirect_url: "https://dashboard.lob.com"
  }
}


uri = URI.parse("https://api.lob.com/v1/letters")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request.basic_auth(api_key, '')
request.body = letter_data.to_json

response = http.request(request)

if response.is_a?(Net::HTTPSuccess)
  data = JSON.parse(response.body)
  puts "Success! Letter created."
  puts "Letter ID: #{data['id']}"
  puts "Expected Delivery: #{data['expected_delivery_date']}"
else
  puts "Lob API Error:"
  puts JSON.pretty_generate(data)
end

```

{% endtab %}

{% tab title="Elixir" %}

```
Mix.install([
  {:req, "~> 0.4.0"}
])

api_key = System.get_env("LOB_API_KEY")

if is_nil(api_key) or api_key == "" do
  IO.puts(:stderr, "Error: LOB_API_KEY environment variable is not set.")
  System.halt(1)
end

letter_data = %{
  description: "My first Elixir letter",
  to: %{
    name: "Larry Lobster",
    address_line1: "123 Main St",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94105"
  },
  from: %{
    name: "Lena Lobster",
    address_line1: "456 Market St",
    address_city: "San Francisco",
    address_state: "CA",
    address_zip: "94105"
  },
  file: "<h1>Hello, World!</h1>",
  qr_code: %{
    position: "relative",
    width: 1,
    top: 5,
    left: 5,
    redirect_url: "https://dashboard.lob.com"
  },
  color: true,
  address_placement: "top_first_page",
  use_type: "operational"
}

IO.puts("Sending letter to Lob...")

response = Req.post!("https://api.lob.com/v1/letters",
auth: {:basic, "#{api_key}:"},
json: letter_data
)

if response.status in 200..299 do
  data = response.body

  IO.puts("Success! Letter created.")
  IO.puts("Letter ID: #{data["id"]}")
else
  IO.puts(:stderr, "Lob API Error:")
  IO.inspect(response.body)
end

```

{% endtab %}

{% tab title="C#/.NET" %}

```
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

DotNetEnv.Env.Load();

string apiKey = Environment.GetEnvironmentVariable("LOB_API_KEY");

if (string.IsNullOrEmpty(apiKey))
{
  Console.WriteLine("Error: LOB_API_KEY is not set in your .env file.");
  Environment.Exit(1);
}

var letterData = new
{
  description = "My First C# Letter",
  to = new
  {
    name = "Larry Lobster",
    address_line1 = "123 Main St",
    address_city = "San Francisco",
    address_state = "CA",
    address_zip = "94105"
  },
  from = new
  {
    name = "Lena Lobster",
    address_line1 = "456 Market St",
    address_city = "San Francisco",
    address_state = "CA",
    address_zip = "94105"
  },
  file = "<h1>Hello, World!</h1>",
  color = true,
  use_type = "operational",
  qr_code = new
  {
    position = "relative",
    top = 5,
    left = 5,
    width = 1,
    redirect_url = "https://dashboard.lob.com"
  }
};

Console.WriteLine("Sending letter to Lob...");

using var client = new HttpClient();

var authBytes = Encoding.ASCII.GetBytes($"{apiKey}:");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authBytes));

var jsonString = JsonSerializer.Serialize(letterData);
var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://api.lob.com/v1/letters", httpContent);
var responseBody = await response.Content.ReadAsStringAsync();

if (response.IsSuccessStatusCode)
{
  using JsonDocument doc = JsonDocument.Parse(responseBody);
  var root = doc.RootElement;

  Console.WriteLine("Success! Letter created.");
  Console.WriteLine($"Letter ID: {root.GetProperty("id").GetString()}");
  Console.WriteLine($"Expected Delivery: {root.GetProperty("expected_delivery_date").GetString()}");
}
else
{
  Console.WriteLine("Lob API Error: ");
  Console.WriteLine(responseBody);
}

```

{% endtab %}

{% tab title="Go" %}

```
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"github.com/joho/godotenv"
)

type Address struct {
	Name string `json:"name"`
	AddressLine1 string `json:"address_line1"`
	City string `json:"address_city"`
	State string `json:"address_state"`
	Zip string `json:"address_zip"`
}

type QrCode struct {
	Position string `json:"position"`
	RedirectUrl string `json:"redirect_url"`
	Width int `json:"width"`
	Top int `json:"top"`
	Left int `json:"left"`
}

type LetterRequest struct {
	Description string `json:"description"`
	To Address `json:"to"`
	From Address `json:"from"`
	File string `json:"file"`
	Color bool `json:"color"`
	UseType string `json:"use_type"`
	QR QrCode `json:"qr_code"`
}

type LetterResponse struct {
	ID string `json:"id"`
	ExpectedDeliveryDate string `json:"expected_delivery_date"`
}

func main() {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file.")
	}

	apiKey := os.Getenv("LOB_API_KEY")
	if apiKey == "" {
		log.Fatal("Error: LOB_API_KEY is not set.")
	}

	letterData := LetterRequest{
		Description: "My First Go Letter",
		To: Address{
			Name: "Larry Lobster",
			AddressLine1: "123 Main St",
			City: "San Francisco",
			State: "CA",
			Zip: "94105",
		},
		From: Address{
			Name: "Lena Lobster",
			AddressLine1: "456 Market St",
			City: "San Francisco",
			State: "CA",
			Zip: "94105",
		},
		File: "<h1>Hello, World!</h1>",
		Color: true,
		UseType: "operational",
		QR: QrCode{
			Position: "relative",
			Top: 5,
			Left: 5,
			Width: 1,
			RedirectUrl: "https://dashboard.lob.com",
		},
	}

	jsonData, err := json.Marshal(letterData)
	if err != nil {
		log.Fatal("Error converting data to JSON:", err)
	}

	fmt.Println("Sending letter to Lob...")

	req, err := http.NewRequest("POST", "https://api.lob.com/v1/letters", bytes.NewBuffer(jsonData))
	if err != nil {
		log.Fatal("Error creating request:", err)
	}

	req.Header.Set("Content-Type", "application/json")

	req.SetBasicAuth(apiKey, "")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal("Error executing request:", err)
	}

	defer resp.Body.Close()

	bodyText, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading response:", err)
	}

	if resp.StatusCode >= 200 && resp.StatusCode < 300 {
		var successData LetterResponse

		json.Unmarshal(bodyText, &successData)

		fmt.Println("Success! Letter created.")
		fmt.Printf("Letter ID: %s\n", successData.ID)
		fmt.Printf("Expected delivery: %s\n", successData.ExpectedDeliveryDate)
	} else {
		fmt.Println("Lob API Error:")
		fmt.Println(string(bodyText))
	}
}

```

{% endtab %}
{% endtabs %}

## Libraries <a href="#libraries-4" id="libraries-4"></a>

### Address Elements <a href="#address-elements-5" id="address-elements-5"></a>

Address Elements works by targeting the input elements of your address form and using their values with Lob's **verification** and **autocomplete** functionality.

{% tabs %}
{% tab title="JavaScript" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647371919748-github-svgrepo-com.svg)](https://github.com/lob/address-elements) [address-elements](https://github.com/lob/address-elements)

**Registration**

Create an account at [Lob.com](https://dashboard.lob.com/#/register) to obtain a **Live Public API Key**. The key is available in the [Lob settings panel](https://dashboard.lob.com/#/settings) and uses the format, `live_pub_*`.

**Usage**

Embed the Lob Address Elements script immediately before the closing tag in the HTML containing your address form. The script will autodetect your form and its inputs.

```
<script src="https://cdn.lob.com/lob/address-elements/2.2.1/address-elements.min.js" data-lob-key="live_pub_xxx">
```

Learn more at the [address-elements](https://www.github.com/lob/address-elements) repository on GitHub.
{% endtab %}

{% tab title="React" %}
[![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647461208700-npm-svgrepo-com.svg)](https://www.npmjs.com/package/@lob/react-address-autocomplete) [react-address-autocomplete](https://www.npmjs.com/package/@lob/react-address-autocomplete)

This is a very lightweight component that uses the Lob Autocomplete API in order to simplify the process of adding in a search autocomplete bar or form. Check out the Autocomplete API for more configuration options in [Lob documentation](https://docs.lob.com/#operation/autocompletion).

**Installation**

```
npm install --save @lob/react-address-autocomplete
```

Learn more at the [react-address-autocomplete](https://www.npmjs.com/package/@lob/react-address-autocomplete) NPM repository.

![](https://static.helpjuice.com/helpjuice_production/uploads/upload/image/9583/direct/1647461616365-autocompleteDemo.gif)
{% endtab %}
{% endtabs %}
