import datetime
import weflayr
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_customers(date_from=datetime.date(2026, 10, 1), date_to=datetime.date(2026, 10, 23), tag=["plan:enterprise"], limit=2)
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCustomers({
client,
throwOnError: true,
query: {
dateFrom: '2026-10-01',
dateTo: '2026-10-23',
tag: ['plan:enterprise'],
limit: 2,
},
});
curl "https://app.weflayr.com/api/customers/?date_from=2026-10-01&date_to=2026-10-23&tag=plan%3Aenterprise&limit=2" \
-H "Authorization: Bearer $WEFLAYR_API_KEY"
{
"customers": [
{
"customer_name": "Meridian Health",
"customer_tags": {
"plan": "enterprise"
},
"figures": {
"revenue_or_key_metric": 1200.5,
"has_revenue_or_key_metric": true,
"cost": 420.0,
"margin": 780.5,
"margin_pct": 65.02,
"in_tok": 120000.0,
"out_tok": 30000.0,
"mom": 4.2,
"profitability_status": "healthy"
}
}
],
"next_cursor": null,
"has_more": false
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "Invalid request payload.", "detail": [{"field": "", "error": "Value error, \"sort\" needs \"date_from\""}]}
Project
Get customers
Get the customers of the project, with their tags and their figures over a period.
GET
/
api
/
customers
/
import datetime
import weflayr
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_customers(date_from=datetime.date(2026, 10, 1), date_to=datetime.date(2026, 10, 23), tag=["plan:enterprise"], limit=2)
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCustomers({
client,
throwOnError: true,
query: {
dateFrom: '2026-10-01',
dateTo: '2026-10-23',
tag: ['plan:enterprise'],
limit: 2,
},
});
curl "https://app.weflayr.com/api/customers/?date_from=2026-10-01&date_to=2026-10-23&tag=plan%3Aenterprise&limit=2" \
-H "Authorization: Bearer $WEFLAYR_API_KEY"
{
"customers": [
{
"customer_name": "Meridian Health",
"customer_tags": {
"plan": "enterprise"
},
"figures": {
"revenue_or_key_metric": 1200.5,
"has_revenue_or_key_metric": true,
"cost": 420.0,
"margin": 780.5,
"margin_pct": 65.02,
"in_tok": 120000.0,
"out_tok": 30000.0,
"mom": 4.2,
"profitability_status": "healthy"
}
}
],
"next_cursor": null,
"has_more": false
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "Invalid request payload.", "detail": [{"field": "", "error": "Value error, \"sort\" needs \"date_from\""}]}
Each customer comes with its customer tags and, when
date_from is given, its figures over the period as the AI Margin dashboard computes them. To route some customers apart, put their names in an override rule of a routing strategy (customer_selection’s included_customers, or any rule’s excluded_customers) and push it with Set routing strategy.
Parameters
boolean
default:"true"
Include each customer’s tags.
string
Start of the period, inclusive.
YYYY-MM-DD. Send it to get each customer’s figures over the period: only the customers the AI Margin dashboard lists over the period are then returned. Omit it for every known customer, without figures.string
End of the period, inclusive.
YYYY-MM-DD. Defaults to today. Needs date_from.string
default:"\"\""
Keep the customers whose name has this text.
string[]
Keep the customers with a tag, as
"key:value", e.g. "plan:enterprise".string[]
Keep the customers with one of these profitability statuses:
"healthy", "watch", "at_risk", "unprofitable", "unknown". Another value returns a 422. Needs date_from.string
The figure to sort by. Needs
date_from. Defaults to the name with date_from, else to the order the customers were created in. One of customer, revenue_or_key_metric, cost, margin, margin_pct, in_tok, out_tok, mom or profitability_status.string
Sort ascending or descending. Needs
sort. Defaults to ascending. One of ascending or descending.string
The route is paginated: pass the previous page’s
next_cursor, as is, to get the next page. has_more says whether another page exists.integer
default:"100"
Number of customers per page. Max
1000.import datetime
import weflayr
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_customers(date_from=datetime.date(2026, 10, 1), date_to=datetime.date(2026, 10, 23), tag=["plan:enterprise"], limit=2)
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCustomers({
client,
throwOnError: true,
query: {
dateFrom: '2026-10-01',
dateTo: '2026-10-23',
tag: ['plan:enterprise'],
limit: 2,
},
});
curl "https://app.weflayr.com/api/customers/?date_from=2026-10-01&date_to=2026-10-23&tag=plan%3Aenterprise&limit=2" \
-H "Authorization: Bearer $WEFLAYR_API_KEY"
{
"customers": [
{
"customer_name": "Meridian Health",
"customer_tags": {
"plan": "enterprise"
},
"figures": {
"revenue_or_key_metric": 1200.5,
"has_revenue_or_key_metric": true,
"cost": 420.0,
"margin": 780.5,
"margin_pct": 65.02,
"in_tok": 120000.0,
"out_tok": 30000.0,
"mom": 4.2,
"profitability_status": "healthy"
}
}
],
"next_cursor": null,
"has_more": false
}
{"error": "Invalid or missing API key. Send it as \"Authorization: Bearer <your key>\"."}
{"error": "Invalid request payload.", "detail": [{"field": "", "error": "Value error, \"sort\" needs \"date_from\""}]}