Create order
Create a new order with HMAC signature verification and idempotency protection.
🔐 HMAC Signing (REQUIRED)
All order creation requests MUST include HMAC-SHA256 signature for security:
- Generate Timestamp: Get current Unix timestamp in seconds
- Create Payload: Concatenate
timestamp + "." + JSON_body - Sign Payload:
HMAC-SHA256(hmac_secret, payload)→ base64 encode - Include Headers:
X-Timestamp: Unix timestamp (must be within 5 minutes)X-Signature: Base64-encoded HMAC signature
Example (Node.js):
const crypto = require('crypto');
const timestamp = Math.floor(Date.now() / 1000);
const body = JSON.stringify(orderData);
const payload = `${timestamp}.${body}`;
const signature = crypto.createHmac('sha256', hmacSecret)
.update(payload).digest('base64');
// Include in headers:
// X-Timestamp: 1771523993
// X-Signature: IqdgKXgloLzL5akDgFEwPaK6wviozf...
🔄 Idempotency Protection
Include Idempotency-Key header to prevent duplicate orders on retry.
If the same key is used, the original order is returned (not counted against rate limit).
⚠️ Security Notes:
- HMAC secret is displayed in Settings → Integration Settings
- Never expose HMAC secret in client-side code
- Regenerate secret immediately if compromised
- Requests with invalid/missing signatures return 401 Unauthorized
- Timestamps older than 5 minutes are rejected to prevent replay attacks
Documentation Index
Fetch the complete documentation index at: https://docs.tybritelabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
API Key Authentication
Use your API key in the Authorization header:
Authorization: Bearer tybrite_sk_live_YOUR_KEYKey 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 key to prevent duplicate orders (e.g., order-{timestamp}-{random})
Unix timestamp in seconds (current time). Must be within 5 minutes of server time. Used to prevent replay attacks.
HMAC-SHA256 signature of the payload (timestamp + "." + request_body), base64-encoded. Sign using your HMAC secret from Settings → Integration Settings.
Body
Order line items (at least one required)
1Payment method identifier (required)
card, stripe, paystack, mpesa, airtel_money, cash "card"
Total order amount (required)
2520
Customer UUID (optional - guest checkout supported)
"c320094c-eb65-4879-804c-83d2e1dd7f99"
Customer email address
"john.doe@example.com"
Customer full name
"John Doe"
Customer phone number
"+254700000999"
Billing address (optional)
Shipping address (optional)
Payment status (defaults to pending)
pending, paid, failed, refunded "pending"
Order fulfillment status (defaults to pending)
pending, processing, shipped, delivered, cancelled "pending"
Subtotal before tax and shipping
2000
Tax amount
320
Shipping cost
200
Discount amount
0
Additional order notes
"Please deliver between 9 AM - 5 PM"
Shipping tracking number (optional, usually set on PATCH)
"1Z999AA10123456784"
Estimated delivery date and time (optional)
"2026-02-15T14:00:00Z"
External payment reference (e.g., Stripe charge ID, M-Pesa receipt)
"ch_1NqFvE2eZvKYlo2C8Z3y4abc"
Shipping calculation details from /v1/shipping/calculate for audit trail
Optional gift card to redeem towards this order
Promotion usages applied to this order (tracked when payment_status is paid)
Response
Order created successfully (or existing order returned if idempotency key matches)
"ORD-2026-001234"
pending, processing, shipped, delivered, cancelled "pending"
pending, paid, failed, refunded "pending"
Method used for payment
stripe, paystack, mpesa, airtel, cash, bank_transfer "stripe"
1999.98
159.99
15
0
2174.97
Complete shipping calculation details for audit trail
Optional. Present only when one or more post-order processing steps (gift card redemption, stock reduction, etc.) failed. The order itself was created successfully, but a downstream side effect needs human follow-up. Each warning indicates the stage that failed and a human-readable message.

