data
Lob CLI for AI Agents
Use the Lob CLI from KosmoKrator to call Lob tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Lob CLI Setup
Lob can be configured headlessly with `kosmokrator integrations:configure lob`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure lob --set api_key="$LOB_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor lob --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | LOB_API_KEY | Secret secret | yes | API Key |
url | LOB_URL | URL url | no | Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call lob.lob_list_letters '{"limit":1,"offset":1}' --json kosmo integrations:lob lob_list_letters '{"limit":1,"offset":1}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs lob --json
kosmo integrations:docs lob.lob_list_letters --json
kosmo integrations:schema lob.lob_list_letters --json
kosmo integrations:search "Lob" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
lob.lob_list_letters
List letters with pagination. Returns a page of letter objects sorted by creation date (newest first).
read - Parameters
- limit, offset
kosmo integrations:call lob.lob_list_letters '{"limit":1,"offset":1}' --json kosmo integrations:lob lob_list_letters '{"limit":1,"offset":1}' --json lob.lob_get_letter
Retrieve details of a specific letter by its Lob ID, including delivery status, tracking info, and the letter URL.
read - Parameters
- id
kosmo integrations:call lob.lob_get_letter '{"id":"example_id"}' --json kosmo integrations:lob lob_get_letter '{"id":"example_id"}' --json lob.lob_create_letter
Create and send a letter via Lob. Provide recipient and sender addresses (as address IDs or inline address objects), plus an HTML file or template ID for the letter content.
write - Parameters
- to, from, description, file, color, double_sided
kosmo integrations:call lob.lob_create_letter '{"to":"example_to","from":"example_from","description":"example_description","file":"example_file","color":true,"double_sided":true}' --json kosmo integrations:lob lob_create_letter '{"to":"example_to","from":"example_from","description":"example_description","file":"example_file","color":true,"double_sided":true}' --json lob.lob_list_postcards
List postcards with pagination. Returns a page of postcard objects sorted by creation date (newest first).
read - Parameters
- limit, offset
kosmo integrations:call lob.lob_list_postcards '{"limit":1,"offset":1}' --json kosmo integrations:lob lob_list_postcards '{"limit":1,"offset":1}' --json lob.lob_get_postcard
Retrieve details of a specific postcard by its Lob ID, including delivery status, tracking info, and thumbnails.
read - Parameters
- id
kosmo integrations:call lob.lob_get_postcard '{"id":"example_id"}' --json kosmo integrations:lob lob_get_postcard '{"id":"example_id"}' --json lob.lob_create_postcard
Create and send a postcard via Lob. Provide recipient and sender addresses (as address IDs or inline address objects), plus HTML or template IDs for the front and back.
write - Parameters
- to, from, description, front, back
kosmo integrations:call lob.lob_create_postcard '{"to":"example_to","from":"example_from","description":"example_description","front":"example_front","back":"example_back"}' --json kosmo integrations:lob lob_create_postcard '{"to":"example_to","from":"example_from","description":"example_description","front":"example_front","back":"example_back"}' --json lob.lob_get_current_user
List saved addresses in the Lob account. Returns all verified addresses that can be used as sender or recipient for letters and postcards.
read - Parameters
- none
kosmo integrations:call lob.lob_get_current_user '{}' --json kosmo integrations:lob lob_get_current_user '{}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
lob.lob_list_letters 2 parameters
kosmo integrations:schema lob.lob_list_letters --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Number of results per page (default: 10, max: 100). |
offset | integer | no | Number of results to skip for pagination (default: 0). |
lob.lob_get_letter 1 parameters
kosmo integrations:schema lob.lob_get_letter --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The letter ID (e.g., "ltr_abcdef123456"). |
lob.lob_create_letter 6 parameters
kosmo integrations:schema lob.lob_create_letter --json | Parameter | Type | Required | Description |
|---|---|---|---|
to | string | yes | Recipient — an address ID (e.g., "adr_...") or an inline address object. |
from | string | no | Sender — an address ID or inline address object. Optional if a default return address is configured. |
description | string | no | An internal description for the letter (not printed on the letter itself). |
file | string | yes | HTML string or template ID for the letter content (e.g., "<html>...</html>" or "tmpl_..."). |
color | boolean | no | Print in color (default: true). Set to false for black & white. |
double_sided | boolean | no | Print double-sided (default: true). Set to false for single-sided. |
lob.lob_list_postcards 2 parameters
kosmo integrations:schema lob.lob_list_postcards --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Number of results per page (default: 10, max: 100). |
offset | integer | no | Number of results to skip for pagination (default: 0). |
lob.lob_get_postcard 1 parameters
kosmo integrations:schema lob.lob_get_postcard --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The postcard ID (e.g., "psc_abcdef123456"). |
lob.lob_create_postcard 5 parameters
kosmo integrations:schema lob.lob_create_postcard --json | Parameter | Type | Required | Description |
|---|---|---|---|
to | string | yes | Recipient — an address ID (e.g., "adr_...") or an inline address object (name, address_line1, city, state, zip). |
from | string | no | Sender — an address ID or inline address object. Optional if a default return address is configured. |
description | string | no | An internal description for the postcard (not printed on the postcard itself). |
front | string | yes | HTML string or template ID for the front of the postcard (e.g., "<html>...</html>" or "tmpl_..."). |
back | string | yes | HTML string or template ID for the back of the postcard. |
lob.lob_get_current_user 0 parameters
kosmo integrations:schema lob.lob_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.