Load a product for a sales order line
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/products/v1-hydrate-imported-product.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
POST/
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
- 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 asstyle_name). The public API can't search the catalog by keyword. - Call this operation. In
attr_data, pick the row bysize_labelandcolor_label. Itsidis the catalog product id and itsprovideris the supplier code. - Get the supplier cost with Get live supplier pricing, sending that
id. - Add the line with Add a line item:
product.properties.idis the row'sidandpricing.catalog.provideris the row'sprovider.
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).
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
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
Request body
application/json, required.
A product or variant hash id, or a catalog id (catalog ids are plain strings such as
ssa-B00000001).- One of:
"db_simple","custom","db_variant","db_catalog","db_catalog_style"
- One of:
contextstring | nullmockup_editoralso refuses catalog products the team can't use for mockups.- One of:
"mockup_editor"
- One of:
More examples (1)
One of your variant products
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.
One of, picked by
type:A supplier catalog style
variant_catalogtypeisvariant_catalog.attr_datalists every size and color of the style.- Always
"variant_catalog"
- Always
trashedboolean- Always
false
- Always
One row per size and color, most recently updated first.
Fields of each item (13)
availableboolean- Always
true
- Always
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.
The catalog product id, such as
ssa-B00000001: thedb_catalogline's product id and the id for live pricing.The supplier code, such as
ssa: send it as the line'spricing.catalog.provider.color_hexstring | nullcolor_idstring | nullcolor_imagestring | nullcolor_labelstring | nulldisplay_dscntbooleanDisplay discontinued status: true when YoPrint displays the discontinued badge for this variant.
size_idstring | nullsize_labelstring | nullupdated_atstring (date-time)weightnumber | string | null
The style id, such as
ssa-5000.The same as
id.- One of:
"size","color","size_color","none"
- One of:
brandstring | nullcolor_dataarray of objectsdisplay_dscntbooleanDisplay discontinued status: true when YoPrint displays the discontinued badge for this style.
dscntbooleanDiscontinued: true when the supplier discontinued the style.
product_typestring | nullThe supplier, such as
SSActivewearorSanMar.size_dataarray of objectsstyle_namestring | nullThe style number people see.
titlestring | null
Your variant product
varianttypeisvariant.attr_datalists its live variants.- Always
"variant"
- Always
product_typestring- Always
"variant"
- Always
One row per live variant.
Fields of each item (13)
The variant id: the
db_variantline's product id.True: new sales order and quote lines refuse this variant.
The variant's
default_price. Never null. Thousandths, an older encoding:12500is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5is 1.2345), or as a string ("1234.5") when you sendX-Yoprint-Decimal-Format: exact-v1. See Money and quantities.availablebooleanThe variant's enabled flag. Nothing enforces it: use
phased_out.color_hexstring | nullcolor_idstring | nullcolor_imagestringAlways empty for your own products.
color_labelstring | nullsize_idstring | nullsize_labelstring | nullsupplier_idstring | nullvariant_deletedbooleanAlways false here: deleted variants are left out.
weightnumber | string | null
The product id.
- One of:
"size","color","size_color"
- One of:
brandstring | nulldescriptionstring | nullstyle_idstringThe same as
id.titlestring | nulltrashedboolean
Your simple product
simpletypeissimple.- Always
"simple"
- Always
product_typestring- Always
"simple"
- Always
The product id: the
user_simpleline's product id.True: new sales order and quote lines refuse it.
The selling price before pricing rules:
default_price. Null when not set. Thousandths, an older encoding:12500is 12.50. Usually a whole number; an amount finer than a thousandth comes back as a number with a fraction (1234.5is 1.2345), or as a string ("1234.5") when you sendX-Yoprint-Decimal-Format: exact-v1. See Money and quantities.brandstring | nulldescriptionstring | nullphased_out_atstring (date-time) | nullsupplier_idstring | nullweightnumber | string | null
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, withunauthorizedoruser_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.codeis the number404anderror.messageisproduct_not_found. Nothing with this id at all (or a deleted product):error.codenull. - Fix
- Check
typeandid.
422The request was refused and changed nothing.
validation_failedlists what to fix inerror.fields; other codes name a business rule, explained inerror.message. A few checks answer with only{"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answerconnect_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
typeis not one of the five,idis missing, orcontextis notmockup_editor.error.codeisvalidation_failed.- Fix
- Send both.
Related
- POSTGet live supplier pricing for catalog products
/v1/ api/ store/ {team_slug}/ real_time_data_fetcher/ pricing - POSTAdd a line item to a sales order or quote
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {order_unique_key}/ order_item - POSTGet stock levels for products
/v1/ api/ store/ {team_slug}/ product_stock
