import weflayr
from weflayr.openapi.models import SetRevenueInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.set_revenue(body=SetRevenueInput.from_dict({
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"},
]
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.setRevenue({
client,
throwOnError: true,
body: {
rows: [
{ customerName: 'c_123', amount: 1200.50, month: '2026-06' },
{ customerName: 'c_456', amount: 800, month: '2026-06' },
],
},
});
curl -X POST https://app.weflayr.com/api/revenue/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"}
]
}'
{"ok": true, "rows_inserted": 2}
Revenue
Set revenue
Book revenue per customer and month.
POST
/
api
/
revenue
/
import weflayr
from weflayr.openapi.models import SetRevenueInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.set_revenue(body=SetRevenueInput.from_dict({
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"},
]
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.setRevenue({
client,
throwOnError: true,
body: {
rows: [
{ customerName: 'c_123', amount: 1200.50, month: '2026-06' },
{ customerName: 'c_456', amount: 800, month: '2026-06' },
],
},
});
curl -X POST https://app.weflayr.com/api/revenue/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"}
]
}'
{"ok": true, "rows_inserted": 2}
On an internal project, go to Manage Key metrics instead.
A customer can have several lines in the same month (in case of multiple billings).
Each object inside
Parameters
array of row objects
required
The revenue lines to book, described below. Up to 1,000 per call.
boolean
default:"false"
If a row’s
revenue_id already exists (c.f. rows parameters below), overwrite it instead of throwing an error.rows accepts:
string
required
The same
customer_name you stamp on your LLM calls when propagating metadata, so revenue and AI cost land on the same customer.number
required
The value to book.
"YYYY-MM"
The calendar month the value belongs to. Required unless you set
month_start and month_end instead."YYYY-MM"
Bill over a multi-month period (e.g. quarterly) instead of a single
month. amount is split evenly over the period. Set either month, or both month_start and month_end, never both forms on the same row.string
An id for the revenue row over which uniqueness is checked, typically from a billing management system.
API values are their own revenue source, alongside Stripe and CSV. Sources add up: if you post revenue for a customer-month that also has a CSV upload or a Stripe sync, Weflayr assumes it is the sum. We recommend using one source only to avoid double counting.
import weflayr
from weflayr.openapi.models import SetRevenueInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.set_revenue(body=SetRevenueInput.from_dict({
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"},
]
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.setRevenue({
client,
throwOnError: true,
body: {
rows: [
{ customerName: 'c_123', amount: 1200.50, month: '2026-06' },
{ customerName: 'c_456', amount: 800, month: '2026-06' },
],
},
});
curl -X POST https://app.weflayr.com/api/revenue/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{"customer_name": "c_123", "amount": 1200.50, "month": "2026-06"},
{"customer_name": "c_456", "amount": 800, "month": "2026-06"}
]
}'
{"ok": true, "rows_inserted": 2}