Skip to content

tys.products.garments.createDraft()

Method@tryyoursize/node

Starts a new draft version (sizes, POMs in mm, grading, fabric). 422 errors carry issues.

createDraft(idOrSku: string, garment: GarmentInput, options?: RequestOptions): Promise<GarmentVersion>
idOrSkustringRequired

The product's TryYourSize ID or your SKU (URL-encoded for you, so TEE/01 works).

garmentGarmentInputRequired
Properties
categoryGarmentCategoryRequired

The garment type; it sets which POMs are needed.

fit_intentFitIntentRequired

The designer's intended silhouette; sets the ease targets the fit judgement compares against.

sizesstring[]Required

Size labels, smallest to largest.

pomsPOMTableRequired

Garment measurements per size: size label → POM code → millimetres. Widths are flat half-measurements. See GET /v1/studio/garment_dictionary for codes and plausible ranges.

gradingGradingRuleOptional

How the POM table was derived: the base size's values plus, per POM, the increment (mm) between each pair of consecutive sizes (len = number of sizes - 1). The table stays the source of truth.

fabricFabricRequired

What the tech pack / mill sheet says.

import_idstringOptional

Pattern import linked to this version (omit to unlink).

seasonstringOptional

Season tag, e.g. "SS27".

tolerances_mmTolerancesMMOptional

Spec-sheet tolerance per POM code, ± mm (e.g. {"chest_width": 10}). Optional; the flat preview uses ±5 mm when a POM has none.

spec_sourceSpecSourceOptional

Where the POM table came from, kept for audit. Set by Studio's paste/import.

optionsRequestOptionsOptional

Promise<GarmentVersion>: The draft garment version, with issues that still block publishing.

import type { GarmentInput } from "@tryyoursize/node";
const garment: GarmentInput = {
category: "tshirt",
fit_intent: "regular",
sizes: ["S", "M", "L"],
poms: { S: { chest_width: 480 }, M: { chest_width: 510 }, L: { chest_width: 540 } }, // mm
fabric: { composition: [{ fiber: "cotton", pct: 100 }], weight_gsm: 180 },
};
const draft = await tys.products.garments.createDraft("TEE-001", garment);
console.log(draft.version, draft.issues); // what still blocks publishing

Was this page helpful?