Skip to main content

Products Guide

Use the Partner API to fetch product information by an article number (also called a style) or by a SKU. This guide uses the GET /products endpoint with an OData $filter query.

Before you start​

Base URLs​

Choose the URL for the environment you are integrating with:

EnvironmentBase URL
Productionhttps://api.carbontrail.net/partner/v1.0
Staginghttps://staging.api.carbontrail.net/partner/api/v1.0

The examples below use BASE_URL so that the same request works with either environment.

Authentication​

Create an API key in the Carbon Trail Portal and send it in the Authorization header of every request:

Authorization: ApiKey ctk_v1_xxx

Keep the API key secret and do not commit it to source control. You also need the Carbon Trail organization ID supplied when your integration was provisioned.

For example, set these variables before running the requests in this guide:

export BASE_URL="https://api.carbontrail.net/partner/v1.0"
export ORGANIZATION_ID="YOUR_ORGANIZATION_ID"
export CARBON_TRAIL_API_KEY="ctk_v1_xxx"

To use staging, set BASE_URL to https://staging.api.carbontrail.net/partner/api/v1.0 and use credentials for that environment.

Fetch a product by article number (style)​

The product's style identifier is returned in the articleNumber field. Filter that field with the OData eq operator:

curl --get \
"$BASE_URL/organizations/$ORGANIZATION_ID/products" \
--header "Authorization: ApiKey $CARBON_TRAIL_API_KEY" \
--header "Accept: application/json" \
--data-urlencode "\$filter=articleNumber eq 'ABC-001'"

An article number can be shared by several variants. The endpoint therefore returns a paginated collection even when a filter is supplied; process every product in data that matches the style.

Fetch a product by SKU​

To look up a specific stock-keeping unit, filter the sku field:

curl --get \
"$BASE_URL/organizations/$ORGANIZATION_ID/products" \
--header "Authorization: ApiKey $CARBON_TRAIL_API_KEY" \
--header "Accept: application/json" \
--data-urlencode "\$filter=sku eq 'ABC-001-BLK-M'"

--data-urlencode safely encodes the $filter expression as a query parameter. The resulting request is equivalent to:

GET /organizations/{organizationId}/products?$filter=sku%20eq%20%27ABC-001-BLK-M%27

Read the response​

A successful response contains the matching products in data and pagination metadata:

{
"data": [
{
"name": "Cotton T-Shirt",
"category": "Apparel",
"type": "T-shirts",
"articleNumber": "ABC-001",
"sku": "ABC-001-BLK-M",
"weightInGms": {
"value": 250
},
"status": "Submitted",
"certifications": [
"RCS - Recycled Claim Standard"
],
"passportEnabled": true,
"segment": "Non-Sport",
"sizing": {
"demographic": "Men",
"size": "S"
},
"subSegment": "Knit",
"imageUrls": [
"https://test.com"
],
"recyclability": "Entirely Recyclable",
"traits": [
"Reusable",
"Non-Reusable"
],
"repairInfo": {
"availabilityOfSpareParts": true
},
"productSellingPrice": {
"value": {
"value": 10,
"unit": "EUR"
}
},
"gtiNs": [
"abc"
],
"accessories": [
{
"type": "Care label",
"amount": {
"value": 0.397
},
"unit": {
"value": "g"
}
}
],
"packaging": {
"materials": [
{
"value": {
"material": "Polybag",
"type": "Primary",
"weightInGms": {
"value": 5
}
}
},
{
"value": {
"material": "Corrugated cardboard",
"type": "Secondary",
"weightInGms": {
"value": 40
}
}
}
],
"noPackagingUsed": {
"value": false
},
"excludedPackaging": []
},
"components": [
{
"type": "Fabric",
"sku": "FAB-COTTON-001",
"amount": {
"value": 100
},
"unit": {
"value": "Gram"
},
"componentProduct": {
"category": "Fabric",
"type": "Fabric",
"name": "Cotton Jersey Fabric",
"sku": "FAB-COTTON-001",
"articleNumber": "FAB-001",
"amount": 100,
"unit": "Gram",
"fabricFormationType": "Knit",
"gsm": 180,
"materials": [
{
"name": "Cotton - Organic",
"materialPercentageInComponent": 95,
"supplierLocation": {
"value": {
"country": "IN",
"countryName": "India",
"city": "Mumbai"
}
},
"certifications": [
"GOTS - Global Organic Textile Standard"
]
},
{
"name": "Elastane",
"materialPercentageInComponent": 5,
"supplierLocation": {
"value": {
"country": "CN",
"countryName": "China"
}
}
}
],
"manufacturingDetails": {
"manufacturingLocation": {
"value": {
"country": "BD"
}
},
"processes": []
}
}
},
{
"type": "Component",
"sku": "BTN-001",
"amount": {
"value": 100
},
"unit": {
"value": "Gram"
},
"componentProduct": {
"category": "Component",
"type": "Component",
"name": "Plastic Button",
"sku": "BTN-001",
"articleNumber": "BTN-001",
"amount": 100,
"unit": "Gram",
"materials": [
{
"name": "Polyester - Fossil",
"materialPercentageInComponent": 100,
"supplierLocation": {
"value": {
"country": "VN",
"countryName": "Vietnam"
}
}
}
],
"manufacturingDetails": {
"manufacturingLocation": {
"value": {
"country": "CN"
}
},
"processes": []
}
}
}
],
"manufacturingDetails": {
"manufacturingLocation": {
"value": {
"country": "IN"
}
}
}
}
],
"page": 1,
"pageSize": 10,
"totalCount": 1
}

An empty data array means that no product in the organization matched the filter. Check totalCount and pagination fields rather than assuming the response is a single product object.

Products and nested components​

A Carbon Trail product is made up of zero or more entries in its components array. Each component describes how another product is used within its parent, including fields such as:

  • type and sku, which identify the component
  • amount, amountType, unit, and loss, which describe how much of it is used
  • componentProduct, which contains the component's product details

Component products can have their own components array. This makes the structure recursive: a finished product can contain a fabric, trim, or other component, and that component can itself be made from more components.

Product
└── components[]
└── componentProduct
└── components[]
└── componentProduct
└── ...

The response example above contains fabric and button component products. If either of those component products is itself assembled from other products, it can contain another components array following the same shape.

When consuming a product response, traverse components recursively if you need the full product breakdown. Treat components and componentProduct as optional: a product may have no components.