KosmoKrator

productivity

Etsy Lua API for KosmoKrator Agents

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

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.

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 Etsy workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.etsy.get_shop({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("etsy"))' --json
kosmo integrations:lua --eval 'print(docs.read("etsy.get_shop"))' --json

Workflow file

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

workflow.lua
local etsy = app.integrations.etsy
local result = etsy.get_shop({})

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.etsy, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.etsy.default.* or app.integrations.etsy.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Etsy, 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.

Etsy - Lua API Reference

Namespace: app.integrations.etsy

Use this integration for Etsy seller operations through Open API v3. Calls return the decoded Etsy response body with the integration’s request routing normalized around the configured shop ID. Etsy requires an OAuth bearer token for private seller operations and an app keystring in the x-api-key header.

Shop

get_shop

Get the configured shop profile.

local shop = app.integrations.etsy.get_shop({})
print(shop.shop_id)

list_shop_sections

List sections configured for the shop.

local sections = app.integrations.etsy.list_shop_sections({})

list_shipping_profiles

List shipping profiles available for listing creation and updates.

local profiles = app.integrations.etsy.list_shipping_profiles({})

Listings

list_listings

List shop listings.

ParameterTypeRequiredNotes
statestringnoCommon values include active, draft, inactive, expired, removed, and sold_out.
limitintegernoResults per page.
offsetintegernoPagination offset.
local listings = app.integrations.etsy.list_listings({
  state = "active",
  limit = 25,
  offset = 0
})

get_listing

Get one listing by ID.

local listing = app.integrations.etsy.get_listing({listing_id = 1234567890})

create_listing

Create a draft listing in the configured shop.

ParameterTypeRequiredNotes
titlestringyesListing title.
descriptionstringyesListing description.
pricenumberyesListing price.
quantityintegeryesInitial quantity.
shipping_profile_idintegeryesShipping profile ID.
taxonomy_idintegernoSeller taxonomy category ID.
tagsarraynoListing tags.
who_madestringnoExample: i_did.
when_madestringnoExample: made_to_order.
is_supplybooleannoWhether the listing is a supply.
local listing = app.integrations.etsy.create_listing({
  title = "Handmade Ceramic Mug",
  description = "A wheel-thrown mug with a blue glaze.",
  price = 28.00,
  quantity = 10,
  shipping_profile_id = 567890,
  taxonomy_id = 1234,
  who_made = "i_did",
  when_made = "made_to_order",
  is_supply = false,
  tags = {"ceramic", "mug"}
})

update_listing

Update listing fields.

local updated = app.integrations.etsy.update_listing({
  listing_id = 1234567890,
  data = {
    title = "Updated Ceramic Mug",
    state = "active",
    section_id = 222222
  }
})

delete_listing

Delete a listing from the configured shop.

local result = app.integrations.etsy.delete_listing({listing_id = 1234567890})

Images And Inventory

list_listing_images

List images attached to a listing.

local images = app.integrations.etsy.list_listing_images({listing_id = 1234567890})

upload_listing_image

Upload a local image file to a listing.

local image = app.integrations.etsy.upload_listing_image({
  listing_id = 1234567890,
  image_path = "/tmp/example-listing.jpg",
  fields = {
    rank = 1,
    alt_text = "Blue ceramic mug on a white table"
  }
})

get_listing_inventory

Get products, offerings, prices, quantities, and SKUs for a listing.

local inventory = app.integrations.etsy.get_listing_inventory({listing_id = 1234567890})

update_listing_inventory

Update listing inventory. Etsy expects products with nested offerings and property_values; include the *_on_property arrays when price, quantity, or SKU varies by property.

local inventory = app.integrations.etsy.update_listing_inventory({
  listing_id = 1234567890,
  data = {
    products = {
      {
        sku = "MUG-BLUE",
        offerings = {
          {price = 28.00, quantity = 10, is_enabled = true}
        },
        property_values = {}
      }
    },
    price_on_property = {},
    quantity_on_property = {},
    sku_on_property = {}
  }
})

Orders

list_orders

List shop receipts/orders.

ParameterTypeRequiredNotes
limitintegernoResults per page.
offsetintegernoPagination offset.
was_paidbooleannoFilter paid/unpaid receipts.
was_shippedbooleannoFilter shipped/unshipped receipts.
local orders = app.integrations.etsy.list_orders({
  was_paid = true,
  was_shipped = false,
  limit = 10
})

get_receipt

Get one receipt/order.

local receipt = app.integrations.etsy.get_receipt({receipt_id = 987654321})

list_receipt_transactions

List transaction line items for a receipt.

local items = app.integrations.etsy.list_receipt_transactions({
  receipt_id = 987654321
})

Taxonomy And User

list_seller_taxonomy_nodes

List seller taxonomy nodes used for listing taxonomy_id values.

local taxonomy = app.integrations.etsy.list_seller_taxonomy_nodes({})

get_current_user

Get the authenticated Etsy user.

local user = app.integrations.etsy.get_current_user({})

Generic API Helpers

Use these only for documented Etsy Open API endpoints that do not have a dedicated tool yet. path must be relative to the configured /v3/application base URL; absolute URLs are rejected.

local result = app.integrations.etsy.api_get({
  path = "/seller-taxonomy/nodes",
  params = {}
})

local created = app.integrations.etsy.api_post({
  path = "/shops/12345678/listings",
  body = {
    title = "Draft Listing",
    description = "Safe example",
    price = 12.00,
    quantity = 1,
    shipping_profile_id = 111111
  }
})

local updated = app.integrations.etsy.api_put({
  path = "/listings/1234567890/inventory",
  body = {products = {}}
})

local deleted = app.integrations.etsy.api_delete({
  path = "/shops/12345678/listings/1234567890"
})

Multi-Account Usage

app.integrations.etsy.list_listings({state = "active"})
app.integrations.etsy.default.list_listings({state = "active"})
app.integrations.etsy.my_shop.list_orders({was_paid = true})

The function names are identical across accounts; only credentials and shop IDs differ.

Raw agent markdown
# Etsy - Lua API Reference

Namespace: `app.integrations.etsy`

Use this integration for Etsy seller operations through Open API v3. Calls return the decoded Etsy response body with the integration's request routing normalized around the configured shop ID. Etsy requires an OAuth bearer token for private seller operations and an app keystring in the `x-api-key` header.

## Shop

### get_shop

Get the configured shop profile.

```lua
local shop = app.integrations.etsy.get_shop({})
print(shop.shop_id)
```

### list_shop_sections

List sections configured for the shop.

```lua
local sections = app.integrations.etsy.list_shop_sections({})
```

### list_shipping_profiles

List shipping profiles available for listing creation and updates.

```lua
local profiles = app.integrations.etsy.list_shipping_profiles({})
```

## Listings

### list_listings

List shop listings.

| Parameter | Type | Required | Notes |
|-----------|------|----------|-------|
| `state` | string | no | Common values include `active`, `draft`, `inactive`, `expired`, `removed`, and `sold_out`. |
| `limit` | integer | no | Results per page. |
| `offset` | integer | no | Pagination offset. |

```lua
local listings = app.integrations.etsy.list_listings({
  state = "active",
  limit = 25,
  offset = 0
})
```

### get_listing

Get one listing by ID.

```lua
local listing = app.integrations.etsy.get_listing({listing_id = 1234567890})
```

### create_listing

Create a draft listing in the configured shop.

| Parameter | Type | Required | Notes |
|-----------|------|----------|-------|
| `title` | string | yes | Listing title. |
| `description` | string | yes | Listing description. |
| `price` | number | yes | Listing price. |
| `quantity` | integer | yes | Initial quantity. |
| `shipping_profile_id` | integer | yes | Shipping profile ID. |
| `taxonomy_id` | integer | no | Seller taxonomy category ID. |
| `tags` | array | no | Listing tags. |
| `who_made` | string | no | Example: `i_did`. |
| `when_made` | string | no | Example: `made_to_order`. |
| `is_supply` | boolean | no | Whether the listing is a supply. |

```lua
local listing = app.integrations.etsy.create_listing({
  title = "Handmade Ceramic Mug",
  description = "A wheel-thrown mug with a blue glaze.",
  price = 28.00,
  quantity = 10,
  shipping_profile_id = 567890,
  taxonomy_id = 1234,
  who_made = "i_did",
  when_made = "made_to_order",
  is_supply = false,
  tags = {"ceramic", "mug"}
})
```

### update_listing

Update listing fields.

```lua
local updated = app.integrations.etsy.update_listing({
  listing_id = 1234567890,
  data = {
    title = "Updated Ceramic Mug",
    state = "active",
    section_id = 222222
  }
})
```

### delete_listing

Delete a listing from the configured shop.

```lua
local result = app.integrations.etsy.delete_listing({listing_id = 1234567890})
```

## Images And Inventory

### list_listing_images

List images attached to a listing.

```lua
local images = app.integrations.etsy.list_listing_images({listing_id = 1234567890})
```

### upload_listing_image

Upload a local image file to a listing.

```lua
local image = app.integrations.etsy.upload_listing_image({
  listing_id = 1234567890,
  image_path = "/tmp/example-listing.jpg",
  fields = {
    rank = 1,
    alt_text = "Blue ceramic mug on a white table"
  }
})
```

### get_listing_inventory

Get products, offerings, prices, quantities, and SKUs for a listing.

```lua
local inventory = app.integrations.etsy.get_listing_inventory({listing_id = 1234567890})
```

### update_listing_inventory

Update listing inventory. Etsy expects `products` with nested `offerings` and `property_values`; include the `*_on_property` arrays when price, quantity, or SKU varies by property.

```lua
local inventory = app.integrations.etsy.update_listing_inventory({
  listing_id = 1234567890,
  data = {
    products = {
      {
        sku = "MUG-BLUE",
        offerings = {
          {price = 28.00, quantity = 10, is_enabled = true}
        },
        property_values = {}
      }
    },
    price_on_property = {},
    quantity_on_property = {},
    sku_on_property = {}
  }
})
```

## Orders

### list_orders

List shop receipts/orders.

| Parameter | Type | Required | Notes |
|-----------|------|----------|-------|
| `limit` | integer | no | Results per page. |
| `offset` | integer | no | Pagination offset. |
| `was_paid` | boolean | no | Filter paid/unpaid receipts. |
| `was_shipped` | boolean | no | Filter shipped/unshipped receipts. |

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

### get_receipt

Get one receipt/order.

```lua
local receipt = app.integrations.etsy.get_receipt({receipt_id = 987654321})
```

### list_receipt_transactions

List transaction line items for a receipt.

```lua
local items = app.integrations.etsy.list_receipt_transactions({
  receipt_id = 987654321
})
```

## Taxonomy And User

### list_seller_taxonomy_nodes

List seller taxonomy nodes used for listing `taxonomy_id` values.

```lua
local taxonomy = app.integrations.etsy.list_seller_taxonomy_nodes({})
```

### get_current_user

Get the authenticated Etsy user.

```lua
local user = app.integrations.etsy.get_current_user({})
```

## Generic API Helpers

Use these only for documented Etsy Open API endpoints that do not have a dedicated tool yet. `path` must be relative to the configured `/v3/application` base URL; absolute URLs are rejected.

```lua
local result = app.integrations.etsy.api_get({
  path = "/seller-taxonomy/nodes",
  params = {}
})

local created = app.integrations.etsy.api_post({
  path = "/shops/12345678/listings",
  body = {
    title = "Draft Listing",
    description = "Safe example",
    price = 12.00,
    quantity = 1,
    shipping_profile_id = 111111
  }
})

local updated = app.integrations.etsy.api_put({
  path = "/listings/1234567890/inventory",
  body = {products = {}}
})

local deleted = app.integrations.etsy.api_delete({
  path = "/shops/12345678/listings/1234567890"
})
```

## Multi-Account Usage

```lua
app.integrations.etsy.list_listings({state = "active"})
app.integrations.etsy.default.list_listings({state = "active"})
app.integrations.etsy.my_shop.list_orders({was_paid = true})
```

The function names are identical across accounts; only credentials and shop IDs differ.
Metadata-derived Lua example
local result = app.integrations.etsy.get_shop({})
print(result)

Functions

get_shop Read

Get configured Etsy shop profile.

Lua path
app.integrations.etsy.get_shop
Full name
etsy.etsy_get_shop
ParameterTypeRequiredDescription
No parameters.
list_listings Read

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

Lua path
app.integrations.etsy.list_listings
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.
get_listing Read

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

Lua path
app.integrations.etsy.get_listing
Full name
etsy.etsy_get_listing
ParameterTypeRequiredDescription
listing_id integer yes The Etsy listing ID.
create_listing Write

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

Lua path
app.integrations.etsy.create_listing
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).
update_listing Write

Update a listing.

Lua path
app.integrations.etsy.update_listing
Full name
etsy.etsy_update_listing
ParameterTypeRequiredDescription
No parameters.
delete_listing Write

Delete a listing.

Lua path
app.integrations.etsy.delete_listing
Full name
etsy.etsy_delete_listing
ParameterTypeRequiredDescription
No parameters.
list_listing_images Read

List listing images.

Lua path
app.integrations.etsy.list_listing_images
Full name
etsy.etsy_list_listing_images
ParameterTypeRequiredDescription
No parameters.
upload_listing_image Write

Upload a listing image.

Lua path
app.integrations.etsy.upload_listing_image
Full name
etsy.etsy_upload_listing_image
ParameterTypeRequiredDescription
No parameters.
get_listing_inventory Read

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

Lua path
app.integrations.etsy.get_listing_inventory
Full name
etsy.etsy_get_listing_inventory
ParameterTypeRequiredDescription
listing_id integer yes The Etsy listing ID.
update_listing_inventory Write

Update listing inventory.

Lua path
app.integrations.etsy.update_listing_inventory
Full name
etsy.etsy_update_listing_inventory
ParameterTypeRequiredDescription
No parameters.
list_orders Read

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

Lua path
app.integrations.etsy.list_orders
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).
get_receipt Read

Get one receipt/order.

Lua path
app.integrations.etsy.get_receipt
Full name
etsy.etsy_get_receipt
ParameterTypeRequiredDescription
No parameters.
list_receipt_transactions Read

List receipt line items.

Lua path
app.integrations.etsy.list_receipt_transactions
Full name
etsy.etsy_list_receipt_transactions
ParameterTypeRequiredDescription
No parameters.
list_shop_sections Read

List shop sections.

Lua path
app.integrations.etsy.list_shop_sections
Full name
etsy.etsy_list_shop_sections
ParameterTypeRequiredDescription
No parameters.
list_shipping_profiles Read

List shop shipping profiles.

Lua path
app.integrations.etsy.list_shipping_profiles
Full name
etsy.etsy_list_shipping_profiles
ParameterTypeRequiredDescription
No parameters.
list_seller_taxonomy_nodes Read

List seller taxonomy nodes.

Lua path
app.integrations.etsy.list_seller_taxonomy_nodes
Full name
etsy.etsy_list_seller_taxonomy_nodes
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

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

Lua path
app.integrations.etsy.get_current_user
Full name
etsy.etsy_get_current_user
ParameterTypeRequiredDescription
No parameters.
api_get Read

Call an Etsy GET endpoint.

Lua path
app.integrations.etsy.api_get
Full name
etsy.etsy_api_get
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call an Etsy POST endpoint.

Lua path
app.integrations.etsy.api_post
Full name
etsy.etsy_api_post
ParameterTypeRequiredDescription
No parameters.
api_put Write

Call an Etsy PUT endpoint.

Lua path
app.integrations.etsy.api_put
Full name
etsy.etsy_api_put
ParameterTypeRequiredDescription
No parameters.
api_delete Write

Call an Etsy DELETE endpoint.

Lua path
app.integrations.etsy.api_delete
Full name
etsy.etsy_api_delete
ParameterTypeRequiredDescription
No parameters.