---
title: "Connect Lob to ChatGPT: Automate Direct Mail & Address Verification"
slug: connect-lob-to-chatgpt-automate-direct-mail-address-verification
date: 2026-09-04
author: Uday Gajavalli
categories: ["AI & Agents"]
excerpt: "Learn how to connect Lob to ChatGPT using Truto's MCP server. Automate address verification, direct mail, and physical letter workflows with AI agents."
tldr: "Connect Lob to ChatGPT via Truto's auto-generated MCP server to automate physical mail workflows. Verify addresses, send postcards, and cancel print jobs using natural language."
canonical: https://truto.one/blog/connect-lob-to-chatgpt-automate-direct-mail-address-verification/
---

# Connect Lob to ChatGPT: Automate Direct Mail & Address Verification


If you need to connect Lob to ChatGPT to automate direct mail campaigns, verify [domestic addresses](https://truto.one/connect-lob-to-ai-agents-orchestrate-print-mail-identity-checks/), or cancel scheduled print jobs, you need a [Model Context Protocol (MCP) server](https://truto.one/blog/what-is-mcp-model-context-protocol-the-2026-guide-for-saas-pms/). This server acts as the translation layer between ChatGPT's tool calls and Lob's REST APIs. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude (see our guide on [automated Lobstr results](https://truto.one/blog/connect-lobstr-to-claude-manage-crawlers-and-automated-results/)), check out our guide on [connecting Lob to Claude](https://truto.one/connect-lob-to-claude-manage-mail-campaigns-custom-templates/) or explore our broader architectural overview on [connecting Lob to AI Agents](https://truto.one/connect-lob-to-ai-agents-orchestrate-print-mail-identity-checks/).

Giving a Large Language Model (LLM) read and write access to a direct mail API like Lob is an engineering challenge. You have to handle CASS-certified address verification, manage physical mail cancellation windows, and parse complex pagination. Every time you want to expose a new postcard template or letter format, your custom server code must be updated, redeployed, and tested.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Lob, connect it natively to ChatGPT, and execute complex [print and mail workflows](https://truto.one/connect-lob-to-ai-agents-orchestrate-print-mail-identity-checks/) using natural language.

::cta{buttonText="Talk to us" buttonUrl="/book-a-demo/"}
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
:::

## The Engineering Reality of the Lob API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Lob's API reveals some highly specific operational complexities.

If you decide to build a custom MCP server for Lob, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with Lob:

### The Immutable Nature of Physical Mail
Unlike a purely digital SaaS platform where you can `PUT` or `PATCH` a resource to update it, direct mail has physical consequences. Once a postcard or letter is created in Lob, its content is effectively immutable. If you notice a typo in a generated postcard, you cannot update it - you must delete the resource entirely and recreate it. Furthermore, cancellations are strictly time-bound. You can only call the `delete` endpoint before the `send_date` passes. Your MCP server must ensure the LLM understands this temporal constraint and doesn't hallucinate "update" methods that don't exist.

### Address Verification Strictness
Lob enforces strict validation on addresses. An LLM might naturally output an address as a single string, but Lob's API often requires precise component breakdown (`primary_line`, `secondary_line`, `city`, `state`, `zip_code`) for CASS certification. If the LLM passes an invalid unit number or misidentifies a PO Box, Lob will reject the request. Your integration layer must guide the LLM to verify addresses using the US or International verification endpoints before attempting to create saved address records or dispatching mail.

### Handling API Rate Limits
When an LLM runs a loop to dispatch a batch of postcards, it can easily hit Lob's API rate limits. It is critical to understand how Truto handles this: **Truto does not retry, throttle, or apply backoff on rate limit errors.** When the upstream Lob API returns an HTTP 429 Too Many Requests, Truto passes that error directly back to the caller. 

Truto does, however, normalize the upstream rate limit information into standardized headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`) per the IETF specification. The caller (the LLM framework or custom agent) is entirely responsible for reading these headers, pausing execution, and applying exponential backoff. Do not build an MCP server assuming the middleware will absorb your 429s.

## Lob to ChatGPT Quickstart Guide

If you want the fastest path from a fresh Truto account to ChatGPT calling the Lob API, follow these steps. 

**What you need:**
- A Truto account with API access.
- A Lob account with Live or Test API keys.
- A ChatGPT Pro, Plus, Business, Enterprise, or Education seat with Developer mode available.

### Step 1: Connect Lob as an Integrated Account

In the Truto dashboard, open **Integrated Accounts -> New Integrated Account**, select Lob, and enter your API keys. Truto encrypts and stores these credentials, injecting them into requests on the fly so ChatGPT never handles your raw API keys.

### Step 2: Grab your Integrated Account ID

You can copy this ID from the account detail page in the UI, or list it via the API:

```bash
curl https://api.truto.one/integrated-account \
  -H "Authorization: Bearer $TRUTO_API_TOKEN"
```

### Step 3: Generate the MCP Server URL

You can create the MCP server using either the Truto UI or the API.

**Method A: Via the Truto UI**
1. Navigate to the integrated account page for your Lob connection.
2. Click the **MCP Servers** tab.
3. Click **Create MCP Server**.
4. Select your desired configuration (e.g., restrict methods to `read` and `write`).
5. Copy the generated MCP server URL.

**Method B: Via the API**
Make a POST request to generate a secure token URL scoped strictly to this Lob account. 

```bash
curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Lob for ChatGPT",
    "config": {
      "methods": ["read", "write"],
      "tags": ["postcards", "letters", "addresses", "us_verifications"]
    }
  }'
```

The response returns a `url` (e.g., `https://api.truto.one/mcp/<token>`). This URL contains a cryptographically hashed token that routes directly to your Lob account. Treat it like a secret.

### Step 4: Register the MCP Server in ChatGPT

You can connect this URL to [ChatGPT](https://truto.one/blog/connect-lobstr-to-chatgpt-automate-scraper-squids-and-data-runs/) or any local MCP client.

**Method A: Via the ChatGPT UI**
1. In ChatGPT, click **Settings -> Apps -> Advanced settings**.
2. Toggle **Developer mode** on.
3. Under MCP servers / Custom connectors, click to add a new server.
4. Enter a name (e.g., "Lob API").
5. Paste the Truto MCP URL into the **Server URL** field and click Add.

**Method B: Via Manual Config File (for Claude Desktop or local clients)**
If you are using a local agent framework or Claude Desktop, you can configure the server using a JSON file and the remote Server-Sent Events (SSE) transport:

```json
{
  "mcpServers": {
    "lob": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/YOUR_TOKEN_HERE"
      ]
    }
  }
}
```

## Security and Access Control

Handing an LLM direct access to an API that charges money per request (like printing physical letters) requires strict governance. Truto's MCP servers provide four critical security levers:

*   **Method Filtering:** By defining `config.methods: ["read"]`, you can physically prevent the LLM from executing `POST`, `PUT`, or `DELETE` requests, ensuring it can only list past mailings and cannot spend your Lob balance.
*   **Tag Filtering:** Limit the LLM's surface area by specifying `config.tags: ["addresses"]`. If you only want the LLM to verify addresses, tag filtering ensures tools for postcards and letters are never exposed to the model.
*   **API Token Auth (`require_api_token_auth`):** By default, the MCP URL alone grants access. For higher security, setting this flag to `true` forces the client to also pass a valid Truto API token in the `Authorization` header. 
*   **Automatic Expiration (`expires_at`):** Truto stores MCP tokens in a distributed edge key-value store, backed by a durable alarm system for cleanup. Passing an ISO 8601 timestamp in the `expires_at` field guarantees the server URL will self-destruct exactly when intended.

## Hero Tools for Lob

Truto auto-generates dozens of tools directly from the Lob OpenAPI schema. Here are the most powerful tools to expose to your AI agents for direct mail and address workflows.

### Verify a US Address

**Tool:** `create_a_lob_us_verification`

Verifies a single US or US territory address to ensure it is deliverable. The address can be passed as a single-line string or as individual components. This is the required first step before creating a saved address record.

> Verify this address for me and tell me if it is deliverable: 185 Berry Street, Suite 6100, San Francisco, CA 94107

### Create a Saved Address

**Tool:** `create_a_lob_address`

Creates a reusable address object in your Lob account. This returns an `id` (e.g., `adr_...`) that you must use as the `to` or `from` parameter when dispatching physical mail.

> Create a new saved address record for John Doe at the verified San Francisco address we just checked. Tag the metadata with 'customer_type: VIP'.

### Send a Direct Mail Postcard

**Tool:** `create_a_lob_postcard`

Creates and schedules a new physical postcard. You must provide the `to` address ID, `from` address ID, front artwork, back artwork, and a `use_type` (e.g., operational, marketing). The artwork can be an HTML string or a URL to a PDF.

> Send a 4x6 promotional postcard to John Doe's address ID. Use this PDF URL for the front (https://example.com/front.pdf) and this HTML string for the back. Set the use type to marketing.

### Check Postcard Status

**Tool:** `get_single_lob_postcard_by_id`

Retrieves the full details of a specific postcard, including its tracking events and expected delivery date. Useful for customer support agents checking if a mailer arrived.

> What is the current tracking status and expected delivery date for the postcard with ID psc_12345?

### Cancel a Scheduled Postcard

**Tool:** `delete_a_lob_postcard_by_id`

Cancels a scheduled Lob postcard and removes it from production. This can only be executed before the `send_date` has passed. Note that scheduling and cancellation requires a premium Lob feature.

> I found a typo in the artwork. Immediately cancel postcard psc_12345 before it goes to the printer.

### Send a Business Letter

**Tool:** `create_a_lob_letter`

Generates a professional letter. This supports options like color vs. black-and-white, double-sided printing, and inserting a perforated return envelope.

> Draft and send a black-and-white, single-sided operational letter to address adr_9876. Use the standard compliance notice HTML template. Include a return envelope.

For the complete tool inventory and JSON schemas covering bank accounts, checks, snap packs, and billing groups, visit the [Lob integration page](https://truto.one/integrations/detail/lob).

## Workflows in Action

Here is how an LLM chains these tools together to execute complex operational workflows.

### Workflow 1: Address Scrubbing and Personalized Outreach

Sales operations teams often have lists of messy, unstructured prospect addresses. An AI agent can parse, verify, and execute outreach autonomously.

> "I have a rough address for a prospect: '123 Main st ste 400 new york ny'. Verify it. If it is valid, save it to our Lob directory, and send a standard intro letter from our HQ address (adr_hq_001)."

**Execution Steps:**
1. ChatGPT calls `create_a_lob_us_verification` passing the messy address string.
2. Lob returns the standardized, CASS-certified components (e.g., 123 Main St Ste 400, New York, NY 10044).
3. ChatGPT calls `create_a_lob_address` using the clean components to generate a formal `adr_...` ID.
4. ChatGPT calls `create_a_lob_letter` using the new `to` ID and the provided `from` ID, injecting the standard intro copy into the HTML parameter.

**Result:** The user gets confirmation that the address was scrubbed and the exact expected delivery date of the letter.

```mermaid
flowchart TD
  A["Extract address<br>from prompt"]
  B["Verify US address<br>via Lob API"]
  C["Create Address ID"]
  D["Dispatch Letter"]
  A --> B
  B -->|If deliverable| C
  C --> D
```

### Workflow 2: Automated Campaign Cancellation

When a user spots an error in a recently triggered campaign, time is of the essence. The AI can check the state and abort the print job if the window is still open.

> "We messed up the promo code on the recent mailer to Jane Smith. Find her postcard and cancel it before it prints."

**Execution Steps:**
1. ChatGPT calls `list_all_lob_postcards` and filters the results to find the most recent dispatch sent to Jane Smith.
2. ChatGPT extracts the postcard ID and `send_date`.
3. Recognizing the `send_date` is still in the future, ChatGPT calls `delete_a_lob_postcard_by_id`.

**Result:** The user receives a message confirming the postcard was successfully intercepted and deleted from the production queue, saving the printing and postage costs.

## Strategic Wrap-Up

Direct mail APIs operate under strict physical constraints. Misformatting an address or missing a cancellation window costs real money. Building a custom MCP server to handle Lob's strict CASS verification schemas, file payload requirements, and rate limit headers requires significant engineering overhead.

By using Truto, you bypass the infrastructure work. Truto dynamically maps Lob's API definitions to MCP tools, normalizes rate limits, and secures access via edge-enforced tokens and method filters. This allows your team to focus on building the AI agent's logic, while Truto handles the integration layer.
