CFL
Learn how to use the ChartMogul Filtering Language (CFL) to filter data programmatically.
The ChartMogul Filtering Language (CFL) is a string-based syntax for filtering data.
CFL allows you to programmatically apply the same filters that you use in the ChartMogul interface. When you apply filters in the app, the resulting CFL string appears in your browser’s address bar.
All Metrics API endpoints accept an optional filters parameter that uses CFL to define filter criteria.
Syntax
CFL has the following format:
[filter]~[operator]~[value]~AND~[filter]~[operator]~[value]~AND~…
Key rules
- Separators: Use
~(tilde) characters to separate filters, operators and values. - Operators: Join multiple filters with
~AND~. CFL only supports the AND operator (all conditions must match). - String format: Enclose string values in single quotes, e.g.,
'US','Enterprise'. - Multiple values: Separate multiple values with commas, e.g.,
'US','FR','DE'.
Special case: plan filters
Plan and plan group filters have a unique behavior: when connected with the AND operator, they function as an OR condition. This behavior reflects how the filters work in the app.
Let’s take the following expression as an example:
plan~ANY~<PLAN_UUID>~AND~plan_group~ANY~<PLAN_GROUP_UUID>
Even though the filters are connected with the AND operator, a plan must match either the plan UUID OR the plan group UUID.
Operators
CFL uses the following operators:
Set operators
ALL— Matches only if the record contains all of the specified values.ANY— Matches if the record contains any of the specified values.NONE— Matches if the record contains none of the specified values.
Comparison operators
EQ— Equal to; matches if the value equals the specified value.NOT_EQ— Not equal to; matches if the value does not equal the specified value.GT— Greater than; matches if the value is greater than the specified value.GTE— Greater than or equal to; matches if the value is greater than or equal to the specified value.LT— Less than; matches if the value is less than the specified value.LTE— Less than or equal to; matches if the value is less than or equal to the specified value.IS_NULL_OR_EQ— Matches if the value isNULLor equals the specified value.
Range operators
BETWEEN— Specifies a range with two comma-separated values.
Containment operators
CONTAINS— Matches if the string contains the specified value.NOT_CONTAINS— Matches if the string does not contain the specified value.
Identity operators
IS— Checks if the value matches the specified value.IS_NOT— Checks if the value does not match the specified value.
Review operators available for each filter.
Getting CFL from the app
The easiest way to construct a valid CFL string is to obtain it from the app:
- Navigate to Reports in ChartMogul.
- Apply your desired filters.
- Copy the
filtersparameter value from the browser address bar.
Using CFL in API requests
Use CFL as the value of the optional filters parameter when calling Metrics API endpoints. The parameter is only available for cURL calls.
Either use URL-encoded CFL copied from the address bar:
curl -X GET "https://api.chartmogul.com/v1/metrics/arr" \
-u YOUR_API_KEY: \
-d start-date=2025-01-01 \
-d end-date=2025-03-31 \
-d interval=month \
-d filters=region~ANY~%27US%27%2C%27FR%27%2C%27DE%27~AND~mrr~GT~150
Or write CFL manually (requires double quotes around the key-value pair):
curl -X GET "https://api.chartmogul.com/v1/metrics/arr" \
-u YOUR_API_KEY: \
-d start-date=2025-01-01 \
-d end-date=2025-03-31 \
-d interval=month \
-d "filters=region~ANY~'US','FR','DE'~AND~mrr~GT~150"
Available filters
The following table lists filters that can be used in CFL expressions (with their corresponding app names in parentheses), supported operators, and example values:
| Filter | Description | Operators | Values |
|---|---|---|---|
active_quantity (Paid subscription quantity) |
Number of seats/licenses of paid subscriptions | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
active_subscriptions (# of active subscriptions) |
Number of active subscriptions | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
average_order_value (Average order value) |
Average amount spent on non-subscription payments | BETWEEN |
Two comma-separated integers or floats, e.g., 0,10.14 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer or float, e.g., 10.14 |
||
churned_on (Churned) |
When the customer cancelled their last remaining subscription | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
churning_at (Cancellation scheduled for) |
Date of a scheduled cancellation | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
contacts_count (# of Contacts) |
Number of contacts the customer has | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
contracted_on (MRR contracted) |
When the customer’s MRR last decreased | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
currency (Currency) |
Customer’s billing currency | ALL, ANY, NONE |
Comma-separated, single-quoted ISO 4217 currency codes, e.g., 'EUR','USD' |
customer_lifetime (Didn’t cancel within N days of purchase) |
Number of days the customer remained active from their initial purchase before canceling (or current number of days if still active) | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
customer (Customer) |
Specific customer or customers | ALL, ANY, NONE |
Comma-separated customer UUIDs, e.g., cus_ |
customer_since (Customer since) |
When the individual or company became a customer | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
customer_status (Customer status) |
Status of the customer: new_, working_, qualified_, unqualified_, active, past_ or cancelled |
ANY, NONE |
Comma-separated, single-quoted strings, e.g., 'past_due','cancelled' |
data_source (Source) |
The source the customer is associated with | ALL, ANY, NONE |
Comma-separated data source UUIDs, e.g., ds_ |
due_at (Due at) |
When the customer’s next payment is due | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
expanded_on (MRR expanded) |
When the customer’s MRR last increased | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
free_trial_started_at (Free trial started at) |
When the customer started their free trial | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
has_discount (Has discount) |
Whether the customer currently has a discount | EQ |
TRUE or FALSE |
has_open_task (Has open task) |
Whether the customer has an open task | EQ |
TRUE or FALSE |
has_opportunity (Has opportunity) |
Whether the customer has an associated opportunity | EQ |
TRUE or FALSE |
last_active_at (Last active at) |
Most recent date when a contact was active | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
last_ (Last communication at) |
Date of most recent communication with the customer’s contacts | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
last_ (Last email received from customer at) |
Most recent date when the customer’s contacts sent an email | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
last_ (Last email sent to customer at) |
Most recent date when an email was sent to the customer’s contacts | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
last_payment (Last payment) |
When the customer made their last payment | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
lead_created_at (Lead created at) |
When the individual or company became a lead | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
mrr_ (MRR at time of purchase) |
Customer’s MRR when they initially subscribed | BETWEEN |
Two comma-separated integers or floats, e.g., 0,10.14 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer or float, e.g., 10.14 |
||
mrr_before_churn (MRR (Current, or at time of cancellation)) |
Customer’s current MRR or their MRR at the time of their most recent cancellation | BETWEEN |
Two comma-separated integers or floats, e.g., 0,10.14 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer or float, e.g., 10.14 |
||
mrr (MRR (Current)) |
Customer’s current MRR | BETWEEN |
Two comma-separated integers or floats, e.g., 0,10.14 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer or float, e.g., 10.14 |
||
net_payments (Net payments) |
Net payments (successful payments less refunds) | BETWEEN |
Two comma-separated integers or floats, e.g., 0,10.14 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer or float, e.g., 10.14 |
||
next_payment (Next payment) |
When the customer is expected to make their next payment | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
owner (Owner) |
Primary salesperson responsible for the customer | ANY, NONE, IS, IS_NOT |
NULL or comma-separated integers representing owners, e.g., 0,118,999,88199,9119,725 |
paid_ (Paid subscriber since) |
When the customer became a paid subscriber for the first time | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
plan_ (Plan (at time of purchase)) |
Customer’s plan when they made their first purchase | ANY, NONE |
Comma-separated plan UUIDs, e.g., pl_ |
plan_ (Plan (at time of subscription)) |
Customer’s plan when they initially subscribed | IS_NOT, ALL, ANY, NONE |
NULL or comma-separated plan UUIDs, e.g., pl_ |
plan_ (Plan (during trial)) |
Customer’s plan when they started their trial | IS_NOT, ALL, ANY, NONE |
NULL or comma-separated plan UUIDs, e.g., pl_ |
plan_ (Plan (at time of purchase)) |
The plan group associated with the customer’s plan when they made their first purchase | ANY, NONE |
Comma-separated plan group UUIDs, e.g., plg_ |
plan_ (Plan (at time of subscription)) |
The plan group associated with the customer’s plan when they initially subscribed | ALL, ANY, NONE |
Comma-separated plan group UUIDs, e.g., plg_ |
plan_ (Plan (during trial)) |
The plan group associated with the customer’s plan when they started their trial | ALL, ANY, NONE |
Comma-separated plan group UUIDs, e.g., plg_ |
plan_group (Plan) |
The plan group associated with the customer’s current plan | ALL, ANY, NONE |
Comma-separated plan group UUIDs, e.g., plg_ |
plan_ (Plan (including all items in subscription set)) |
The plan group associated with the customer’s current plan or any other plan in the same subscription set (such as a base plan with add-ons) | ALL, ANY, NONE |
Comma-separated plan group UUIDs, e.g., plg_ |
plan (Plan) |
Customer’s current plan | ALL, ANY, NONE |
Comma-separated plan UUIDs, e.g., pl_ |
plan_sub_set (Plan (including all items in subscription set)) |
Customer’s current plan including any other plans in the same subscription set (such as a base plan with add-ons) | ALL, ANY, NONE |
Comma-separated plan UUIDs, e.g., pl_ |
reactivated_on (Reactivated) |
When the customer reactivated a previously cancelled subscription | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
region (Region) |
Customer’s region based on their address | ANY, NONE, IS, IS_NOT |
NULL or comma-separated, single-quoted strings, e.g., 'US','FR' |
renewal_at (Renewal date) |
When the customer’s subscription is scheduled to renew | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
subscriber_since (Subscriber since) |
When the customer first became a subscriber | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 or NULL |
||
successful_ (Number of successful payments) |
Number of successful payments the customer has made | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
tags (Tags) |
Customer tags | ALL, ANY, NONE, IS, IS_NOT |
NULL or comma-separated, single-quoted strings, e.g., 'managed_account','churn_risk' |
trial_ (Trial-to-conversion in days) |
Number of days between trial start and the start of a paid or free subscription | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
trial_ (Trial-to-paid in days) |
Number of days between trial start and the start of a paid subscription | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
website (Website) |
URL of the customer’s website | ANY, NONE |
NULL or comma-separated, single-quoted strings, e.g., 'https://myriapodlabs.com', |
EQ, NOT_EQ, CONTAINS, NOT_CONTAINS, IS, IS_NOT |
NULL or a single-quoted string, e.g., 'https://myriapodlabs.com' |
||
custom.attribute_name |
Custom boolean attribute | EQ, IS_NULL_OR_EQ |
TRUE or FALSE |
| Custom date attribute | BETWEEN |
Two comma-separated ISO 8601 dates, e.g., 2025-01-01,2025-06-01 |
|
LT, LTE, EQ, GTE, GT, IS, IS_NOT |
An ISO 8601 date, e.g., 2025-12-06 |
||
| Custom float attribute | BETWEEN |
Two comma-separated floats, e.g., 0.01,9.99 |
|
LT, LTE, EQ, NOT_EQ, GTE, GT |
A float, e.g., 10.14 |
||
| Custom integer attribute | BETWEEN |
Two comma-separated integers, e.g., 0,11 |
|
LT, LTE, EQ, NOT_EQ, GTE, GT |
An integer, e.g., 3 |
||
| Custom string attribute | EQ, NOT_EQ, CONTAINS, NOT_CONTAINS, IS, IS_NOT |
NULL or a single-quoted string, e.g., 'medtech' |
|
| Custom string array attribute | ANY, NONE |
NULL or comma-separated, single-quoted strings, e.g., 'medtech','fintech' |