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.

Brand attributes are variant dimensions that define how products can vary. Attributes can optionally link to taxonomy attributes for semantic meaning and standardization.

List attributes

Retrieve all attributes for your brand with usage metrics.
const result = await trpc.catalog.attributes.list.query();

Response

Returns an array of attributes with metrics:
data
array
required
Array of attribute objects
id
string
required
Unique identifier (UUID)
brandId
string
required
Brand that owns this attribute
name
string
required
Attribute name (e.g., “Color”, “Size”, “Material”)
taxonomyAttributeId
string | null
Optional link to taxonomy attribute for semantic meaning
values_count
number
required
Number of attribute values defined for this attribute
variants_count
number
required
Number of product variants using this attribute
createdAt
string
required
ISO 8601 timestamp
updatedAt
string
required
ISO 8601 timestamp
The metrics include:
  • values_count: How many options (values) are defined for this dimension
  • variants_count: How many product variants use this attribute

List attributes with values

Retrieve attributes grouped with their values in a single query.
const result = await trpc.catalog.attributes.listGrouped.query();

Response

data
array
required
Array of attributes with nested values
id
string
required
Attribute ID
name
string
required
Attribute name
taxonomyAttributeId
string | null
Optional taxonomy link
values_count
number
required
Number of values for this attribute
variants_count
number
required
Number of variants using this attribute
values
array
required
Array of attribute values
id
string
required
Value ID
name
string
required
Value name (e.g., “Red”, “Blue”)
attributeId
string
required
Parent attribute ID
taxonomyValueId
string | null
Optional taxonomy value link
sortOrder
number | null
Display order (null values sorted last)
variants_count
number
required
Number of variants using this value
metadata
object
Additional JSON metadata
createdAt
string
required
ISO 8601 timestamp

Create attribute

Create a new brand attribute.
const result = await trpc.catalog.attributes.create.mutate({
  name: "Size",
  taxonomy_attribute_id: "550e8400-e29b-41d4-a716-446655440000" // optional
});

Request

name
string
required
Attribute name (1-100 characters)Examples: “Color”, “Size”, “Material”, “Fit”
taxonomy_attribute_id
string
Optional UUID linking to a taxonomy attribute for standardizationWhen linked, this attribute gains semantic meaning from the taxonomy system.

Response

data
object
required
id
string
required
ID of the created attribute

Validation rules

  • name is trimmed and must be 1-100 characters after trimming
  • Attribute names must be unique per brand (case-sensitive)
  • taxonomy_attribute_id must be a valid UUID if provided

Error handling

{
  "code": "BAD_REQUEST",
  "message": "An attribute with this name already exists"
}

Update attribute

Update an existing attribute.
const result = await trpc.catalog.attributes.update.mutate({
  id: "550e8400-e29b-41d4-a716-446655440000",
  name: "Product Color"
});

Request

id
string
required
Attribute ID (UUID)
name
string
New attribute name (1-100 characters)
taxonomy_attribute_id
string | null
Update or clear taxonomy linkPass null to remove the taxonomy link.

Response

data
object
required
id
string
required
ID of the updated attribute
Only provided fields are updated. Omitted fields remain unchanged.

Error handling

{
  "code": "NOT_FOUND",
  "message": "attribute with ID '...' not found"
}

Delete attribute

Delete an attribute if it’s not in use.
const result = await trpc.catalog.attributes.delete.mutate({
  id: "550e8400-e29b-41d4-a716-446655440000"
});

Request

id
string
required
Attribute ID (UUID)

Response

data
object
required
id
string
required
ID of the deleted attribute

Business rules

Attributes cannot be deleted if they are referenced by any product variants.
The API performs a reference check before deletion:
  1. Counts variant references via product_variant_attributes table
  2. If count > 0, deletion is rejected
  3. Otherwise, attribute and all its values are deleted

Error handling

{
  "code": "BAD_REQUEST",
  "message": "This attribute can't be deleted because it is referenced on your variants"
}

TypeScript types

All procedures are fully typed when using the tRPC client:
import type { AppRouter } from "@v1/api";
import { createTRPCClient } from "@trpc/client";

const trpc = createTRPCClient<AppRouter>({
  // ... config
});

// Fully typed request and response
const result = await trpc.catalog.attributes.create.mutate({
  name: "Size",
  taxonomy_attribute_id: "..."
});
// result.data.id is typed as string

// Type inference for list results
const list = await trpc.catalog.attributes.list.query();
// list.data is typed as BrandAttributeData[]
for (const attr of list.data) {
  console.log(attr.name); // typed as string
  console.log(attr.variants_count); // typed as number
}

Schema types

// Request schemas
type CreateBrandAttributeSchema = {
  name: string; // 1-100 chars
  taxonomy_attribute_id?: string | null; // UUID
};

type UpdateBrandAttributeSchema = {
  id: string; // UUID, required
  name?: string; // 1-100 chars
  taxonomy_attribute_id?: string | null; // UUID
};

type DeleteBrandAttributeSchema = {
  id: string; // UUID
};

// Response types
type BrandAttributeData = {
  id: string;
  brandId: string;
  taxonomyAttributeId: string | null;
  name: string;
  createdAt: string; // ISO 8601
  updatedAt: string; // ISO 8601
};

type BrandAttributeWithMetrics = BrandAttributeData & {
  values_count: number;
  variants_count: number;
};

Common patterns

Creating a complete variant dimension

Create an attribute and its values in sequence:
// 1. Create the attribute
const attrResult = await trpc.catalog.attributes.create.mutate({
  name: "Color"
});

const attributeId = attrResult.data.id;

// 2. Create values for the attribute
const values = ["Red", "Blue", "Green"];
for (const name of values) {
  await trpc.catalog.attributeValues.create.mutate({
    attribute_id: attributeId,
    name
  });
}
For bulk value creation, use the batch endpoint:
await trpc.catalog.attributeValues.batchCreate.mutate({
  values: [
    { attribute_id: attributeId, name: "Red" },
    { attribute_id: attributeId, name: "Blue" },
    { attribute_id: attributeId, name: "Green" }
  ]
});

Checking usage before deletion

const attrs = await trpc.catalog.attributes.list.query();

// Find unused attributes
const unused = attrs.data.filter(attr => attr.variants_count === 0);

// Safe to delete
for (const attr of unused) {
  await trpc.catalog.attributes.delete.mutate({ id: attr.id });
}

Build docs developers (and LLMs) love