# Look up products and prices

> Manage your own simple and variant products, phase them out safely, and look up supplier catalog prices and stock for catalog products.

Web page: https://developer.yoprint.com/guides/products-and-catalog/

**Read first:** [Products and pricing](https://developer.yoprint.com/how-yoprint-works/products-and-pricing.md), for the kinds of product and how pricing works.

YoPrint has two sources of products:

- **Your own products**, which your team creates: a **simple product** (one item) or a **variant product** (one item in several sizes or colors, each a variant).
- **The supplier catalog**: blanks from suppliers your team has connected, such as a t-shirt style in every size and color. YoPrint reads their prices and stock from the supplier.

Both can go on a quote or sales order. See [Add line items](https://developer.yoprint.com/guides/line-items.md).

## Your own products

### 1. List them

`GET /v1/api/store/{team_slug}/product` [List products](https://developer.yoprint.com/reference/products/v1-products-index.md)

Without `status`, the list has every product that isn't deleted. Add `?status=on_sale`, `?status=phased_out` or `?status=deleted` to narrow it.

### 2. Create a simple product

`POST /v1/api/store/{team_slug}/product` [Create a product](https://developer.yoprint.com/reference/products/v1-products-store.md)

```json
{
  "type": "simple",
  "title": "Embroidered cap",
  "brand": "Northwind",
  "taxable": true,
  "default_price": 15000
}
```

- `type` is `simple` or `variant`, and `title` is required.
- A simple product needs `default_price`. Send a whole number of thousandths: `15000` is 15.00.

> **Caution:** `default_price` is a whole number of **thousandths**, an older encoding (`15000` is 15.00), not a decimal pair. Line item prices on quotes and orders, by contrast, are decimal pairs (`{ "value": 1500, "dp": 2 }`). See [Money and quantities](https://developer.yoprint.com/concepts/money-and-quantities.md).

### 3. Create a variant product

Send `"type": "variant"`, with the variants in `product`. Then manage variants one at a time:

`GET /v1/api/store/{team_slug}/product/{hash_id}/variant` [List a product's variants](https://developer.yoprint.com/reference/product-variants/v1-product-variant-index.md)

`POST /v1/api/store/{team_slug}/product/{hash_id}/variant` [Add a variant to a product](https://developer.yoprint.com/reference/product-variants/v1-product-variant-store.md)

`PUT /v1/api/store/{team_slug}/product/{hash_id}/variant/{id}` [Update a variant](https://developer.yoprint.com/reference/product-variants/v1-product-variant-update.md)

Every size and brand name YoPrint knows, for autocomplete: your own products, and every supplier catalog YoPrint carries, not just the ones your team connected:

`GET /v1/api/store/{team_slug}/get_all_product_sizes` [List all size names](https://developer.yoprint.com/reference/products/v1-product-sizes-index.md)

`GET /v1/api/store/{team_slug}/get_all_product_brands` [List all product brands](https://developer.yoprint.com/reference/products/v1-product-brands-index.md)

### 4. Stop selling a product

Phasing out a product stops it being added to new quote and order lines. Lines that already use it keep working. Put it back on sale with resume.

`POST /v1/api/store/{team_slug}/product/{hash_id}/phase_out` [Phase out a simple product](https://developer.yoprint.com/reference/products/v1-product-phase-out.md)

`POST /v1/api/store/{team_slug}/product/{hash_id}/resume` [Put a phased-out simple product back on sale](https://developer.yoprint.com/reference/products/v1-product-resume.md)

Variants can be phased out and resumed the same way:

`POST /v1/api/store/{team_slug}/product/{hash_id}/variant/phase_out` [Phase out variants (stop selling them)](https://developer.yoprint.com/reference/product-variants/v1-product-variant-phase-out.md)

Before deleting a product, ask YoPrint what deleting it would affect:

`POST /v1/api/store/{team_slug}/product/{hash_id}/delete_check` [Check whether a product can be deleted](https://developer.yoprint.com/reference/products/v1-product-delete-check.md)

`DELETE /v1/api/store/{team_slug}/product/{hash_id}` [Delete a product](https://developer.yoprint.com/reference/products/v1-products-destroy.md)

### 5. Stock

To read the stock of several products at once, optionally for one warehouse:

`POST /v1/api/store/{team_slug}/product_stock` [Get stock levels for products](https://developer.yoprint.com/reference/product-stock/v1-misc-product-stock.md)

```json
{
  "warehouse_id": "3vnVzNSvE6xL6k",
  "product": [
    { "type": "db_simple", "id": "5MnM49NNFDgB9A" },
    { "type": "db_variant", "id": "GirpQnLewN2TLg" }
  ]
}
```

Note the type names here: `db_simple` for a simple product, `db_variant` for a variant. The stock levels in the answer are decimal strings with 8 decimal places, such as `"24.00000000"`. Parse them as decimals. See [Money and quantities](https://developer.yoprint.com/concepts/money-and-quantities.md).

## The supplier catalog

Catalog products have ids that start with the supplier's code and a hyphen, such as `smr-10001`. Each id is one size and color of a style.

### Every size and color of a style

Send one catalog product id of the style (`db_catalog`), or the style's id (`db_catalog_style`). The answer is the whole style: each row of `attr_data` is one size and color, with its catalog product `id`, `size_label`, `color_label` and supplier code `provider`. It reads YoPrint's copy of the catalog and doesn't call the supplier.

`POST /v1/api/store/{team_slug}/hydrate_product` [Load a product for a sales order line](https://developer.yoprint.com/reference/products/v1-hydrate-imported-product.md)

```json
{ "type": "db_catalog", "id": "smr-10001" }
```

### Live price and stock

Ask the supplier for current prices, stock, or both, for up to 100 catalog products at once:

`POST /v1/api/store/{team_slug}/real_time_data_fetcher/pricing` [Get live supplier pricing for catalog products](https://developer.yoprint.com/reference/supplier-catalog/v1-real-time-data-fetcher-pricing.md)

`POST /v1/api/store/{team_slug}/real_time_data_fetcher/inventory` [Get live supplier inventory for catalog products](https://developer.yoprint.com/reference/supplier-catalog/v1-real-time-data-fetcher-inventory.md)

`POST /v1/api/store/{team_slug}/real_time_data_fetcher/pricing_with_inventory` [Get live supplier pricing and inventory together](https://developer.yoprint.com/reference/supplier-catalog/v1-real-time-data-fetcher-pricing-with-inventory.md)

```json
{
  "product": [
    { "type": "db_catalog", "id": "smr-10001" },
    { "type": "db_catalog", "id": "smr-10002" }
  ]
}
```

These calls reach the supplier, so they can be slower than other reads, and the answer depends on the supplier's own service. Live prices come back as decimal pairs (`{ "value": 425, "dp": 2 }` is 4.25, so read `dp` every time). Inventory `total_count` and warehouse `count` are integers.

Product pictures from the supplier:

`POST /v1/api/store/{team_slug}/real_time_data_fetcher/images` [Get supplier images for catalog products](https://developer.yoprint.com/reference/supplier-catalog/v1-real-time-data-fetcher-images.md)

> **Note:** The public API can't search the supplier catalog by keyword yet. Start from a catalog product id or style id you already have, for example from an existing catalog line, and load every size and color of that style as shown above. See [Add line items](https://developer.yoprint.com/guides/line-items.md#a-catalog-product).

## Decoration services

No public operation lists or changes decoration services. To use one on a job, take its id from a job that already has it, or set services up in the web app. Their price tables can be imported from a CSV file: see [Export and import data](https://developer.yoprint.com/guides/imports-and-exports.md). AI apps can list and change services: see [What they can and can't do](https://developer.yoprint.com/ai-apps/capabilities.md).

## Pitfalls

- **`default_price` is in thousandths.** Send a whole number of thousandths (`15000` is 15.00). Line item prices, by contrast, are `{ value, dp }` pairs. See [Money and quantities](https://developer.yoprint.com/concepts/money-and-quantities.md).
- **Phase out instead of delete.** Phasing out is reversible, and deleting can be refused while a product is in use. Run the delete check first.
- **Phased-out products are refused on new lines**, with `422`. Existing lines keep working, but a draft holding one can't be published until the line is changed (`validation.unsellable_items`).
- **One catalog id is one size and color.** A style in four sizes is four ids.
- **Live lookups depend on the supplier.** Cache prices for a short time rather than calling for every page view.
