Skip to main content
POST
/
v1
/
shipping
/
calculate
curl --request POST \
  --url https://api.tybritelabs.com/v1/shipping/calculate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "latitude": -1.106583,
  "longitude": 37.013954,
  "order_total": 1500
}
'
{
  "fee": 100,
  "zone_name": null,
  "tier_name": "Within Nairobi",
  "distance_meters": 19.23,
  "is_free": false,
  "reason": "19 m away",
  "applied_rule": "distance"
}

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

Authorization
string
header
required

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) or tybrite_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) or tybrite_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.

Body

application/json
latitude
number<double>
required

Customer's GPS latitude

Required range: -90 <= x <= 90
Example:

-1.106583

longitude
number<double>
required

Customer's GPS longitude

Required range: -180 <= x <= 180
Example:

37.013954

order_total
number<float>

Total order value (before shipping)

Required range: x >= 0
Example:

5000

Response

Shipping fee calculated successfully

Calculated delivery fee based on customer location and order total

fee
number<float>

Calculated delivery fee

Required range: x >= 0
Example:

100

zone_name
string | null

Name of delivery zone if customer is in a zone

Example:

null

tier_name
string | null

Name of pricing tier if distance-based pricing was applied

Example:

"Within Nairobi"

distance_meters
number<float> | null

Distance from store to customer in meters (null if zone-based)

Example:

29556.31

is_free
boolean

Whether delivery is free due to order threshold

Example:

false

reason
string

Human-readable explanation of the fee

Example:

"29.6 km away"

applied_rule
enum<string>

Pricing rule that was applied:

  • zone: Customer is within a custom delivery zone
  • distance: Distance-based tier pricing was used
  • default: Fallback pricing (no zone or tier matched)
Available options:
zone,
distance,
default
Example:

"distance"

coordinates
object

Customer coordinates (geocoded if place_name was provided)