---
canonical_url: "https://docs.composio.dev/toolkits/commerce_layer"
markdown_url: "https://docs.composio.dev/toolkits/commerce_layer.md"
product: "platform"
version: null
last_updated: null
---

# Commerce Layer

Commerce Layer provides transactional commerce and analytics APIs for managing orders, inventory, pricing, customers, fulfillment, and related ecommerce operations.

- **Category:** commerce
- **Auth:** S2S_OAUTH2
- **Composio-managed OAuth available?** No
- **Tools:** 10
- **Triggers:** 0
- **Slug:** `COMMERCE_LAYER`
- **Version:** 00000000_00

## Tools

### Create Customer

**Slug:** `COMMERCE_LAYER_CREATE_CUSTOMER`

Create one Commerce Layer customer from an email and optional external-reference metadata. Use a unique email or reference for automation. This mutation is cleanly undoable with DELETE_CUSTOMER using the returned customer ID.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `email` | string | Yes | Customer email address. |
| `metadata` | object | No | Optional JSON metadata to store on the customer. |
| `reference` | string | No | External system reference for the customer. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Customer

**Slug:** `COMMERCE_LAYER_DELETE_CUSTOMER`

Permanently delete one Commerce Layer customer by exact ID. This irreversible operation requires explicit confirmation and is intended only for confirmed cleanup or erasure, never bulk deletion. Never infer or enumerate customer IDs; call GET_CUSTOMER first unless deleting a fixture created in the same workflow.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `customer_id` | string | Yes | Exact Commerce Layer customer resource ID to permanently delete. Call GET_CUSTOMER first unless deleting a fixture created in the same workflow. |
| `confirm_delete` | boolean | Yes | Must be true to confirm this irreversible deletion. This confirmation is validated locally and is not sent to Commerce Layer. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Customer

**Slug:** `COMMERCE_LAYER_GET_CUSTOMER`

Retrieve one customer by its Commerce Layer resource ID.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `customer_id` | string | Yes | Commerce Layer customer resource ID. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Order

**Slug:** `COMMERCE_LAYER_GET_ORDER`

Retrieve one Commerce Layer order by ID, optionally including customer, line-item, shipment, or return context.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `include` | array | No | Optional non-empty list of related resources to include: customer, line_items, shipments, or returns. Use only what the task needs. |
| `order_id` | string | Yes | Commerce Layer order resource ID. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Order Metric

**Slug:** `COMMERCE_LAYER_GET_ORDER_METRIC`

Compute one common order KPI over optional date, market, currency, and status filters using the Commerce Layer Metrics API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `metric` | string ("order_count" | "unique_customers" | "gross_revenue" | "net_revenue" | "average_order_value") | Yes | KPI to compute: order_count, unique_customers, gross_revenue, net_revenue, or average_order_value. |
| `date_to` | string | No | Optional inclusive UTC end timestamp in YYYY-MM-DDTHH:MM:SSZ format. |
| `statuses` | array | No | Optional non-empty list of order statuses: placed, approved, or cancelled. |
| `date_from` | string | No | Optional inclusive UTC start timestamp in YYYY-MM-DDTHH:MM:SSZ format. |
| `date_field` | string ("created_at" | "updated_at" | "approved_at" | "placed_at") | No | Order timestamp used by date_from and date_to: created_at, updated_at, approved_at, or placed_at. |
| `market_ids` | array | No | Optional non-empty list of Commerce Layer market IDs to include. |
| `currency_codes` | array | No | Optional non-empty list of three-letter ISO 4217 currency codes to include. Values are normalized to uppercase. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Customers

**Slug:** `COMMERCE_LAYER_LIST_CUSTOMERS`

Return one page of customers, optionally filtered by an exact email address.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `email` | string | No | Exact customer email to match; omit to list customers. |
| `sort_by` | string ("email" | "status" | "total_orders_count" | "created_at" | "updated_at" | "reference") | No | Optional customer field to sort by: email, status, total_orders_count, created_at, updated_at, or reference. |
| `page_size` | integer | No | Customers to return per page (1-25). |
| `next_cursor` | string | No | Opaque continuation cursor returned by a previous call; omit for the first page. |
| `sort_direction` | string ("ascending" | "descending") | No | Sort direction when sort_by is set: ascending or descending. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Orders

**Slug:** `COMMERCE_LAYER_LIST_ORDERS`

Return one page of orders, newest first by default, for operational review and follow-up by order ID.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sort_by` | string ("number" | "status" | "payment_status" | "fulfillment_status" | "currency_code" | "total_amount_cents" | "placed_at" | "approved_at" | "cancelled_at" | "created_at" | "updated_at") | No | Order field to sort by. Choose number, status, payment_status, fulfillment_status, currency_code, total_amount_cents, placed_at, approved_at, cancelled_at, created_at, or updated_at. |
| `page_size` | integer | No | Orders to return per page (1-25). |
| `next_cursor` | string | No | Opaque continuation cursor returned by a previous call; omit for the first page. |
| `sort_direction` | string ("ascending" | "descending") | No | Sort direction: ascending or descending. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List SKUs

**Slug:** `COMMERCE_LAYER_LIST_SKUS`

Return one page of catalog SKUs for product discovery and ID lookup.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sort_by` | string ("code" | "name" | "do_not_ship" | "do_not_track" | "created_at" | "updated_at" | "reference") | No | Optional SKU field to sort by: code, name, do_not_ship, do_not_track, created_at, updated_at, or reference. |
| `page_size` | integer | No | SKUs to return per page (1-25). |
| `next_cursor` | string | No | Opaque continuation cursor returned by a previous call; omit for the first page. |
| `sort_direction` | string ("ascending" | "descending") | No | Sort direction when sort_by is set: ascending or descending. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Stock Items

**Slug:** `COMMERCE_LAYER_LIST_STOCK_ITEMS`

Return one page of stock items with inventory quantities and SKU codes.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sort_by` | string ("quantity" | "created_at" | "updated_at" | "reference" | "reference_origin") | No | Optional stock item field to sort by: quantity, created_at, updated_at, reference, or reference_origin. |
| `page_size` | integer | No | Stock items to return per page (1-25). |
| `next_cursor` | string | No | Opaque continuation cursor returned by a previous call; omit for the first page. |
| `sort_direction` | string ("ascending" | "descending") | No | Sort direction when sort_by is set: ascending or descending. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Customer

**Slug:** `COMMERCE_LAYER_UPDATE_CUSTOMER`

Update selected attributes of one Commerce Layer customer. Only non-null fields supplied by the caller are changed. Inspect the customer first when rollback matters; restoring the captured values reverses this update.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `email` | string | No | Replacement email; omit to preserve the current email. |
| `metadata` | object | No | Replacement metadata object; omit to preserve it. |
| `reference` | string | No | Replacement external reference; omit to preserve it. |
| `customer_id` | string | Yes | Commerce Layer customer resource ID. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
