Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Avelero/avelero/llms.txt

Use this file to discover all available pages before exploring further.

Create a new product in your brand’s catalog. Products can include basic information, attributes like materials and environmental impact, and journey steps.

Endpoint

trpc.products.create.mutate(input)
Router location: apps/api/src/trpc/routers/products/index.ts:319

Request parameters

name
string
required
Product name (1-100 characters)Example: "Organic Cotton T-Shirt"
brand_id
string
required
UUID of the brand. Must match the active brand context.Validation: Must be a valid UUID v4 format
product_handle
string
URL-friendly identifier for the product. Used in DPP URLs: /[brandSlug]/[productHandle]/If not provided, auto-generated from the product name.Format: Lowercase letters, numbers, and dashes only (1-100 characters)Example: "organic-cotton-tee"
description
string
Product description (max 2000 characters)Example: "A sustainable t-shirt made from 100% organic cotton."
category_id
string
UUID of the product category
season_id
string
UUID of the brand season (from brand_seasons table)
manufacturer_id
string
UUID of the manufacturer
image_path
string
Storage path for the product image (max 500 characters). Not the full URL.Example: "brand-id/products/image.jpg"
status
string
Product statusValues: "draft" or "published"Default: "draft"
tag_ids
string[]
Array of tag UUIDs to associate with the product

Materials

materials
array
Array of material compositions for the product

Journey steps

journey_steps
array
Array of production journey steps (e.g., “Design”, “Manufacturing”, “Distribution”)

Environmental data

environment
object
Environmental impact metrics

Weight

weight
object
Product weight information

Response

Returns the created product object.
data
object
The created product

Example requests

Basic product

const product = await trpc.products.create.mutate({
  brand_id: "550e8400-e29b-41d4-a716-446655440000",
  name: "Organic Cotton T-Shirt",
  description: "A sustainable t-shirt made from 100% organic cotton.",
  status: "draft"
});

console.log(product.data.upid); // "A1B2C3D4E5F6G7H8"
console.log(product.data.product_handle); // "organic-cotton-t-shirt"

Product with custom handle

const product = await trpc.products.create.mutate({
  brand_id: "550e8400-e29b-41d4-a716-446655440000",
  name: "Summer Collection Hoodie 2024",
  product_handle: "summer-hoodie-24",
  category_id: "category-uuid",
  season_id: "season-uuid"
});

Product with materials and environment

const product = await trpc.products.create.mutate({
  brand_id: "550e8400-e29b-41d4-a716-446655440000",
  name: "Recycled Polyester Jacket",
  description: "Water-resistant jacket made from recycled materials",
  materials: [
    {
      brand_material_id: "material-uuid-1",
      percentage: 80
    },
    {
      brand_material_id: "material-uuid-2",
      percentage: 20
    }
  ],
  environment: {
    carbon_kg_co2e: "15.5",
    water_liters: "3200"
  },
  weight: {
    weight: "450",
    weight_unit: "g"
  }
});

Product with journey steps

const product = await trpc.products.create.mutate({
  brand_id: "550e8400-e29b-41d4-a716-446655440000",
  name: "Premium Denim Jeans",
  journey_steps: [
    {
      sort_index: 0,
      step_type: "Design",
      operator_ids: ["operator-uuid-1"]
    },
    {
      sort_index: 1,
      step_type: "Manufacturing",
      operator_ids: ["operator-uuid-2", "operator-uuid-3"]
    },
    {
      sort_index: 2,
      step_type: "Distribution",
      operator_ids: ["operator-uuid-4"]
    }
  ]
});

Error codes

BAD_REQUEST
error
Invalid input or validation errorCommon causes:
  • Product name is empty or too long
  • Invalid product handle format (must be lowercase letters, numbers, and dashes)
  • Product handle already exists for this brand
  • Active brand does not match brand_id
  • Invalid UUID format for IDs
  • Materials percentage exceeds 100%
INTERNAL_SERVER_ERROR
error
Unexpected error during product creationMessage: "Failed to create product"

Validation rules

  • Product name: 1-100 characters, required
  • Product handle: Must be lowercase letters, numbers, and dashes only (no leading/trailing dashes)
  • Description: Max 2000 characters
  • Image path: Max 500 characters
  • Material percentage: Can be string or number
  • Journey step operator_ids: Must have at least one operator per step
  • Brand ID: Must match the active brand context

Notes

If product_handle is not provided, it will be auto-generated from the product name using the generateProductHandle() function.Example: “Special Pants” → “special-pants”
The upid (Unique Product Identifier) is always auto-generated as a 16-character alphanumeric string. You cannot provide a custom UPID.
Setting status to "published" will make the product visible in public DPP pages, but the product must have at least one variant with a published passport to be fully functional.

Source code reference

  • Schema definition: apps/api/src/schemas/products.ts:221 (productsDomainCreateSchema)
  • Implementation: apps/api/src/trpc/routers/products/index.ts:319
  • Database query: @v1/db/queries/products (createProduct)

Build docs developers (and LLMs) love