Skip to main content
GET
/
ad-metrics
/
{storeUrl}
/
customer-ltv
Get customer lifetime value
curl --request GET \
  --url https://app.bily.ai/api/customer/v1/ad-metrics/{storeUrl}/customer-ltv \
  --header 'x-api-key: <api-key>'
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://app.bily.ai/api/customer/v1/ad-metrics/{storeUrl}/customer-ltv', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
import requests

url = "https://app.bily.ai/api/customer/v1/ad-metrics/{storeUrl}/customer-ltv"

headers = {"x-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
[
  {
    "shop": "<string>",
    "customer_id": "<string>",
    "total_orders": 123,
    "total_revenue": 123,
    "avg_order_value": 123,
    "first_order_date": "<string>",
    "first_order_month": "<string>",
    "last_order_date": "<string>",
    "second_order_date": "<string>",
    "total_refunds": 123,
    "revenue_30d": 123,
    "revenue_90d": 123,
    "revenue_6m": 123,
    "revenue_12m": 123,
    "first_order_channel": "<string>",
    "first_order_ad_id": "<string>",
    "currency": "<string>",
    "last_order_days_ago": 123,
    "time_to_second_purchase_days": 123
  }
]
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}
{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}

Authorizations

x-api-key
string
header
required

A server-side Bily API key created under Settings > MCP > Access key fallback. Select the intended store before creating it.

Headers

x-bily-organization-id
string

An organization ID returned by GET /context or GET /organizations. Required for GET /stores and optional for store-scoped paths.

Example:

"org_01J8W7T9G3E6ZQ4M2K5N8P1R0S"

Path Parameters

storeUrl
string
required

The exact store URL returned by GET /context or GET /stores.

Example:

"store.example.com"

Query Parameters

startDate
string<date>

Optional first date to include, in YYYY-MM-DD format.

endDate
string<date>

Optional last date to include, in YYYY-MM-DD format.

limit
integer
default:200

Maximum input rows to return.

Required range: 1 <= x <= 100000

Response

Request completed successfully.

shop
string
required
customer_id
string
required
total_orders
number
required
total_revenue
number
required
avg_order_value
number
required
first_order_date
string | null
first_order_month
string | null
last_order_date
string | null
second_order_date
string | null
total_refunds
number
revenue_30d
number
revenue_90d
number
revenue_6m
number
revenue_12m
number
first_order_channel
string | null
first_order_ad_id
string | null
currency
string | null
last_order_days_ago
number | null
time_to_second_purchase_days
number | null