Create a checkout intent
An agent’s hand-off to the shopper. The basket is priced for the address, the price is frozen, and the
stock is held until the intent expires (30 minutes). The response carries a confirmation_token, once:
it is stored only as a hash, so a replay of the same Idempotency-Key returns the intent without it.
No order exists and nothing is charged until the shopper confirms.
The intent is refused when a line cannot be bought (409 items_unavailable), the store does not deliver
to the address (409 shipping_not_deliverable), or shipping or tax cannot be priced for it
(409 quote_incomplete); each carries the quote in error.details.
A shopper credential, when sent, ties the intent to that shopper, who must then confirm with it.
curl --request POST \
--url https://api.tybritelabs.com/v1/agent/checkout-intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"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/checkout-intents"
payload = {
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [{variant_id: 'fbe89cdf-90a3-4050-a43b-e4c42302484a', 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/checkout-intents', 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/checkout-intents",
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' => 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",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/checkout-intents"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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("Idempotency-Key", "<idempotency-key>")
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/checkout-intents")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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/checkout-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending_confirmation",
"confirmation_mode": "token",
"confirmation_token": "<string>",
"confirmation_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total": 123,
"currency": "<string>",
"items": [
{
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 50
}
],
"quote": {
"lines": [
{
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"variant_name": "<string>",
"sku": "<string>",
"quantity": 123,
"unit_price": 123,
"list_price": 123,
"line_total": 123,
"category_name": "<string>",
"available": true,
"stock": 123,
"unavailable_reason": "not_found"
}
],
"subtotal": 123,
"discount": {
"amount": 123,
"promotion": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"type": "<string>"
}
},
"shipping": {
"status": "quoted",
"amount": 123,
"description": "<string>",
"free_threshold": 123,
"is_free": true
},
"tax": {
"status": "quoted",
"amount": 123,
"source": "automatic",
"prices_include_tax": true
},
"grand_total": 123,
"total_is_final": true,
"unavailable_count": 123,
"currency": "<string>",
"shipping_address": {}
},
"created_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z"
},
"evidence": [
{
"source": "<string>",
"operation": "<string>",
"id": "<string>",
"field": "<string>",
"note": "<string>"
}
],
"computed_at": "2023-11-07T05:31:56Z",
"environment": "production",
"currency": "<string>"
}{
"data": {
"id": "0ff91bd6-aa86-4ef6-8242-fe8644bca1bb",
"status": "pending_confirmation",
"confirmation_mode": "token",
"expires_at": "2026-09-28T22:24:09.629+00:00",
"order_id": null,
"customer_id": null,
"total": 1548,
"currency": "EUR",
"items": [
{
"quantity": 1,
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a"
}
],
"quote": {
"tax": {
"amount": 213.52,
"source": "fallback",
"status": "quoted",
"prices_include_tax": true
},
"lines": [
{
"sku": "FEED-HOODIE-GRY-M",
"name": "Galactic Zip Hoodie",
"stock": 25,
"quantity": 1,
"available": true,
"line_total": 48,
"list_price": 48,
"product_id": "289533e8-f5b6-4d4f-bb23-2127875feb70",
"unit_price": 48,
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"variant_name": "Grey / M",
"category_name": "Wearables",
"unavailable_reason": null
}
],
"currency": "EUR",
"discount": {
"amount": 0,
"promotion": null
},
"shipping": {
"amount": 1500,
"status": "quoted",
"is_free": false,
"description": "USA",
"free_threshold": 100000
},
"subtotal": 48,
"grand_total": 1548,
"total_is_final": true,
"shipping_address": {
"city": "New York",
"name": "John Doe",
"line1": "350 Fifth Avenue",
"state": "NY",
"country": "US",
"postal_code": "10118"
},
"unavailable_count": 0
},
"created_at": "2026-09-28T21:54:09.713316+00:00",
"confirmed_at": null,
"cancelled_at": null,
"confirmation_token": "HnYBO4omfk1-CXT0gqUhNfo02aHMI2-shiJSRl-MFSo",
"confirmation_url": null
},
"evidence": [
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"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"
},
{
"source": "orders",
"operation": "POST /v1/checkout/reserve",
"field": "reservations"
}
],
"computed_at": "2026-09-28T21:54:09.790Z",
"currency": "EUR",
"environment": "sandbox"
}{
"error": {
"code": "invalid_request",
"message": "Idempotency-Key header is required"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing or invalid Authorization header"
}
}{
"error": {
"code": "idempotency_conflict",
"message": "This Idempotency-Key was already used with different items"
}
}{
"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.
Headers
Unique per intent. A retry with the same key returns the same intent.
200Customer session token from POST /v1/auth/login or POST /v1/auth/verify-otp. Provide exactly one of x-auth-token, x-external-auth, or x-idp-token.
Bring-your-own-auth assertion identifying the customer. Provide exactly one of x-auth-token, x-external-auth, or x-idp-token.
A raw token from the store's own identity provider, verified by the store's configured Auth verifier. Provide exactly one of x-auth-token, x-external-auth, or x-idp-token.
Body
1 - 25 elementsShow child attributes
Show child attributes
Where the order is going. country (ISO 3166-1 alpha-2) is needed for tax; line1 with city, or latitude with longitude, for shipping.
Show child attributes
Show child attributes
token, hosted Response
A replay of an Idempotency-Key already used with the same items
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/checkout-intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"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/checkout-intents"
payload = {
"items": [
{
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"quantity": 1
}
],
"shipping_address": {
"name": "John Doe",
"line1": "350 Fifth Avenue",
"city": "New York",
"state": "NY",
"postal_code": "10118",
"country": "US"
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [{variant_id: 'fbe89cdf-90a3-4050-a43b-e4c42302484a', 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/checkout-intents', 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/checkout-intents",
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' => 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",
"Idempotency-Key: <idempotency-key>"
],
]);
$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/checkout-intents"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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("Idempotency-Key", "<idempotency-key>")
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/checkout-intents")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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/checkout-intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"variant_id\": \"fbe89cdf-90a3-4050-a43b-e4c42302484a\",\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": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending_confirmation",
"confirmation_mode": "token",
"confirmation_token": "<string>",
"confirmation_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total": 123,
"currency": "<string>",
"items": [
{
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 50
}
],
"quote": {
"lines": [
{
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"variant_name": "<string>",
"sku": "<string>",
"quantity": 123,
"unit_price": 123,
"list_price": 123,
"line_total": 123,
"category_name": "<string>",
"available": true,
"stock": 123,
"unavailable_reason": "not_found"
}
],
"subtotal": 123,
"discount": {
"amount": 123,
"promotion": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"type": "<string>"
}
},
"shipping": {
"status": "quoted",
"amount": 123,
"description": "<string>",
"free_threshold": 123,
"is_free": true
},
"tax": {
"status": "quoted",
"amount": 123,
"source": "automatic",
"prices_include_tax": true
},
"grand_total": 123,
"total_is_final": true,
"unavailable_count": 123,
"currency": "<string>",
"shipping_address": {}
},
"created_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z"
},
"evidence": [
{
"source": "<string>",
"operation": "<string>",
"id": "<string>",
"field": "<string>",
"note": "<string>"
}
],
"computed_at": "2023-11-07T05:31:56Z",
"environment": "production",
"currency": "<string>"
}{
"data": {
"id": "0ff91bd6-aa86-4ef6-8242-fe8644bca1bb",
"status": "pending_confirmation",
"confirmation_mode": "token",
"expires_at": "2026-09-28T22:24:09.629+00:00",
"order_id": null,
"customer_id": null,
"total": 1548,
"currency": "EUR",
"items": [
{
"quantity": 1,
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a"
}
],
"quote": {
"tax": {
"amount": 213.52,
"source": "fallback",
"status": "quoted",
"prices_include_tax": true
},
"lines": [
{
"sku": "FEED-HOODIE-GRY-M",
"name": "Galactic Zip Hoodie",
"stock": 25,
"quantity": 1,
"available": true,
"line_total": 48,
"list_price": 48,
"product_id": "289533e8-f5b6-4d4f-bb23-2127875feb70",
"unit_price": 48,
"variant_id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"variant_name": "Grey / M",
"category_name": "Wearables",
"unavailable_reason": null
}
],
"currency": "EUR",
"discount": {
"amount": 0,
"promotion": null
},
"shipping": {
"amount": 1500,
"status": "quoted",
"is_free": false,
"description": "USA",
"free_threshold": 100000
},
"subtotal": 48,
"grand_total": 1548,
"total_is_final": true,
"shipping_address": {
"city": "New York",
"name": "John Doe",
"line1": "350 Fifth Avenue",
"state": "NY",
"country": "US",
"postal_code": "10118"
},
"unavailable_count": 0
},
"created_at": "2026-09-28T21:54:09.713316+00:00",
"confirmed_at": null,
"cancelled_at": null,
"confirmation_token": "HnYBO4omfk1-CXT0gqUhNfo02aHMI2-shiJSRl-MFSo",
"confirmation_url": null
},
"evidence": [
{
"source": "pricing",
"operation": "GET /v1/prices/products/{id}",
"id": "fbe89cdf-90a3-4050-a43b-e4c42302484a",
"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"
},
{
"source": "orders",
"operation": "POST /v1/checkout/reserve",
"field": "reservations"
}
],
"computed_at": "2026-09-28T21:54:09.790Z",
"currency": "EUR",
"environment": "sandbox"
}{
"error": {
"code": "invalid_request",
"message": "Idempotency-Key header is required"
}
}{
"error": {
"code": "unauthorized",
"message": "Missing or invalid Authorization header"
}
}{
"error": {
"code": "idempotency_conflict",
"message": "This Idempotency-Key was already used with different items"
}
}{
"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"
}
}
