commerce $0.0003 / call
GTIN Validate
Validate GTIN-8, UPC/GTIN-12, EAN/GTIN-13 and GTIN-14 check digits; no product lookup.
commerce.gtin-validatecommerce.pack-plan · v1.0.0
Choose the lowest-cost whole-pack combination for a required count with exact prices and explicit pack limits; up to 20 interchangeable offers.
{
"currency": "USD",
"minorUnitDigits": 2,
"requiredUnits": 12,
"offers": [
{
"id": "six-pack",
"unitsPerPack": 6,
"price": "7.99",
"maxPacks": 10
},
{
"id": "ten-pack",
"unitsPerPack": 10,
"price": "11.99",
"maxPacks": 10
}
]
}{
"currency": "USD",
"minorUnitDigits": 2,
"requiredUnits": 12,
"feasible": true,
"totalUnits": 12,
"excessUnits": 0,
"itemSubtotal": "15.98",
"packCount": 2,
"lines": [
{
"id": "six-pack",
"packs": 2,
"units": 12,
"lineSubtotal": "15.98"
}
],
"scope": "Minimum item subtotal within supplied pack limits; ties prefer fewer excess units, then fewer packs. Offers must be interchangeable units of the same product and currency. No stock verification, shipping, tax, fees, discounts, product-equivalence checks or order placement. Infeasible means supplied limits cannot meet the requested quantity."
}Generated from the actual handler using this example input; this is a preview, not a paid API call. Paid responses wrap the result with a receipt and recovery expiry.
Add credits in the workspace and keep your API key in private environment storage. Use the same request ID and exact body to recover a lost response within ten minutes.
// Node.js 22+. Read the key from your private environment.
const requestId = Date.now() + '_' + crypto.randomUUID();
const response = await fetch('https://agent-utilities.agent-utilities.workers.dev/v1/tools/commerce.pack-plan', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + process.env.AGENT_UTILITIES_API_KEY,
'Idempotency-Key': requestId
},
body: JSON.stringify({
"currency": "USD",
"minorUnitDigits": 2,
"requiredUnits": 12,
"offers": [
{
"id": "six-pack",
"unitsPerPack": 6,
"price": "7.99",
"maxPacks": 10
},
{
"id": "ten-pack",
"unitsPerPack": 10,
"price": "11.99",
"maxPacks": 10
}
]
})
});
const data = await response.json();
if (!response.ok) throw new Error(data.error?.message ?? 'Request failed');
console.log(data);
// On response loss, retry this SAME requestId, tool and body.
// Do not rerun the line that generates requestId for a retry.{
"type": "object",
"properties": {
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"minorUnitDigits": {
"type": "integer",
"minimum": 0,
"maximum": 6
},
"requiredUnits": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"offers": {
"type": "array",
"minItems": 1,
"maxItems": 20,
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"unitsPerPack": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"price": {
"type": "string",
"pattern": "^(0|[1-9]\\d{0,11})(\\.\\d{1,6})?$",
"maxLength": 19
},
"maxPacks": {
"type": "integer",
"minimum": 0,
"maximum": 1000
}
},
"required": [
"id",
"unitsPerPack",
"price",
"maxPacks"
],
"additionalProperties": false
}
}
},
"required": [
"currency",
"minorUnitDigits",
"requiredUnits",
"offers"
],
"additionalProperties": false
}{
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"minorUnitDigits": {
"type": "number"
},
"requiredUnits": {
"type": "number"
},
"feasible": {
"type": "boolean"
},
"totalUnits": {
"type": [
"integer",
"null"
]
},
"excessUnits": {
"type": [
"integer",
"null"
]
},
"itemSubtotal": {
"type": [
"string",
"null"
]
},
"packCount": {
"type": [
"integer",
"null"
]
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"packs": {
"type": "number"
},
"units": {
"type": "number"
},
"lineSubtotal": {
"type": "string"
}
},
"required": [
"id",
"packs",
"units",
"lineSubtotal"
],
"additionalProperties": false
}
},
"scope": {
"type": "string"
}
},
"required": [
"currency",
"minorUnitDigits",
"requiredUnits",
"feasible",
"totalUnits",
"excessUnits",
"itemSubtotal",
"packCount",
"lines",
"scope"
],
"additionalProperties": false
}Prices are experimental. The service currently allows 1,000 new calls per day across all accounts. Failed operations return reserved credits. Successful results are encrypted for ten-minute retry recovery. Review data handling and service limits.
commerce $0.0003 / call
Validate GTIN-8, UPC/GTIN-12, EAN/GTIN-13 and GTIN-14 check digits; no product lookup.
commerce.gtin-validatecommerce $0.0005 / call
Compare requested product attributes with an offered variant and list missing or mismatched fields.
commerce.variant-comparecommerce $0.0003 / call
Normalize up to 50 displayed prices with explicit locale, currency and decimal scale; exact amounts, strict grouping and per-price errors.
commerce.money-parse