# Products

Browse the products synced from your connected stores and update variant shipping details (weight, dimensions, customs info).

**Scopes:** `GET` endpoints need `read:inventory`. `PUT` needs `write:inventory`. A **Shipping API** key (`read:*`, `write:*`) has both. See [Authentication](authentication.md#scopes).

Responses can include fields that aren't listed on this page. Rely only on the documented fields; undocumented fields can change or be removed without notice.

Decimal values (`price`, `compareAtPrice`, `weight`, `length`, `width`, `height`, `customsValue`) are returned as strings without trailing zeros, for example `"8.5"` or `"29.99"`, or `null` when unset.

## List Products

```
GET /api/v1/products
```

Returns a [paginated](pagination.md) list of your products, most recently updated first. Each product includes its store, its variants, and at most one image.

### Query Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `page` | integer | `1` | Page number (minimum 1) |
| `limit` | integer | `50` | Items per page (1–100; larger values are reduced to 100) |
| `storeId` | string | — | Only products from this store. A store ID that isn't yours returns an empty list. |
| `search` | string | — | Case-insensitive partial match on product title, vendor, or any variant SKU |

### Example

```bash
curl "https://shipwave.app/api/v1/products?search=widget&limit=10" \
  -H "Authorization: Bearer sw_live_abc123..."
```

```typescript
const res = await fetch(
  "https://shipwave.app/api/v1/products?search=widget&limit=10",
  { headers: { Authorization: "Bearer sw_live_abc123..." } }
);
const { data, meta } = await res.json();
```

### Response

```json
{
  "data": [
    {
      "id": "clx3prod1",
      "storeId": "clw9store1",
      "shopifyProductId": "8012345678901",
      "title": "Blue Widget",
      "handle": "blue-widget",
      "vendor": "Acme Co",
      "productType": "Accessories",
      "status": "active",
      "tags": ["bestseller", "widget"],
      "createdAt": "2026-01-10T12:00:00.000Z",
      "updatedAt": "2026-02-01T08:30:00.000Z",
      "store": {
        "id": "clw9store1",
        "shopDomain": "acme.myshopify.com",
        "platform": "shopify"
      },
      "variants": [
        {
          "id": "clx3var1",
          "title": "Small",
          "sku": "WIDGET-001-SM",
          "price": "29.99",
          "weight": "8",
          "weightUnit": "oz",
          "length": "6",
          "width": "4",
          "height": "3",
          "dimensionUnit": "in",
          "inventoryQuantity": 42,
          "hsCode": "3926.90",
          "countryOfOrigin": "US"
        },
        {
          "id": "clx3var2",
          "title": "Large",
          "sku": "WIDGET-001-LG",
          "price": "49.99",
          "weight": "16",
          "weightUnit": "oz",
          "length": null,
          "width": null,
          "height": null,
          "dimensionUnit": null,
          "inventoryQuantity": 10,
          "hsCode": null,
          "countryOfOrigin": null
        }
      ],
      "images": [
        {
          "src": "https://cdn.shopify.com/s/files/1/widget-blue.jpg",
          "alt": "Blue Widget"
        }
      ]
    }
  ],
  "meta": {
    "page": 1,
    "limit": 10,
    "total": 3,
    "totalPages": 1
  }
}
```

`images` holds at most one image in the list response (an empty array when the product has none). Use [Get Product](#get-product) for every image.

---

## Get Product

```
GET /api/v1/products/:id
```

Returns one product with all of its variants and images.

### Example

```bash
curl https://shipwave.app/api/v1/products/clx3prod1 \
  -H "Authorization: Bearer sw_live_abc123..."
```

### Response

The product fields match the list response. `variants` and `images` carry more fields:

```json
{
  "data": {
    "id": "clx3prod1",
    "storeId": "clw9store1",
    "shopifyProductId": "8012345678901",
    "title": "Blue Widget",
    "handle": "blue-widget",
    "vendor": "Acme Co",
    "productType": "Accessories",
    "status": "active",
    "tags": ["bestseller", "widget"],
    "createdAt": "2026-01-10T12:00:00.000Z",
    "updatedAt": "2026-02-01T08:30:00.000Z",
    "store": {
      "id": "clw9store1",
      "shopDomain": "acme.myshopify.com",
      "platform": "shopify"
    },
    "variants": [
      {
        "id": "clx3var1",
        "productId": "clx3prod1",
        "title": "Small",
        "sku": "WIDGET-001-SM",
        "barcode": null,
        "price": "29.99",
        "compareAtPrice": null,
        "weight": "8",
        "weightUnit": "oz",
        "length": "6",
        "width": "4",
        "height": "3",
        "dimensionUnit": "in",
        "inventoryQuantity": 42,
        "requiresShipping": true,
        "option1": "Small",
        "option2": null,
        "option3": null,
        "position": 1,
        "hsCode": "3926.90",
        "countryOfOrigin": "US",
        "customsDescription": null,
        "customsValue": null,
        "createdAt": "2026-01-10T12:00:00.000Z",
        "updatedAt": "2026-02-01T08:30:00.000Z"
      }
    ],
    "images": [
      {
        "id": "clx3img1",
        "src": "https://cdn.shopify.com/s/files/1/widget-blue.jpg",
        "alt": "Blue Widget",
        "position": 1,
        "width": 1024,
        "height": 1024
      }
    ]
  }
}
```

### Errors

| Status | Code | Cause |
|--------|------|-------|
| 404 | `NOT_FOUND` | No product with this ID on your account. A product that belongs to another account also returns 404. |

---

## Update Variant Shipping Details

```
PUT /api/v1/products/:id/variants/:variantId
```

Updates shipping fields on one variant so rates use accurate weight, dimensions, and customs data. Send only the fields you want to change. Omitted fields keep their current values, and `null` clears a field.

These changes update ShipWave's copy of the variant. They are not pushed to your store. A later product sync from your store can replace any of these fields that the store also provides, for example `weight` and `weightUnit` when the store has a nonzero weight, or `hsCode` and `countryOfOrigin` when the store has them set. For lasting changes, update the value in your store too.

### Request Body

All fields are optional.

| Field | Type | Description |
|-------|------|-------------|
| `weight` | number | Variant weight |
| `weightUnit` | string | `oz`, `lb`, `g`, or `kg` |
| `length` | number | Package length |
| `width` | number | Package width |
| `height` | number | Package height |
| `dimensionUnit` | string | `in` or `cm` |
| `hsCode` | string | Harmonized System code (for customs) |
| `countryOfOrigin` | string | Country of origin (ISO 3166-1 alpha-2 code, for example `CN`) |
| `customsDescription` | string | Description for customs forms |
| `customsValue` | number | Declared customs value per unit |

Numbers must be zero or greater (numeric strings such as `"8.5"` are accepted). Units must be one of the values listed above and are stored in lowercase. Any other value returns `400 VALIDATION_ERROR` naming the field. Other fields in the body are ignored. The response is the updated variant, in the same shape as a variant in [Get Product](#get-product).

### Example

```bash
curl -X PUT https://shipwave.app/api/v1/products/clx3prod1/variants/clx3var1 \
  -H "Authorization: Bearer sw_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "weight": 8.5,
    "weightUnit": "oz",
    "length": 6,
    "width": 4,
    "height": 3,
    "dimensionUnit": "in",
    "hsCode": "8507.60",
    "countryOfOrigin": "CN"
  }'
```

```typescript
const res = await fetch(
  "https://shipwave.app/api/v1/products/clx3prod1/variants/clx3var1",
  {
    method: "PUT",
    headers: {
      Authorization: "Bearer sw_live_abc123...",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      weight: 8.5,
      weightUnit: "oz",
      length: 6,
      width: 4,
      height: 3,
      dimensionUnit: "in",
      hsCode: "8507.60",
      countryOfOrigin: "CN",
    }),
  }
);
const { data } = await res.json();
```

### Response

Returns the updated variant (the same variant fields as [Get Product](#get-product)):

```json
{
  "data": {
    "id": "clx3var1",
    "productId": "clx3prod1",
    "title": "Small",
    "sku": "WIDGET-001-SM",
    "barcode": null,
    "price": "29.99",
    "compareAtPrice": null,
    "weight": "8.5",
    "weightUnit": "oz",
    "length": "6",
    "width": "4",
    "height": "3",
    "dimensionUnit": "in",
    "inventoryQuantity": 42,
    "requiresShipping": true,
    "option1": "Small",
    "option2": null,
    "option3": null,
    "position": 1,
    "hsCode": "8507.60",
    "countryOfOrigin": "CN",
    "customsDescription": null,
    "customsValue": null,
    "createdAt": "2026-01-10T12:00:00.000Z",
    "updatedAt": "2026-02-19T14:05:00.000Z"
  }
}
```

### Errors

| Status | Code | Cause |
|--------|------|-------|
| 400 | `VALIDATION_ERROR` | The body is missing, isn't valid JSON, or is `null` (`Invalid request body`) |
| 404 | `NOT_FOUND` | `Product not found`: no product with this ID on your account (another account's product also returns 404) |
| 404 | `NOT_FOUND` | `Variant not found`: no variant with this ID, or it belongs to a different product |
| 400 | `VALIDATION_ERROR` | A field has the wrong type, a negative number, or an unknown unit (for example `weightUnit must be one of oz, lb, g, kg`) |

For `401`, `403`, and `429` responses, see [Errors](errors.md).
