Skip to content

Load a product for a sales order line

Open .md

POST/v1/api/store/{team_slug}/hydrate_product

v1Operation ID v1_public_hydrate_imported_product

Returns a product with every option you can sell, in the shape sales order line pickers use: size_data, color_data and attr_data (one row per size and color combination). It is also how you get a supplier catalog style's size and color ids. Read-only.

What id names depends on type. Your own simple product is db_simple here (and on stock levels), but user_simple on sales order lines.

type id What comes back
db_simple or custom One of your products A simple product (type: simple) with its price, or a variant product (type: variant) with its live variants in attr_data.
db_variant One of your variants Its whole parent product (type: variant).
db_catalog A catalog product id: one size and color, such as ssa-B00000001 Its whole catalog style (type: variant_catalog).
db_catalog_style A catalog style id, such as ssa-5000 The same style.

A supplier catalog product, step by step

  1. Start from a catalog id you have: the product id of an existing catalog sales order line (send it as db_catalog), or a style id (db_catalog_style). Catalog ids are the supplier code, a dash, then the supplier's own key. A style id ends in the supplier's style key: for SanMar (smr) that is the style number people see; other suppliers use their own key, which is not always the style number shown (S&S Activewear's is S&S's own style key; the style number people see comes back as style_name). The public API can't search the catalog by keyword.
  2. Call this operation. In attr_data, pick the row by size_label and color_label. Its id is the catalog product id and its provider is the supplier code.
  3. Get the supplier cost with Get live supplier pricing, sending that id.
  4. Add the line with Add a line item: product.properties.id is the row's id and pricing.catalog.provider is the row's provider.

Supplier codes: ssa S&S Activewear, ssaca S&S Activewear Canada, smr SanMar, sanmar_ca SanMar Canada, agst Momentec (Augusta Sportswear), agstca Momentec Canada, asc AS Colour. Older catalogs with stored prices only: alp and alpca (AlphaBroder), conde, tsf, deltapp (Delta Apparel).

Permission

Any member of the team.

Business rules

  • Deleted products and variants are not found (404).
  • Catalog lookups read YoPrint's copy of the supplier catalogs; they make no call to the supplier.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team

Request body

application/json, required.

  • idstringrequired

    A product or variant hash id, or a catalog id (catalog ids are plain strings such as ssa-B00000001).

  • typestringrequired
    • One of: "db_simple", "custom", "db_variant", "db_catalog", "db_catalog_style"
  • contextstring | null

    mockup_editor also refuses catalog products the team can't use for mockups.

    • One of: "mockup_editor"
More examples (1)

One of your variant products

curl
curl -X POST 'https://secure.yoprint.com/v1/api/store/your-team/hydrate_product' \  -H 'Authorization: Bearer YOUR_API_KEY' \  -H 'Accept: application/json' \  -H 'X-Yoprint-Decimal-Format: exact-v1' \  -H 'Content-Type: application/json' \  -d '{    "id": "Xe3wCbaZYrxJAI",    "type": "db_simple"  }'

Response

200Successful response.

  • dataobjectrequired

    One of, picked by type:

    A supplier catalog stylevariant_catalog

    type is variant_catalog. attr_data lists every size and color of the style.

    • typestringrequired
      • Always "variant_catalog"
    • trashedboolean
      • Always false
    • attr_dataarray of objectsrequired

      One row per size and color, most recently updated first.

      Fields of each item (13)
      • availableboolean
        • Always true
      • dscntbooleanrequired

        Discontinued: true when the supplier discontinued the variant. For S&S Activewear, also true when the variant was not updated in the last 16 days.

      • idstringrequired

        The catalog product id, such as ssa-B00000001: the db_catalog line's product id and the id for live pricing.

      • providerstringrequired

        The supplier code, such as ssa: send it as the line's pricing.catalog.provider.

      • color_hexstring | null
      • color_idstring | null
      • color_imagestring | null
      • color_labelstring | null
      • Display discontinued status: true when YoPrint displays the discontinued badge for this variant.

      • size_idstring | null
      • size_labelstring | null
      • updated_atstring (date-time)
      • weightnumber | string | null
    • idstringrequired

      The style id, such as ssa-5000.

    • style_idstringrequired

      The same as id.

    • variant_typestringrequired
      • One of: "size", "color", "size_color", "none"
    • brandstring | null
    • color_dataarray of objects
      Fields of each item (4)
      • idstringrequired
      • labelstringrequired
      • hexstring
      • imagestring

        A color swatch image URL, when the supplier has one.

    • Display discontinued status: true when YoPrint displays the discontinued badge for this style.

    • dscntboolean

      Discontinued: true when the supplier discontinued the style.

    • product_typestring | null

      The supplier, such as SSActivewear or SanMar.

    • size_dataarray of objects
      Fields of each item (2)
      • idstringrequired
      • labelstring | nullrequired
    • style_namestring | null

      The style number people see.

    • titlestring | null
    Your variant productvariant

    type is variant. attr_data lists its live variants.

    • typestringrequired
      • Always "variant"
      • Always "variant"
    • attr_dataarray of objectsrequired

      One row per live variant.

      Fields of each item (13)
      • idstringrequired

        The variant id: the db_variant line's product id.

      • phased_outbooleanrequired

        True: new sales order and quote lines refuse this variant.

      • priceinteger | number | stringrequired

        The variant's default_price. Never null. Thousandths, an older encoding: 12500 is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5 is 1.2345), or as a string ("1234.5") when you send X-Yoprint-Decimal-Format: exact-v1. See Money and quantities.

      • availableboolean

        The variant's enabled flag. Nothing enforces it: use phased_out.

      • color_hexstring | null
      • color_idstring | null
      • Always empty for your own products.

      • color_labelstring | null
      • size_idstring | null
      • size_labelstring | null
      • supplier_idstring | null
      • Always false here: deleted variants are left out.

      • weightnumber | string | null
    • color_dataarray of objectsrequired
      Fields of each item (3)
      • idstringrequired
      • labelstring | nullrequired
      • hexstring | null
    • idstringrequired

      The product id.

    • size_dataarray of objectsrequired
      Fields of each item (2)
      • idstringrequired
      • labelstring | nullrequired
    • variant_typestringrequired
      • One of: "size", "color", "size_color"
    • brandstring | null
    • descriptionstring | null
    • style_idstring

      The same as id.

    • titlestring | null
    • trashedboolean
    Your simple productsimple

    type is simple.

    • typestringrequired
      • Always "simple"
      • Always "simple"
    • idstringrequired

      The product id: the user_simple line's product id.

    • phased_outbooleanrequired

      True: new sales order and quote lines refuse it.

    • priceinteger | number | string | nullrequired

      The selling price before pricing rules: default_price. Null when not set. Thousandths, an older encoding: 12500 is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5 is 1.2345), or as a string ("1234.5") when you send X-Yoprint-Decimal-Format: exact-v1. See Money and quantities.

    • titlestring | nullrequired
    • trashedbooleanrequired
    • brandstring | null
    • descriptionstring | null
    • phased_out_atstring (date-time) | null
    • supplier_idstring | null
    • weightnumber | string | null
  • statusintegerrequired
  • successbooleanrequired

Errors

  • 401The API key is missing or wrong (unauthenticated).

  • 403You are not allowed to do this. api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only {"message": "Insufficient Permission"}. Other refusals use the error envelope, with unauthorized or user_is_not_authorized.

  • 404Not found. page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. code: null, with a message that starts "No query results for": there is no record with that id.

    When
    A catalog product without a style, a catalog style without products, a variant without its product, or, with context: mockup_editor, a catalog style the team can't use for mockups: error.code is the number 404 and error.message is product_not_found. Nothing with this id at all (or a deleted product): error.code null.
    Fix
    Check type and id.
  • 422The request was refused and changed nothing. validation_failed lists what to fix in error.fields; other codes name a business rule, explained in error.message. A few checks answer with only {"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answer connect_timeout ("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.

    When
    type is not one of the five, id is missing, or context is not mockup_editor. error.code is validation_failed.
    Fix
    Send both.