KosmoKrator

ecommerce

Etsy Lua API for KosmoKrator Agents

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

6 functions 5 read 1 write Manual OAuth token auth

Lua Namespace

Agents call this integration through app.integrations.etsy.*. Use lua_read_doc("integrations.etsy") 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.

Etsy — Lua API Reference

list_listings

List all listings in the Etsy shop with optional filtering and pagination.

Parameters

NameTypeRequiredDescription
statestringnoFilter by state: "active", "draft", "inactive", "expired", "sold_out"
limitintegernoResults per page (1–100, default: 25)
offsetintegernoPagination offset from previous response

Examples

-- List active listings
local result = app.integrations.etsy.list_listings({state = "active"})

-- Paginate through draft listings
local result = app.integrations.etsy.list_listings({
  state = "draft",
  limit = 50,
  offset = 0
})

get_listing

Get full details for a specific listing by ID.

Parameters

NameTypeRequiredDescription
listing_idintegeryesThe Etsy listing ID

Examples

local result = app.integrations.etsy.get_listing({listing_id = 1234567890})
print(result.title .. " - $" .. result.price.amount)

create_listing

Create a new listing in the Etsy shop.

Parameters

NameTypeRequiredDescription
titlestringyesListing title (max 140 characters)
descriptionstringyesListing description
pricenumberyesPrice (must be > 0)
quantityintegeryesStock quantity (must be ≥ 1)
shipping_profile_idintegeryesShipping profile to assign
taxonomy_idintegernoEtsy category taxonomy ID
tagsarraynoUp to 13 tags (max 20 chars each)
who_madestringno"i_did", "collective", or "someone_else"
when_madestringnoe.g. "made_to_order", "2020_2024"
is_supplybooleannoSupply (true) or finished product (false)

Examples

local result = app.integrations.etsy.create_listing({
  title = "Handmade Ceramic Mug",
  description = "A beautiful hand-thrown ceramic mug with a unique glaze.",
  price = 28.00,
  quantity = 10,
  shipping_profile_id = 567890,
  who_made = "i_did",
  when_made = "made_to_order",
  is_supply = false,
  tags = {"ceramic", "mug", "handmade", "pottery"}
})
print("Created listing: " .. result.listing_id)

list_orders

List orders (receipts) for the Etsy shop with pagination.

Parameters

NameTypeRequiredDescription
limitintegernoResults per page (1–100, default: 25)
offsetintegernoPagination offset
was_paidbooleannoFilter to paid (true) or unpaid (false)
was_shippedbooleannoFilter to shipped (true) or unshipped (false)

Examples

-- Get recent paid, unshipped orders
local result = app.integrations.etsy.list_orders({
  was_paid = true,
  was_shipped = false,
  limit = 10
})

for _, order in ipairs(result.results) do
  print("Order " .. order.receipt_id .. ": " .. order.total .. " from " .. order.buyer_id)
end

get_listing_inventory

Get the inventory (products, offerings, pricing) for a listing.

Parameters

NameTypeRequiredDescription
listing_idintegeryesThe Etsy listing ID

Examples

local result = app.integrations.etsy.get_listing_inventory({listing_id = 1234567890})
for _, product in ipairs(result.products) do
  print("Product: " .. product.product_id .. " - " .. product.offering_id)
end

get_current_user

Get the currently authenticated Etsy user profile.

Parameters

None.

Examples

local result = app.integrations.etsy.get_current_user({})
print("User ID: " .. result.user_id)

Multi-Account Usage

If you have multiple Etsy shops configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.etsy.list_listings({state = "active"})

-- Explicit default (portable across setups)
app.integrations.etsy.default.list_listings({state = "active"})

-- Named accounts
app.integrations.etsy.my_shop.list_listings({state = "active"})
app.integrations.etsy.other_shop.list_listings({state = "active"})

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


Common Workflows

Check unshipped orders and get listing details

local orders = app.integrations.etsy.list_orders({was_paid = true, was_shipped = false})

for _, order in ipairs(orders.results) do
  for _, item in ipairs(order.transactions) do
    local listing = app.integrations.etsy.get_listing({listing_id = item.listing_id})
    print("Order " .. order.receipt_id .. ": " .. listing.title .. " x" .. item.quantity)
  end
end

Create a listing and check its inventory

local listing = app.integrations.etsy.create_listing({
  title = "New Product",
  description = "Product description here.",
  price = 19.99,
  quantity = 5,
  shipping_profile_id = 12345
})

local inventory = app.integrations.etsy.get_listing_inventory({listing_id = listing.listing_id})
print("Created with " .. #inventory.products .. " product variants")
Raw agent markdown
# Etsy — Lua API Reference

## list_listings

List all listings in the Etsy shop with optional filtering and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `state` | string | no | Filter by state: `"active"`, `"draft"`, `"inactive"`, `"expired"`, `"sold_out"` |
| `limit` | integer | no | Results per page (1–100, default: 25) |
| `offset` | integer | no | Pagination offset from previous response |

### Examples

```lua
-- List active listings
local result = app.integrations.etsy.list_listings({state = "active"})

-- Paginate through draft listings
local result = app.integrations.etsy.list_listings({
  state = "draft",
  limit = 50,
  offset = 0
})
```

---

## get_listing

Get full details for a specific listing by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `listing_id` | integer | yes | The Etsy listing ID |

### Examples

```lua
local result = app.integrations.etsy.get_listing({listing_id = 1234567890})
print(result.title .. " - $" .. result.price.amount)
```

---

## create_listing

Create a new listing in the Etsy shop.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `title` | string | yes | Listing title (max 140 characters) |
| `description` | string | yes | Listing description |
| `price` | number | yes | Price (must be > 0) |
| `quantity` | integer | yes | Stock quantity (must be ≥ 1) |
| `shipping_profile_id` | integer | yes | Shipping profile to assign |
| `taxonomy_id` | integer | no | Etsy category taxonomy ID |
| `tags` | array | no | Up to 13 tags (max 20 chars each) |
| `who_made` | string | no | `"i_did"`, `"collective"`, or `"someone_else"` |
| `when_made` | string | no | e.g. `"made_to_order"`, `"2020_2024"` |
| `is_supply` | boolean | no | Supply (true) or finished product (false) |

### Examples

```lua
local result = app.integrations.etsy.create_listing({
  title = "Handmade Ceramic Mug",
  description = "A beautiful hand-thrown ceramic mug with a unique glaze.",
  price = 28.00,
  quantity = 10,
  shipping_profile_id = 567890,
  who_made = "i_did",
  when_made = "made_to_order",
  is_supply = false,
  tags = {"ceramic", "mug", "handmade", "pottery"}
})
print("Created listing: " .. result.listing_id)
```

---

## list_orders

List orders (receipts) for the Etsy shop with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Results per page (1–100, default: 25) |
| `offset` | integer | no | Pagination offset |
| `was_paid` | boolean | no | Filter to paid (`true`) or unpaid (`false`) |
| `was_shipped` | boolean | no | Filter to shipped (`true`) or unshipped (`false`) |

### Examples

```lua
-- Get recent paid, unshipped orders
local result = app.integrations.etsy.list_orders({
  was_paid = true,
  was_shipped = false,
  limit = 10
})

for _, order in ipairs(result.results) do
  print("Order " .. order.receipt_id .. ": " .. order.total .. " from " .. order.buyer_id)
end
```

---

## get_listing_inventory

Get the inventory (products, offerings, pricing) for a listing.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `listing_id` | integer | yes | The Etsy listing ID |

### Examples

```lua
local result = app.integrations.etsy.get_listing_inventory({listing_id = 1234567890})
for _, product in ipairs(result.products) do
  print("Product: " .. product.product_id .. " - " .. product.offering_id)
end
```

---

## get_current_user

Get the currently authenticated Etsy user profile.

### Parameters

None.

### Examples

```lua
local result = app.integrations.etsy.get_current_user({})
print("User ID: " .. result.user_id)
```

---

## Multi-Account Usage

If you have multiple Etsy shops configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.etsy.list_listings({state = "active"})

-- Explicit default (portable across setups)
app.integrations.etsy.default.list_listings({state = "active"})

-- Named accounts
app.integrations.etsy.my_shop.list_listings({state = "active"})
app.integrations.etsy.other_shop.list_listings({state = "active"})
```

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

---

## Common Workflows

### Check unshipped orders and get listing details

```lua
local orders = app.integrations.etsy.list_orders({was_paid = true, was_shipped = false})

for _, order in ipairs(orders.results) do
  for _, item in ipairs(order.transactions) do
    local listing = app.integrations.etsy.get_listing({listing_id = item.listing_id})
    print("Order " .. order.receipt_id .. ": " .. listing.title .. " x" .. item.quantity)
  end
end
```

### Create a listing and check its inventory

```lua
local listing = app.integrations.etsy.create_listing({
  title = "New Product",
  description = "Product description here.",
  price = 19.99,
  quantity = 5,
  shipping_profile_id = 12345
})

local inventory = app.integrations.etsy.get_listing_inventory({listing_id = listing.listing_id})
print("Created with " .. #inventory.products .. " product variants")
```

Metadata-Derived Lua Example

local result = app.integrations.etsy.etsy_list_listings({
  state = "example_state",
  limit = 1,
  offset = 1
})
print(result)

Functions

etsy_list_listings

List all listings in the Etsy shop. Returns paginated results with optional state filtering (active, draft, inactive, expired).

Operation
Read read
Full name
etsy.etsy_list_listings
ParameterTypeRequiredDescription
state string no Filter listings by state. Defaults to "active" if not provided.
limit integer no Number of listings to return per page (1–100, default: 25).
offset integer no Offset for pagination — pass the offset from a previous response to get the next page.

etsy_get_listing

Get full details for a specific Etsy listing, including title, description, price, images, and state.

Operation
Read read
Full name
etsy.etsy_get_listing
ParameterTypeRequiredDescription
listing_id integer yes The Etsy listing ID.

etsy_create_listing

Create a new listing in the Etsy shop. Requires a title, description, price, quantity, and shipping profile ID.

Operation
Write write
Full name
etsy.etsy_create_listing
ParameterTypeRequiredDescription
title string yes Listing title (max 140 characters).
description string yes Listing description (max 500 characters for initial draft).
price number yes Listing price (must be greater than 0).
quantity integer yes Stock quantity (must be at least 1).
shipping_profile_id integer yes ID of the shipping profile to assign to this listing.
taxonomy_id integer no Etsy taxonomy (category) ID for the listing.
tags array no Tags for the listing (up to 13 tags, max 20 characters each).
who_made string no Who made this item. Defaults to "i_did" if not specified.
when_made string no When the item was made (e.g., "made_to_order", "2020_2024"). Defaults to "made_to_order".
is_supply boolean no Whether this listing is a supply (true) or a finished product (false).

etsy_list_orders

List orders (receipts) for the Etsy shop. Returns paginated order data including buyer info, items, and totals.

Operation
Read read
Full name
etsy.etsy_list_orders
ParameterTypeRequiredDescription
limit integer no Number of receipts to return per page (1–100, default: 25).
offset integer no Offset for pagination — pass the offset from a previous response to get the next page.
was_paid boolean no Filter to only paid receipts (true) or unpaid (false).
was_shipped boolean no Filter to only shipped receipts (true) or unshipped (false).

etsy_get_listing_inventory

Get the inventory (products, offerings, and pricing) for a specific Etsy listing.

Operation
Read read
Full name
etsy.etsy_get_listing_inventory
ParameterTypeRequiredDescription
listing_id integer yes The Etsy listing ID.

etsy_get_current_user

Get the profile of the currently authenticated Etsy user, including user ID and primary shop info.

Operation
Read read
Full name
etsy.etsy_get_current_user
ParameterTypeRequiredDescription
No parameters.