KosmoKrator

data

ShipBob Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the ShipBob KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.shipbob.*. Use lua_read_doc("integrations.shipbob") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic ShipBob workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.shipbob.list_orders({page = 1, limit = 1, status = "example_status"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("shipbob"))' --json
kosmo integrations:lua --eval 'print(docs.read("shipbob.list_orders"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local shipbob = app.integrations.shipbob
local result = shipbob.list_orders({page = 1, limit = 1, status = "example_status"})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.shipbob, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.shipbob.default.* or app.integrations.shipbob.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need ShipBob, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

ShipBob — Lua API Reference

list_orders

List fulfillment orders with pagination and optional status filtering.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 25, max: 100)
statusstringnoFilter by status: pending, processing, fulfilled, cancelled

Examples

-- List pending orders
local result = app.integrations.shipbob.list_orders({
  status = "pending",
  limit = 10
})

for _, order in ipairs(result) do
  print("Order #" .. order.id .. " - " .. order.status)
end

-- Paginate through all orders
local page2 = app.integrations.shipbob.list_orders({
  page = 2,
  limit = 50
})

get_order

Get details for a specific order by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe ShipBob order ID

Example

local order = app.integrations.shipbob.get_order({ id = 12345 })
print("Order #" .. order.id)
print("Status: " .. order.status)
print("Tracking: " .. (order.tracking_number or "N/A"))

create_order

Create a new fulfillment order.

Parameters

NameTypeRequiredDescription
receiving_notestringyesNote for the fulfillment center
productsarrayyesList of product line items (each with id and quantity)
shipping_methodstringnoShipping method: ground, expedited, overnight, etc.

Example

local order = app.integrations.shipbob.create_order({
  receiving_note = "Priority shipment — handle with care",
  products = {
    { id = 101, quantity = 2 },
    { id = 205, quantity = 1 }
  },
  shipping_method = "expedited"
})

print("Created order #" .. order.id)

list_products

List products in your ShipBob inventory.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.shipbob.list_products({
  page = 1,
  limit = 50
})

for _, product in ipairs(result) do
  print(product.name .. " (SKU: " .. product.sku .. ") — " .. product.quantity .. " in stock")
end

get_product

Get details for a specific product by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe ShipBob product ID

Example

local product = app.integrations.shipbob.get_product({ id = 678 })
print(product.name .. " — " .. product.quantity .. " units available")

list_shipments

List shipments with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
limitintegernoResults per page (default: 25, max: 100)

Example

local result = app.integrations.shipbob.list_shipments({
  page = 1,
  limit = 25
})

for _, shipment in ipairs(result) do
  print("Shipment #" .. shipment.id .. " — " .. shipment.status .. " (" .. shipment.carrier .. ")")
end

get_current_user

Get the currently authenticated user profile.

Parameters

None.

Example

local user = app.integrations.shipbob.get_current_user({})
print("Logged in as: " .. user.email)

Multi-Account Usage

If you have multiple ShipBob accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.shipbob.list_orders({})

-- Explicit default (portable across setups)
app.integrations.shipbob.default.list_orders({})

-- Named accounts
app.integrations.shipbob.production.list_orders({})
app.integrations.shipbob.staging.list_orders({})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# ShipBob — Lua API Reference

## list_orders

List fulfillment orders with pagination and optional status filtering.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 25, max: 100) |
| `status` | string | no | Filter by status: `pending`, `processing`, `fulfilled`, `cancelled` |

### Examples

```lua
-- List pending orders
local result = app.integrations.shipbob.list_orders({
  status = "pending",
  limit = 10
})

for _, order in ipairs(result) do
  print("Order #" .. order.id .. " - " .. order.status)
end

-- Paginate through all orders
local page2 = app.integrations.shipbob.list_orders({
  page = 2,
  limit = 50
})
```

---

## get_order

Get details for a specific order by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The ShipBob order ID |

### Example

```lua
local order = app.integrations.shipbob.get_order({ id = 12345 })
print("Order #" .. order.id)
print("Status: " .. order.status)
print("Tracking: " .. (order.tracking_number or "N/A"))
```

---

## create_order

Create a new fulfillment order.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `receiving_note` | string | yes | Note for the fulfillment center |
| `products` | array | yes | List of product line items (each with `id` and `quantity`) |
| `shipping_method` | string | no | Shipping method: `ground`, `expedited`, `overnight`, etc. |

### Example

```lua
local order = app.integrations.shipbob.create_order({
  receiving_note = "Priority shipment — handle with care",
  products = {
    { id = 101, quantity = 2 },
    { id = 205, quantity = 1 }
  },
  shipping_method = "expedited"
})

print("Created order #" .. order.id)
```

---

## list_products

List products in your ShipBob inventory.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.shipbob.list_products({
  page = 1,
  limit = 50
})

for _, product in ipairs(result) do
  print(product.name .. " (SKU: " .. product.sku .. ") — " .. product.quantity .. " in stock")
end
```

---

## get_product

Get details for a specific product by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The ShipBob product ID |

### Example

```lua
local product = app.integrations.shipbob.get_product({ id = 678 })
print(product.name .. " — " .. product.quantity .. " units available")
```

---

## list_shipments

List shipments with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `limit` | integer | no | Results per page (default: 25, max: 100) |

### Example

```lua
local result = app.integrations.shipbob.list_shipments({
  page = 1,
  limit = 25
})

for _, shipment in ipairs(result) do
  print("Shipment #" .. shipment.id .. " — " .. shipment.status .. " (" .. shipment.carrier .. ")")
end
```

---

## get_current_user

Get the currently authenticated user profile.

### Parameters

None.

### Example

```lua
local user = app.integrations.shipbob.get_current_user({})
print("Logged in as: " .. user.email)
```

---

## Multi-Account Usage

If you have multiple ShipBob accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.shipbob.list_orders({})

-- Explicit default (portable across setups)
app.integrations.shipbob.default.list_orders({})

-- Named accounts
app.integrations.shipbob.production.list_orders({})
app.integrations.shipbob.staging.list_orders({})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.shipbob.list_orders({page = 1, limit = 1, status = "example_status"})
print(result)

Functions

list_orders Read

List fulfillment orders from ShipBob. Supports pagination and filtering by status (e.g. pending, fulfilled, cancelled).

Lua path
app.integrations.shipbob.list_orders
Full name
shipbob.shipbob_list_orders
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
limit integer no Number of orders per page (default: 25, max: 100).
status string no Filter by order status. Common values: pending, processing, fulfilled, cancelled.
get_order Read

Get details for a specific ShipBob order by ID, including line items, shipping address, and fulfillment status.

Lua path
app.integrations.shipbob.get_order
Full name
shipbob.shipbob_get_order
ParameterTypeRequiredDescription
id integer yes The ShipBob order ID.
create_order Write

Create a new fulfillment order in ShipBob. Provide product line items, a receiving note, and an optional shipping method.

Lua path
app.integrations.shipbob.create_order
Full name
shipbob.shipbob_create_order
ParameterTypeRequiredDescription
receiving_note string yes A note for the fulfillment center (e.g. "Handle with care" or "Priority shipment").
products array yes List of product line items. Each item should include product reference/ID and quantity. Example: [{"id": 123, "quantity": 2}]
shipping_method string no Desired shipping method (e.g. "ground", "expedited", "overnight"). Optional — ShipBob selects the best method if omitted.
list_products Read

List products in your ShipBob inventory. Supports pagination with page and limit parameters.

Lua path
app.integrations.shipbob.list_products
Full name
shipbob.shipbob_list_products
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
limit integer no Number of products per page (default: 25, max: 100).
get_product Read

Get details for a specific ShipBob product by ID, including SKU, inventory levels, and fulfillment info.

Lua path
app.integrations.shipbob.get_product
Full name
shipbob.shipbob_get_product
ParameterTypeRequiredDescription
id integer yes The ShipBob product ID.
list_shipments Read

List shipments from ShipBob. Supports pagination with page and limit parameters.

Lua path
app.integrations.shipbob.list_shipments
Full name
shipbob.shipbob_list_shipments
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
limit integer no Number of shipments per page (default: 25, max: 100).
get_current_user Read

Get the currently authenticated ShipBob user profile. Useful for verifying connectivity and account details.

Lua path
app.integrations.shipbob.get_current_user
Full name
shipbob.shipbob_get_current_user
ParameterTypeRequiredDescription
No parameters.