> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify API reference

> API reference for the Shopify plugin in Corsair: every `shopify.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Collections

### addProducts

`collections.addProducts`

Add products to a collection; the whole call fails if any is already present

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.collections.addProducts({ id: 'gid://shopify/Collection/1', productIds: ['gid://shopify/Product/108828309'] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Collection GID. |
| `productIds` | `string[]` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collection` | `object` | Yes | — |

> [accordion] collection full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   descriptionHtml?: string | null,
>   updatedAt: string,
>   sortOrder?: string | null,
>   productsCount?: {
>     count: number
>   } | null
> }
> ```

***

### create

`collections.create`

Create a manual collection with a title and handle

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.collections.create({ title: 'Outdoor gear' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | Yes | — |
| `descriptionHtml` | `string` | No | — |
| `handle` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collection` | `object` | Yes | — |

> [accordion] collection full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   descriptionHtml?: string | null,
>   updatedAt: string,
>   sortOrder?: string | null,
>   productsCount?: {
>     count: number
>   } | null
> }
> ```

***

### get

`collections.get`

Read one collection by GID

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.collections.get({ id: 'gid://shopify/Collection/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collection` | `object \| null` | No | — |

> [accordion] collection full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   descriptionHtml?: string | null,
>   updatedAt: string,
>   sortOrder?: string | null,
>   productsCount?: {
>     count: number
>   } | null
> } | null
> ```

***

### list

`collections.list`

List collections with their product counts, cursor-paged

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.collections.list({ first: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `query` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collections` | `object` | Yes | — |

> [accordion] collections full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       title: string,
>       handle: string,
>       descriptionHtml?: string | null,
>       updatedAt: string,
>       sortOrder?: string | null,
>       productsCount?: {
>         count: number
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

## Customers

### create

`customers.create`

Create a customer with an email, name and tags

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.customers.create({ email: 'buyer@example.com', firstName: 'Jenny' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | No | — |
| `phone` | `string` | No | — |
| `firstName` | `string` | No | — |
| `lastName` | `string` | No | — |
| `note` | `string` | No | — |
| `tags` | `string[]` | No | — |
| `taxExempt` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object` | Yes | — |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string,
>   firstName?: string | null,
>   lastName?: string | null,
>   state: string,
>   note?: string | null,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   numberOfOrders: string,
>   taxExempt?: boolean | null,
>   verifiedEmail?: boolean | null,
>   defaultEmailAddress?: {
>     emailAddress: string,
>     marketingState?: string | null
>   } | null,
>   defaultPhoneNumber?: {
>     phoneNumber: string
>   } | null,
>   amountSpent?: {
>     amount: string,
>     currencyCode: string
>   } | null
> }
> ```

***

### get

`customers.get`

Read one customer by GID, including addresses and spend

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.customers.get({ id: 'gid://shopify/Customer/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |

Needs protected customer data access on the app. Fields the app was not granted (name, email, phone) come back null with an ACCESS\_DENIED warning, and the rest of the customer is returned.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | — |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string,
>   firstName?: string | null,
>   lastName?: string | null,
>   state: string,
>   note?: string | null,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   numberOfOrders: string,
>   taxExempt?: boolean | null,
>   verifiedEmail?: boolean | null,
>   defaultEmailAddress?: {
>     emailAddress: string,
>     marketingState?: string | null
>   } | null,
>   defaultPhoneNumber?: {
>     phoneNumber: string
>   } | null,
>   amountSpent?: {
>     amount: string,
>     currencyCode: string
>   } | null
> } | null
> ```

***

### list

`customers.list`

List customers with order counts and spend, cursor-paged and filtered

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.customers.list({ first: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `query` | `string` | No | — |

Needs protected customer data access on the app; without it the call fails. With access to the Customer object but not to a field (Name, Email, Phone, Address), Shopify nulls that field and returns an ACCESS\_DENIED warning beside the rows, and the plugin keeps the rows.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customers` | `object` | Yes | — |

> [accordion] customers full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       firstName?: string | null,
>       lastName?: string | null,
>       state: string,
>       note?: string | null,
>       tags: string[],
>       createdAt: string,
>       updatedAt: string,
>       numberOfOrders: string,
>       taxExempt?: boolean | null,
>       verifiedEmail?: boolean | null,
>       defaultEmailAddress?: {
>         emailAddress: string,
>         marketingState?: string | null
>       } | null,
>       defaultPhoneNumber?: {
>         phoneNumber: string
>       } | null,
>       amountSpent?: {
>         amount: string,
>         currencyCode: string
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

### update

`customers.update`

Update a customer, overwriting tags when tags are passed

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.customers.update({ id: 'gid://shopify/Customer/1', note: 'VIP' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `email` | `string` | No | — |
| `phone` | `string` | No | — |
| `firstName` | `string` | No | — |
| `lastName` | `string` | No | — |
| `note` | `string` | No | — |
| `tags` | `string[]` | No | — |
| `taxExempt` | `boolean` | No | — |
| `id` | `string` | Yes | — |

Passing tags replaces the full tag set. Use the Shopify admin or a tagsAdd mutation to append one without dropping the rest.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object` | Yes | — |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string,
>   firstName?: string | null,
>   lastName?: string | null,
>   state: string,
>   note?: string | null,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   numberOfOrders: string,
>   taxExempt?: boolean | null,
>   verifiedEmail?: boolean | null,
>   defaultEmailAddress?: {
>     emailAddress: string,
>     marketingState?: string | null
>   } | null,
>   defaultPhoneNumber?: {
>     phoneNumber: string
>   } | null,
>   amountSpent?: {
>     amount: string,
>     currencyCode: string
>   } | null
> }
> ```

***

## Inventory

### adjust

`inventory.adjust`

Adjust available stock by a signed delta at one location, with a reason

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.inventory.adjust({ inventoryItemId: 'gid://shopify/InventoryItem/1', locationId: 'gid://shopify/Location/1', delta: 5, reason: 'correction' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `inventoryItemId` | `string` | Yes | — |
| `locationId` | `string` | Yes | — |
| `delta` | `number` | Yes | Signed change: positive adds stock, negative removes it. |
| `reason` | `string` | Yes | Inventory change reason, e.g. "correction" or "received". |
| `changeFromQuantity` | `number \| null` | No | Expected quantity before the change. Set it to turn the write into a compare-and-swap, which fails when the current quantity differs. Omit it to skip that check. |
| `idempotencyKey` | `string` | No | Key that makes this adjustment safe to repeat. A new key is generated for each call when omitted, so two identical adjustments both apply; pass the same key again only when retrying the same adjustment. |

Adjusts the available quantity by a signed delta at one location. A positive delta adds stock and a negative one removes it. Each call sends a new idempotency key unless you pass idempotencyKey; pass the same key only to retry the same adjustment.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `inventoryAdjustmentGroup` | `object \| null` | No | — |

> [accordion] inventoryAdjustmentGroup full type
>
> ```ts theme={null}
> {
>   createdAt?: string | null,
>   reason?: string | null,
>   changes?: {
>     name: string,
>     delta: number
>   }[] | null
> } | null
> ```

***

### list

`inventory.list`

Read the available stock of one inventory item at every active location

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.inventory.list({ inventoryItemId: 'gid://shopify/InventoryItem/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Locations per page. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `inventoryItemId` | `string` | Yes | InventoryItem GID. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `inventoryItem` | `object \| null` | No | — |

> [accordion] inventoryItem full type
>
> ```ts theme={null}
> {
>   id: string,
>   sku?: string | null,
>   tracked: boolean,
>   inventoryLevels: {
>     edges: {
>       node: {
>         id: string,
>         isActive: boolean,
>         updatedAt?: string | null,
>         item: {
>           id: string,
>           sku?: string | null
>         },
>         location: {
>           id: string,
>           name: string
>         },
>         quantities: {
>           name: string,
>           quantity: number
>         }[]
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   }
> } | null
> ```

***

## Orders

### cancel

`orders.cancel`

Cancel an order, optionally restocking and notifying the customer; does not refund

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.shopify.api.orders.cancel({ id: 'gid://shopify/Order/1', reason: 'CUSTOMER', restock: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `reason` | `CUSTOMER \| DECLINED \| FRAUD \| INVENTORY \| OTHER \| STAFF` | No | — |
| `restock` | `boolean` | No | Restock the order items. |
| `notifyCustomer` | `boolean` | No | Email the customer about the cancellation. |

Cancels the order without refunding. Cancelling and refunding are separate decisions, so the deprecated refund flag is not used and no money moves on a cancel.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object` | Yes | — |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   createdAt: string,
>   updatedAt?: string | null,
>   processedAt?: string | null,
>   cancelledAt?: string | null,
>   closedAt?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   note?: string | null,
>   tags: string[],
>   currencyCode: string,
>   displayFinancialStatus?: string | null,
>   displayFulfillmentStatus: string,
>   cancelReason?: string | null,
>   totalPriceSet: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   },
>   totalTaxSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   subtotalPriceSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   totalDiscountsSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   customer?: {
>     id: string,
>     defaultEmailAddress?: {
>       emailAddress: string
>     } | null
>   } | null,
>   lineItems?: {
>     edges: {
>       node: {
>         id?: string | null,
>         title?: string | null,
>         quantity?: number | null,
>         sku?: string | null,
>         variant?: {
>           id: string
>         } | null,
>         originalUnitPriceSet?: {
>           shopMoney: {
>             amount: string,
>             currencyCode: string
>           },
>           presentmentMoney?: {
>             amount: string,
>             currencyCode: string
>           } | null
>         } | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> }
> ```

***

### close

`orders.close`

Close a completed or cancelled order so it no longer counts as open

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.orders.close({ id: 'gid://shopify/Order/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object` | Yes | — |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   createdAt: string,
>   updatedAt?: string | null,
>   processedAt?: string | null,
>   cancelledAt?: string | null,
>   closedAt?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   note?: string | null,
>   tags: string[],
>   currencyCode: string,
>   displayFinancialStatus?: string | null,
>   displayFulfillmentStatus: string,
>   cancelReason?: string | null,
>   totalPriceSet: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   },
>   totalTaxSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   subtotalPriceSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   totalDiscountsSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   customer?: {
>     id: string,
>     defaultEmailAddress?: {
>       emailAddress: string
>     } | null
>   } | null,
>   lineItems?: {
>     edges: {
>       node: {
>         id?: string | null,
>         title?: string | null,
>         quantity?: number | null,
>         sku?: string | null,
>         variant?: {
>           id: string
>         } | null,
>         originalUnitPriceSet?: {
>           shopMoney: {
>             amount: string,
>             currencyCode: string
>           },
>           presentmentMoney?: {
>             amount: string,
>             currencyCode: string
>           } | null
>         } | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> }
> ```

***

### get

`orders.get`

Read one order by GID with its customer and a page of its line items

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.orders.get({ id: 'gid://shopify/Order/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `lineItemsFirst` | `number` | No | Line items per page. Defaults to 20; the maximum is 250. |
| `lineItemsAfter` | `string` | No | Line-item cursor from a previous page. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | — |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   createdAt: string,
>   updatedAt?: string | null,
>   processedAt?: string | null,
>   cancelledAt?: string | null,
>   closedAt?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   note?: string | null,
>   tags: string[],
>   currencyCode: string,
>   displayFinancialStatus?: string | null,
>   displayFulfillmentStatus: string,
>   cancelReason?: string | null,
>   totalPriceSet: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   },
>   totalTaxSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   subtotalPriceSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   totalDiscountsSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   customer?: {
>     id: string,
>     defaultEmailAddress?: {
>       emailAddress: string
>     } | null
>   } | null,
>   lineItems?: {
>     edges: {
>       node: {
>         id?: string | null,
>         title?: string | null,
>         quantity?: number | null,
>         sku?: string | null,
>         variant?: {
>           id: string
>         } | null,
>         originalUnitPriceSet?: {
>           shopMoney: {
>             amount: string,
>             currencyCode: string
>           },
>           presentmentMoney?: {
>             amount: string,
>             currencyCode: string
>           } | null
>         } | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> } | null
> ```

***

### list

`orders.list`

List orders with totals and line items, filtered and sorted, cursor-paged

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.orders.list({ first: 10, query: 'financial_status:paid' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `query` | `string` | No | Shopify search syntax, e.g. "financial\_status:paid". |
| `sortKey` | `CREATED_AT \| CURRENT_TOTAL_PRICE \| CUSTOMER_NAME \| DESTINATION \| FINANCIAL_STATUS \| FULFILLMENT_STATUS \| ID \| ORDER_NUMBER \| PO_NUMBER \| PROCESSED_AT \| RELEVANCE \| TOTAL_ITEMS_QUANTITY \| TOTAL_PRICE \| UPDATED_AT` | No | — |
| `reverse` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `orders` | `object` | Yes | — |

> [accordion] orders full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       name: string,
>       createdAt: string,
>       updatedAt?: string | null,
>       processedAt?: string | null,
>       cancelledAt?: string | null,
>       closedAt?: string | null,
>       email?: string | null,
>       phone?: string | null,
>       note?: string | null,
>       tags: string[],
>       currencyCode: string,
>       displayFinancialStatus?: string | null,
>       displayFulfillmentStatus: string,
>       cancelReason?: string | null,
>       totalPriceSet: {
>         shopMoney: {
>           amount: string,
>           currencyCode: string
>         },
>         presentmentMoney?: {
>           amount: string,
>           currencyCode: string
>         } | null
>       },
>       totalTaxSet?: {
>         shopMoney: {
>           amount: string,
>           currencyCode: string
>         },
>         presentmentMoney?: {
>           amount: string,
>           currencyCode: string
>         } | null
>       } | null,
>       subtotalPriceSet?: {
>         shopMoney: {
>           amount: string,
>           currencyCode: string
>         },
>         presentmentMoney?: {
>           amount: string,
>           currencyCode: string
>         } | null
>       } | null,
>       totalDiscountsSet?: {
>         shopMoney: {
>           amount: string,
>           currencyCode: string
>         },
>         presentmentMoney?: {
>           amount: string,
>           currencyCode: string
>         } | null
>       } | null,
>       customer?: {
>         id: string,
>         defaultEmailAddress?: {
>           emailAddress: string
>         } | null
>       } | null,
>       lineItems?: {
>         edges: {
>           node: {
>             id?: string | null,
>             title?: string | null,
>             quantity?: number | null,
>             sku?: string | null,
>             variant?: {
>               id: string
>             } | null,
>             originalUnitPriceSet?: {
>               shopMoney: {
>                 amount: string,
>                 currencyCode: string
>               },
>               presentmentMoney?: {
>                 amount: string,
>                 currencyCode: string
>               } | null
>             } | null
>           },
>           cursor?: string | null
>         }[],
>         pageInfo: {
>           hasNextPage: boolean,
>           hasPreviousPage?: boolean | null,
>           endCursor?: string | null,
>           startCursor?: string | null
>         }
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

### listLineItems

`orders.listLineItems`

Read one page of an order line items, cursor-paged, for orders with more than one page

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.orders.listLineItems({ id: 'gid://shopify/Order/1', first: 50 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Order GID. |
| `first` | `number` | No | Line items per page. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `lineItems` | `object` | Yes | — |

> [accordion] lineItems full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id?: string | null,
>       title?: string | null,
>       quantity?: number | null,
>       sku?: string | null,
>       variant?: {
>         id: string
>       } | null,
>       originalUnitPriceSet?: {
>         shopMoney: {
>           amount: string,
>           currencyCode: string
>         },
>         presentmentMoney?: {
>           amount: string,
>           currencyCode: string
>         } | null
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

### markAsPaid

`orders.markAsPaid`

Mark an order as paid: captures an existing payment authorization, or records a manual payment for the outstanding amount

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.shopify.api.orders.markAsPaid({ id: 'gid://shopify/Order/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object` | Yes | — |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   createdAt: string,
>   updatedAt?: string | null,
>   processedAt?: string | null,
>   cancelledAt?: string | null,
>   closedAt?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   note?: string | null,
>   tags: string[],
>   currencyCode: string,
>   displayFinancialStatus?: string | null,
>   displayFulfillmentStatus: string,
>   cancelReason?: string | null,
>   totalPriceSet: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   },
>   totalTaxSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   subtotalPriceSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   totalDiscountsSet?: {
>     shopMoney: {
>       amount: string,
>       currencyCode: string
>     },
>     presentmentMoney?: {
>       amount: string,
>       currencyCode: string
>     } | null
>   } | null,
>   customer?: {
>     id: string,
>     defaultEmailAddress?: {
>       emailAddress: string
>     } | null
>   } | null,
>   lineItems?: {
>     edges: {
>       node: {
>         id?: string | null,
>         title?: string | null,
>         quantity?: number | null,
>         sku?: string | null,
>         variant?: {
>           id: string
>         } | null,
>         originalUnitPriceSet?: {
>           shopMoney: {
>             amount: string,
>             currencyCode: string
>           },
>           presentmentMoney?: {
>             amount: string,
>             currencyCode: string
>           } | null
>         } | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> }
> ```

***

## Products

### create

`products.create`

Create a product with its title and catalog fields; variants are added separately

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.products.create({ title: 'Hiking backpack', vendor: 'Acme', status: 'DRAFT' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | Yes | — |
| `descriptionHtml` | `string` | No | — |
| `vendor` | `string` | No | — |
| `productType` | `string` | No | — |
| `handle` | `string` | No | — |
| `tags` | `string[]` | No | — |
| `status` | `ACTIVE \| ARCHIVED \| DRAFT \| UNLISTED` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object` | Yes | — |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   status: string,
>   vendor: string,
>   productType: string,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   publishedAt?: string | null,
>   descriptionHtml?: string | null,
>   totalInventory?: number | null,
>   onlineStoreUrl?: string | null,
>   variants?: {
>     edges: {
>       node: {
>         id: string,
>         title: string,
>         sku?: string | null,
>         price?: string | null,
>         compareAtPrice?: string | null,
>         inventoryQuantity?: number | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> }
> ```

***

### delete

`products.delete`

Permanently delete a product with its variants, media and inventory items

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.shopify.api.products.delete({ id: 'gid://shopify/Product/108828309' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `synchronous` | `boolean` | No | Delete synchronously. Defaults to true. |

Deletes synchronously by default and returns deletedProductId. Set synchronous to false for a product with many variants: the delete then runs in the background and returns productDeleteOperation, whose id and status let you track it, while deletedProductId may be null.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deletedProductId` | `string \| null` | No | — |
| `productDeleteOperation` | `object \| null` | No | — |

> [accordion] productDeleteOperation full type
>
> ```ts theme={null}
> {
>   id: string,
>   status: string,
>   deletedProductId?: string | null
> } | null
> ```

***

### get

`products.get`

Read one product by GID, including its first variants and inventory totals

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.products.get({ id: 'gid://shopify/Product/108828309' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Product GID, e.g. gid://shopify/Product/1. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | — |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   status: string,
>   vendor: string,
>   productType: string,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   publishedAt?: string | null,
>   descriptionHtml?: string | null,
>   totalInventory?: number | null,
>   onlineStoreUrl?: string | null,
>   variants?: {
>     edges: {
>       node: {
>         id: string,
>         title: string,
>         sku?: string | null,
>         price?: string | null,
>         compareAtPrice?: string | null,
>         inventoryQuantity?: number | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> } | null
> ```

***

### list

`products.list`

List products with their first variants, cursor-paged and filtered with Shopify search syntax

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.products.list({ first: 10, query: 'status:active' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `query` | `string` | No | Shopify search syntax, e.g. "status:active" or "title:boots". |
| `sortKey` | `CREATED_AT \| ID \| INVENTORY_TOTAL \| PRODUCT_TYPE \| PUBLISHED_AT \| RELEVANCE \| TITLE \| UPDATED_AT \| VENDOR` | No | — |
| `reverse` | `boolean` | No | Reverse the sort order. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `products` | `object` | Yes | — |

> [accordion] products full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       title: string,
>       handle: string,
>       status: string,
>       vendor: string,
>       productType: string,
>       tags: string[],
>       createdAt: string,
>       updatedAt: string,
>       publishedAt?: string | null,
>       descriptionHtml?: string | null,
>       totalInventory?: number | null,
>       onlineStoreUrl?: string | null,
>       variants?: {
>         edges: {
>           node: {
>             id: string,
>             title: string,
>             sku?: string | null,
>             price?: string | null,
>             compareAtPrice?: string | null,
>             inventoryQuantity?: number | null
>           },
>           cursor?: string | null
>         }[],
>         pageInfo: {
>           hasNextPage: boolean,
>           hasPreviousPage?: boolean | null,
>           endCursor?: string | null,
>           startCursor?: string | null
>         }
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

### update

`products.update`

Update a product, changing only the fields that are passed

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.products.update({ id: 'gid://shopify/Product/108828309', title: 'Trail backpack' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `title` | `string` | No | — |
| `descriptionHtml` | `string` | No | — |
| `vendor` | `string` | No | — |
| `productType` | `string` | No | — |
| `handle` | `string` | No | — |
| `tags` | `string[]` | No | — |
| `status` | `ACTIVE \| ARCHIVED \| DRAFT \| UNLISTED` | No | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object` | Yes | — |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id: string,
>   title: string,
>   handle: string,
>   status: string,
>   vendor: string,
>   productType: string,
>   tags: string[],
>   createdAt: string,
>   updatedAt: string,
>   publishedAt?: string | null,
>   descriptionHtml?: string | null,
>   totalInventory?: number | null,
>   onlineStoreUrl?: string | null,
>   variants?: {
>     edges: {
>       node: {
>         id: string,
>         title: string,
>         sku?: string | null,
>         price?: string | null,
>         compareAtPrice?: string | null,
>         inventoryQuantity?: number | null
>       },
>       cursor?: string | null
>     }[],
>     pageInfo: {
>       hasNextPage: boolean,
>       hasPreviousPage?: boolean | null,
>       endCursor?: string | null,
>       startCursor?: string | null
>     }
>   } | null
> }
> ```

***

## Shop

### get

`shop.get`

Read the shop name, domain, currency and plan for the configured token

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.shop.get({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `shop` | `object` | Yes | — |

> [accordion] shop full type
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   myshopifyDomain: string,
>   currencyCode: string,
>   ianaTimezone?: string | null,
>   email?: string | null,
>   description?: string | null,
>   plan?: {
>     displayName?: string | null
>   } | null
> }
> ```

***

### listLocations

`shop.listLocations`

List the inventory locations of the shop, for use with inventory.adjust

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.shop.listLocations({ first: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |

Returns the inventory locations. Pass a location id to inventory.adjust to change stock at that location.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `locations` | `object` | Yes | — |

> [accordion] locations full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       name: string,
>       isActive: boolean,
>       address: {
>         address1?: string | null,
>         city?: string | null,
>         province?: string | null,
>         countryCode?: string | null,
>         zip?: string | null
>       }
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

## Variants

### list

`variants.list`

List the variants of one product, cursor-paged, with price and stock

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.variants.list({ productId: 'gid://shopify/Product/108828309' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `query` | `string` | No | Shopify search syntax. |
| `productId` | `string` | Yes | Product GID to list variants for. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `productVariants` | `object` | Yes | — |

> [accordion] productVariants full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       title: string,
>       sku?: string | null,
>       price?: string | null,
>       compareAtPrice?: string | null,
>       inventoryQuantity?: number | null,
>       inventoryItem?: {
>         id: string
>       } | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***

### update

`variants.update`

Update price, SKU, barcode or inventory policy on one variant

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.variants.update({ productId: 'gid://shopify/Product/108828309', id: 'gid://shopify/ProductVariant/1', price: '19.99' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `productId` | `string` | Yes | — |
| `id` | `string` | Yes | Product variant GID. |
| `price` | `string` | No | Decimal string, e.g. "19.99". |
| `compareAtPrice` | `string` | No | — |
| `sku` | `string` | No | SKU for this variant. Sent as inventoryItem.sku, which is where the API stores it. |
| `barcode` | `string` | No | Barcode value; sent in the barcodes list, not the deprecated barcode field. |
| `barcodeType` | `UPC \| EAN \| ISBN \| GTIN \| ASIN \| NS_PID` | No | Barcode standard. When omitted the value is stored without a type and is not checked against a standard. |
| `inventoryPolicy` | `DENY \| CONTINUE` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `productVariants` | `object[]` | Yes | — |

> [accordion] productVariants full type
>
> ```ts theme={null}
> {
>   id: string,
>   price?: string | null
> }[]
> ```

***

## Webhook Subscriptions

### create

`webhookSubscriptions.create`

Register a JSON webhook subscription for one topic and URI

**Risk:** `write`

```ts theme={null}
await corsair.shopify.api.webhookSubscriptions.create({ topic: 'ORDERS_CREATE', uri: 'https://example.com/webhooks/shopify' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `string` | Yes | Topic, e.g. ORDERS\_CREATE. |
| `uri` | `string` | Yes | HTTPS endpoint Shopify delivers to. |

Registers a JSON subscription. Shopify also delivers XML, which this plugin cannot verify or parse, so the format is not configurable.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhookSubscription` | `object` | Yes | — |

> [accordion] webhookSubscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   topic: string,
>   uri: string,
>   format: string,
>   createdAt?: string | null,
>   updatedAt?: string | null
> }
> ```

***

### delete

`webhookSubscriptions.delete`

Delete a webhook subscription, stopping further deliveries for that topic

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.shopify.api.webhookSubscriptions.delete({ id: 'gid://shopify/WebhookSubscription/1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | WebhookSubscription GID. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deletedWebhookSubscriptionId` | `string \| null` | No | — |

***

### list

`webhookSubscriptions.list`

List shop-scoped webhook subscriptions, optionally filtered by topic

**Risk:** `read`

```ts theme={null}
await corsair.shopify.api.webhookSubscriptions.list({ first: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first` | `number` | No | Page size. Defaults to 50; the maximum is 250. |
| `after` | `string` | No | Cursor from a previous page. |
| `topic` | `string` | No | Filter by topic, e.g. ORDERS\_CREATE. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhookSubscriptions` | `object` | Yes | — |

> [accordion] webhookSubscriptions full type
>
> ```ts theme={null}
> {
>   edges: {
>     node: {
>       id: string,
>       topic: string,
>       uri: string,
>       format: string,
>       createdAt?: string | null,
>       updatedAt?: string | null
>     },
>     cursor?: string | null
>   }[],
>   pageInfo: {
>     hasNextPage: boolean,
>     hasPreviousPage?: boolean | null,
>     endCursor?: string | null,
>     startCursor?: string | null
>   }
> }
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.