KosmoKrator

sales

BigCommerce Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

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

Agent-Facing Lua Docs

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

BigCommerce — Lua API Reference

list_products

List products from the BigCommerce catalog with filtering and pagination.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of products per page (default: 50, max: 250)
pageintegernoPage number for pagination (default: 1)
keywordstringnoFilter by keyword (matches name or SKU)
includestringnoComma-separated related resources (e.g., “variants,images,custom_fields”)
categoriesstringnoComma-separated category IDs to filter by
is_visiblebooleannoFilter by visibility
sortstringnoSort field (“name”, “price”, “date_created”, “id”)
directionstringnoSort direction: “asc” or “desc”

Example

local result = app.integrations.bigcommerce.list_products({
  limit = 10,
  include = "variants,images",
  sort = "price",
  direction = "desc"
})

for _, product in ipairs(result) do
  print(product.name .. " - $" .. product.price)
end

get_product

Get a single product by ID with full details.

Parameters

NameTypeRequiredDescription
idintegeryesThe product ID
includestringnoComma-separated related resources

Example

local product = app.integrations.bigcommerce.get_product({
  id = 123,
  include = "variants,images,custom_fields"
})

print(product.name)
print("Price: $" .. product.price)
print("SKU: " .. (product.sku or "N/A"))

create_product

Create a new product in the BigCommerce catalog.

Parameters

NameTypeRequiredDescription
namestringyesProduct name
pricenumberyesBase price (e.g., 29.99)
typestringyesProduct type: “physical”, “digital”, or “giftcertificate”
skustringnoUnique SKU
descriptionstringnoProduct description (HTML allowed)
weightnumbernoProduct weight (required for physical products)
categoriesarraynoArray of category IDs
brand_idintegernoBrand ID
inventory_trackingstringno”none”, “product”, or “variant”
inventory_levelintegernoStock level
is_visiblebooleannoStorefront visibility (default: true)
custom_fieldsarraynoArray of {name, value} objects
imagesarraynoArray of {image_url} objects

Example

local product = app.integrations.bigcommerce.create_product({
  name = "Premium Widget",
  price = 49.99,
  type = "physical",
  sku = "WDG-PREM-001",
  weight = 0.75,
  categories = {1, 5},
  inventory_tracking = "product",
  inventory_level = 100,
  description = "<p>A premium quality widget.</p>"
})

print("Created product ID: " .. product.id)

list_orders

List orders with filtering and pagination.

Parameters

NameTypeRequiredDescription
limitintegernoOrders per page (default: 50, max: 250)
pageintegernoPage number (default: 1)
status_idintegernoFilter by status (0=Awaiting, 1=Awaiting Shipment, 2=Shipped, 3=Completed, 4=Cancelled)
customer_idintegernoFilter by customer
min_date_createdstringnoMinimum date (ISO 8601)
max_date_createdstringnoMaximum date (ISO 8601)
sortstringnoSort field
directionstringnoSort direction: “asc” or “desc”

Example

local orders = app.integrations.bigcommerce.list_orders({
  status_id = 2,
  limit = 10,
  sort = "date_created",
  direction = "desc"
})

for _, order in ipairs(orders) do
  print("Order #" .. order.id .. " - $" .. order.total_inc_tax)
end

get_order

Get a single order by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe order ID

Example

local order = app.integrations.bigcommerce.get_order({
  id = 456
})

print("Order #" .. order.id)
print("Status: " .. order.status)
print("Total: $" .. order.total_inc_tax)

list_customers

List customers with filtering and pagination.

Parameters

NameTypeRequiredDescription
limitintegernoCustomers per page (default: 50)
pageintegernoPage number (default: 1)
namestringnoFilter by name
emailstringnoFilter by email
sortstringnoSort field
directionstringnoSort direction

Example

local customers = app.integrations.bigcommerce.list_customers({
  limit = 10,
  sort = "date_created",
  direction = "desc"
})

for _, customer in ipairs(customers) do
  print(customer.first_name .. " " .. customer.last_name .. " - " .. customer.email)
end

get_current_user

Get storefront status and verify the API connection.

Parameters

None.

Example

local status = app.integrations.bigcommerce.get_current_user({})

print("Store status: " .. tostring(status))

Multi-Account Usage

If you have multiple BigCommerce stores configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.bigcommerce.list_products({limit = 10})

-- Explicit default (portable across setups)
app.integrations.bigcommerce.default.list_products({limit = 10})

-- Named accounts (e.g., different stores)
app.integrations.bigcommerce.us_store.list_products({limit = 10})
app.integrations.bigcommerce.eu_store.list_products({limit = 10})

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

Raw agent markdown
# BigCommerce — Lua API Reference

## list_products

List products from the BigCommerce catalog with filtering and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of products per page (default: 50, max: 250) |
| `page` | integer | no | Page number for pagination (default: 1) |
| `keyword` | string | no | Filter by keyword (matches name or SKU) |
| `include` | string | no | Comma-separated related resources (e.g., "variants,images,custom_fields") |
| `categories` | string | no | Comma-separated category IDs to filter by |
| `is_visible` | boolean | no | Filter by visibility |
| `sort` | string | no | Sort field ("name", "price", "date_created", "id") |
| `direction` | string | no | Sort direction: "asc" or "desc" |

### Example

```lua
local result = app.integrations.bigcommerce.list_products({
  limit = 10,
  include = "variants,images",
  sort = "price",
  direction = "desc"
})

for _, product in ipairs(result) do
  print(product.name .. " - $" .. product.price)
end
```

---

## get_product

Get a single product by ID with full details.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The product ID |
| `include` | string | no | Comma-separated related resources |

### Example

```lua
local product = app.integrations.bigcommerce.get_product({
  id = 123,
  include = "variants,images,custom_fields"
})

print(product.name)
print("Price: $" .. product.price)
print("SKU: " .. (product.sku or "N/A"))
```

---

## create_product

Create a new product in the BigCommerce catalog.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Product name |
| `price` | number | yes | Base price (e.g., 29.99) |
| `type` | string | yes | Product type: "physical", "digital", or "giftcertificate" |
| `sku` | string | no | Unique SKU |
| `description` | string | no | Product description (HTML allowed) |
| `weight` | number | no | Product weight (required for physical products) |
| `categories` | array | no | Array of category IDs |
| `brand_id` | integer | no | Brand ID |
| `inventory_tracking` | string | no | "none", "product", or "variant" |
| `inventory_level` | integer | no | Stock level |
| `is_visible` | boolean | no | Storefront visibility (default: true) |
| `custom_fields` | array | no | Array of {name, value} objects |
| `images` | array | no | Array of {image_url} objects |

### Example

```lua
local product = app.integrations.bigcommerce.create_product({
  name = "Premium Widget",
  price = 49.99,
  type = "physical",
  sku = "WDG-PREM-001",
  weight = 0.75,
  categories = {1, 5},
  inventory_tracking = "product",
  inventory_level = 100,
  description = "<p>A premium quality widget.</p>"
})

print("Created product ID: " .. product.id)
```

---

## list_orders

List orders with filtering and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Orders per page (default: 50, max: 250) |
| `page` | integer | no | Page number (default: 1) |
| `status_id` | integer | no | Filter by status (0=Awaiting, 1=Awaiting Shipment, 2=Shipped, 3=Completed, 4=Cancelled) |
| `customer_id` | integer | no | Filter by customer |
| `min_date_created` | string | no | Minimum date (ISO 8601) |
| `max_date_created` | string | no | Maximum date (ISO 8601) |
| `sort` | string | no | Sort field |
| `direction` | string | no | Sort direction: "asc" or "desc" |

### Example

```lua
local orders = app.integrations.bigcommerce.list_orders({
  status_id = 2,
  limit = 10,
  sort = "date_created",
  direction = "desc"
})

for _, order in ipairs(orders) do
  print("Order #" .. order.id .. " - $" .. order.total_inc_tax)
end
```

---

## get_order

Get a single order by ID.

### Parameters

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

### Example

```lua
local order = app.integrations.bigcommerce.get_order({
  id = 456
})

print("Order #" .. order.id)
print("Status: " .. order.status)
print("Total: $" .. order.total_inc_tax)
```

---

## list_customers

List customers with filtering and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Customers per page (default: 50) |
| `page` | integer | no | Page number (default: 1) |
| `name` | string | no | Filter by name |
| `email` | string | no | Filter by email |
| `sort` | string | no | Sort field |
| `direction` | string | no | Sort direction |

### Example

```lua
local customers = app.integrations.bigcommerce.list_customers({
  limit = 10,
  sort = "date_created",
  direction = "desc"
})

for _, customer in ipairs(customers) do
  print(customer.first_name .. " " .. customer.last_name .. " - " .. customer.email)
end
```

---

## get_current_user

Get storefront status and verify the API connection.

### Parameters

None.

### Example

```lua
local status = app.integrations.bigcommerce.get_current_user({})

print("Store status: " .. tostring(status))
```

---

## Multi-Account Usage

If you have multiple BigCommerce stores configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.bigcommerce.list_products({limit = 10})

-- Explicit default (portable across setups)
app.integrations.bigcommerce.default.list_products({limit = 10})

-- Named accounts (e.g., different stores)
app.integrations.bigcommerce.us_store.list_products({limit = 10})
app.integrations.bigcommerce.eu_store.list_products({limit = 10})
```

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

Metadata-Derived Lua Example

local result = app.integrations.bigcommerce.bigcommerce_list_products({
  limit = 1,
  page = 1,
  keyword = "example_keyword",
  include = "example_include",
  categories = "example_categories",
  is_visible = true,
  sort = "example_sort",
  direction = "example_direction"
})
print(result)

Functions

bigcommerce_list_products

List products from the BigCommerce catalog. Supports pagination, filtering by name or SKU, and including variants/images.

Operation
Read read
Full name
bigcommerce.bigcommerce_list_products
ParameterTypeRequiredDescription
limit integer no Number of products to return per page (default: 50, max: 250).
page integer no Page number for pagination (default: 1).
keyword string no Filter products by keyword (matches name or SKU).
include string no Comma-separated related resources to include (e.g., "variants,images,custom_fields").
categories string no Comma-separated category IDs to filter by.
is_visible boolean no Filter by visibility (true for visible, false for hidden).
sort string no Sort field (e.g., "name", "price", "date_created", "id").
direction string no Sort direction: "asc" or "desc".

bigcommerce_get_product

Get a single product from the BigCommerce catalog by its ID. Returns full product details.

Operation
Read read
Full name
bigcommerce.bigcommerce_get_product
ParameterTypeRequiredDescription
id integer yes The product ID.
include string no Comma-separated related resources to include (e.g., "variants,images,custom_fields,bulk_pricing_rules").

bigcommerce_create_product

Create a new product in the BigCommerce catalog. Requires name, price, and type (physical, digital, or giftcertificate).

Operation
Write write
Full name
bigcommerce.bigcommerce_create_product
ParameterTypeRequiredDescription
name string yes Product name.
price number yes Base price (e.g., 29.99). Use 0 for free products.
type string yes Product type: "physical", "digital", or "giftcertificate".
sku string no Unique SKU for the product.
description string no Product description (HTML allowed).
weight number no Weight of the product (required for physical products).
categories array no Array of category IDs to assign the product to.
brand_id integer no The brand ID to assign.
inventory_tracking string no Inventory tracking: "none", "product", or "variant".
inventory_level integer no Current stock level (when inventory_tracking is "product").
is_visible boolean no Whether the product is visible on the storefront (default: true).
custom_fields array no Array of custom field objects with "name" and "value" keys.
images array no Array of image objects with "image_url" key.

bigcommerce_list_orders

List orders from the BigCommerce store. Supports filtering by status, customer, and pagination.

Operation
Read read
Full name
bigcommerce.bigcommerce_list_orders
ParameterTypeRequiredDescription
limit integer no Number of orders per page (default: 50, max: 250).
page integer no Page number for pagination (default: 1).
status_id integer no Filter by order status ID (0=Awaiting Fulfillment, 1=Awaiting Shipment, 2=Shipped, 3=Completed, 4=Cancelled, etc.).
customer_id integer no Filter by customer ID.
min_date_created string no Minimum date created (ISO 8601, e.g., "2025-01-01").
max_date_created string no Maximum date created (ISO 8601, e.g., "2025-12-31").
sort string no Sort field (e.g., "date_created", "total_inc_tax", "id").
direction string no Sort direction: "asc" or "desc".

bigcommerce_get_order

Get a single order from the BigCommerce store by its ID. Returns full order details including line items and totals.

Operation
Read read
Full name
bigcommerce.bigcommerce_get_order
ParameterTypeRequiredDescription
id integer yes The order ID.

bigcommerce_list_customers

List customers from the BigCommerce store. Supports filtering by name or email and pagination.

Operation
Read read
Full name
bigcommerce.bigcommerce_list_customers
ParameterTypeRequiredDescription
limit integer no Number of customers per page (default: 50, max: 250).
page integer no Page number for pagination (default: 1).
name string no Filter by customer name.
email string no Filter by email address.
sort string no Sort field (e.g., "name", "email", "date_created", "id").
direction string no Sort direction: "asc" or "desc".

bigcommerce_get_current_user

Get the current user / storefront status from BigCommerce. Use this to verify the API connection is working.

Operation
Read read
Full name
bigcommerce.bigcommerce_get_current_user
ParameterTypeRequiredDescription
No parameters.