Price a basket
The landed price of a basket: each line at the price a shopper is charged, the best promotion for the basket, shipping and tax for the address, and the grand total. The steps run in the order an order is priced — the promotion first, shipping on the discounted amount, tax last — so a quote and the order placed from it agree.
A line that cannot be bought as asked is flagged with available: false and an unavailable_reason,
never dropped, and is left out of the totals. Without an address, shipping and tax report
address_required and total_is_final is false.
curl --request POST \
--url https://api.tybritelabs.com/v1/agent/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 2
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
'import requests
url = "https://api.tybritelabs.com/v1/agent/quote"
payload = {
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 2
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{variant_id: 'fbe89cdf-90a3-4050-a43b-e4c42302484a', quantity: 2},
{variant_id: '06cf8d3e-da82-4d6f-896f-d756f80c592f', quantity: 1}
],
shipping_address: {
name: 'John Doe',
line1: '350 Fifth Avenue',
city: 'New York',
state: 'NY',
postal_code: '10118',
country: 'US'
}
})
};
fetch('https://api.tybritelabs.com/v1/agent/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tybritelabs.com/v1/agent/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'variant_id' => 'fbe89cdf-90a3-4050-a43b-e4c42302484a',
'quantity' => 2
],
[
'variant_id' => '06cf8d3e-da82-4d6f-896f-d756f80c592f',
'quantity' => 1
]
],
'shipping_address' => [
'name' => 'John Doe',
'line1' => '350 Fifth Avenue',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10118',
'country' => 'US'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tybritelabs.com/v1/agent/quote"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tybritelabs.com/v1/agent/quote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tybritelabs.com/v1/agent/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"lines": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"product_id": "289533e8-f5b6-4d4f-bb23-2127875feb70",
"name": "Galactic Zip Hoodie",
"variant_name": "Grey / M",
"sku": "FEED-HOODIE-GRY-M",
"quantity": 2,
"unit_price": 48,
"list_price": 48,
"line_total": 96,
"category_name": "Wearables",
"available": true,
"stock": 25,
"unavailable_reason": null
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"product_id": "3afdb59a-7f7f-4abb-baa1-2e37709c1128",
"name": "Selling Plans Ski Wax",
"variant_name": "Selling Plans Ski Wax",
"sku": "selling-plans-ski-wax-selling-plans-ski-wax",
"quantity": 1,
"unit_price": 24.95,
"list_price": 24.95,
"line_total": 24.95,
"category_name": "General",
"available": true,
"stock": 10,
"unavailable_reason": null
}
],
"subtotal": 120.95,
"discount": {
"amount": 0,
"promotion": null
},
"shipping": {
"status": "quoted",
"amount": 1500,
"description": "USA",
"free_threshold": 100000,
"is_free": false
},
"tax": {
"status": "quoted",
"amount": 223.58,
"source": "fallback",
"prices_include_tax": true
},
"grand_total": 1620.95,
"total_is_final": true,
"unavailable_count": 0,
"currency": "EUR",
"shipping_address": {
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US",
"name": "John Doe"
}
},
"evidence": [
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"field": "resolved_price"
},
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"field": "resolved_price"
},
{
"source": "promotions",
"operation": "POST /v1/promotions/calculate-best",
"field": "discount"
},
{
"source": "shipping",
"operation": "shipping quote",
"field": "fee"
},
{
"source": "tax",
"operation": "POST /v1/tax/preview",
"field": "tax_amount"
}
],
"computed_at": "2026-09-28T21:53:38.925Z",
"currency": "EUR",
"environment": "sandbox"
}{
"error": {
"code": "invalid_request",
"message": "items must be a non-empty array of { variant_id, quantity }"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing or invalid Authorization header"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests for this API key. Please slow down and try again shortly.",
"remaining": 0,
"reset": 1706198400
}
}{
"error": {
"code": "server_error",
"message": "An unexpected error occurred"
}
}Authorizations
API Key Authentication
Use your API key in the Authorization header:
Authorization: Bearer tybrite_sk_live_YOUR_KEY
Key Types:
Secret Keys (Server-Side Only):
- Format:
tybrite_sk_live_*(production) ortybrite_sk_test_*(sandbox) - Full read/write access to all endpoints
- ⚠️ NEVER expose in client-side code or public repositories
- Required for: write operations, authentication, payment verification, AI recommendations
Publishable Keys (Client-Safe):
- Format:
tybrite_pk_live_*(production) ortybrite_pk_test_*(sandbox) - Read-only access (GET requests only, plus POST semantic search)
- ✅ Safe for client-side JavaScript, mobile apps, and public code
- Allowed for: browsing products, search, CMS content, pricing queries
Endpoint-Specific Requirements:
- Authentication endpoints (
/v1/auth/*): Secret key required - Payment verification (
POST /v1/payments/verify): Secret key required - AI Recommendations (
POST /v1/recommendations): Secret key required - Semantic Search (
POST /v1/search): Both key types allowed (read-only operation) - All write operations: Secret key required
- All read operations: Both key types allowed
Using a publishable key for restricted operations returns 403 Forbidden.
Query Parameters
Comma-separated top-level keys of data to return, e.g. fields=grand_total,lines.
Body
Response
The quote
Show child attributes
Show child attributes
Where each figure in data was read from.
Show child attributes
Show child attributes
production, sandbox ISO 4217 code every amount in data is expressed in.
curl --request POST \
--url https://api.tybritelabs.com/v1/agent/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 2
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
'import requests
url = "https://api.tybritelabs.com/v1/agent/quote"
payload = {
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 2
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{variant_id: 'fbe89cdf-90a3-4050-a43b-e4c42302484a', quantity: 2},
{variant_id: '06cf8d3e-da82-4d6f-896f-d756f80c592f', quantity: 1}
],
shipping_address: {
name: 'John Doe',
line1: '350 Fifth Avenue',
city: 'New York',
state: 'NY',
postal_code: '10118',
country: 'US'
}
})
};
fetch('https://api.tybritelabs.com/v1/agent/quote', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tybritelabs.com/v1/agent/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'variant_id' => 'fbe89cdf-90a3-4050-a43b-e4c42302484a',
'quantity' => 2
],
[
'variant_id' => '06cf8d3e-da82-4d6f-896f-d756f80c592f',
'quantity' => 1
]
],
'shipping_address' => [
'name' => 'John Doe',
'line1' => '350 Fifth Avenue',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10118',
'country' => 'US'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tybritelabs.com/v1/agent/quote"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tybritelabs.com/v1/agent/quote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tybritelabs.com/v1/agent/quote")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\n \"quantity\": 2\n },\n {\n \"variant_id\": \"06cf8d3e-da82-4d6f-896f-d756f80c592f\",\n \"quantity\": 1\n }\n ],\n \"shipping_address\": {\n \"name\": \"John Doe\",\n \"line1\": \"350 Fifth Avenue\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10118\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"lines": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"product_id": "289533e8-f5b6-4d4f-bb23-2127875feb70",
"name": "Galactic Zip Hoodie",
"variant_name": "Grey / M",
"sku": "FEED-HOODIE-GRY-M",
"quantity": 2,
"unit_price": 48,
"list_price": 48,
"line_total": 96,
"category_name": "Wearables",
"available": true,
"stock": 25,
"unavailable_reason": null
},
{
"variant_id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"product_id": "3afdb59a-7f7f-4abb-baa1-2e37709c1128",
"name": "Selling Plans Ski Wax",
"variant_name": "Selling Plans Ski Wax",
"sku": "selling-plans-ski-wax-selling-plans-ski-wax",
"quantity": 1,
"unit_price": 24.95,
"list_price": 24.95,
"line_total": 24.95,
"category_name": "General",
"available": true,
"stock": 10,
"unavailable_reason": null
}
],
"subtotal": 120.95,
"discount": {
"amount": 0,
"promotion": null
},
"shipping": {
"status": "quoted",
"amount": 1500,
"description": "USA",
"free_threshold": 100000,
"is_free": false
},
"tax": {
"status": "quoted",
"amount": 223.58,
"source": "fallback",
"prices_include_tax": true
},
"grand_total": 1620.95,
"total_is_final": true,
"unavailable_count": 0,
"currency": "EUR",
"shipping_address": {
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US",
"name": "John Doe"
}
},
"evidence": [
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"field": "resolved_price"
},
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "06cf8d3e-da82-4d6f-896f-d756f80c592f",
"field": "resolved_price"
},
{
"source": "promotions",
"operation": "POST /v1/promotions/calculate-best",
"field": "discount"
},
{
"source": "shipping",
"operation": "shipping quote",
"field": "fee"
},
{
"source": "tax",
"operation": "POST /v1/tax/preview",
"field": "tax_amount"
}
],
"computed_at": "2026-09-28T21:53:38.925Z",
"currency": "EUR",
"environment": "sandbox"
}{
"error": {
"code": "invalid_request",
"message": "items must be a non-empty array of { variant_id, quantity }"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing or invalid Authorization header"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests for this API key. Please slow down and try again shortly.",
"remaining": 0,
"reset": 1706198400
}
}{
"error": {
"code": "server_error",
"message": "An unexpected error occurred"
}
}
