Skip to main content

List formulas

Enterprise Only
This API is available exclusively in Countly Enterprise.

Endpoint

/o/calculated_metrics/metrics

Overview

Returns formulas available to the current user in the app.

Authentication

Countly API supports three authentication methods:

  1. API key query parameter: api_key=YOUR_API_KEY
  2. Auth token query parameter: auth_token=YOUR_AUTH_TOKEN
  3. Auth token header: countly-token: YOUR_AUTH_TOKEN

Permissions

Requires formulas Read permission.

Request Parameters

ParameterTypeRequiredDescription
app_idStringYesTarget app ID.
for_widgetsBoolean/StringNoIf provided, returns only _id and title.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Response

Success Response

[
{
"_id": "67bd31c92e7f0b0012ab4567",
"title": "Revenue per Session",
"description": "Revenue divided by sessions",
"key": "revenue_per_session",
"visibility": "global",
"format": "float",
"dplaces": 2,
"unit": "USD",
"formula": "[...]",
"shared_email_edit": [],
"app": "64f5c0d8f4f7ac0012ab3456",
"formula_hash": "8e49d217047eafee994c3c8a4a1efcbb",
"owner_id": "64f5c0d8f4f7ac0012ab9999"
}
]

Response Fields

FieldTypeDescription
[]ArrayFormulas visible to current user in this app.
[]._idStringFormula ID.
[].titleStringFormula title.
[].visibilityStringglobal or private.
[].formulaStringStringified builder formula payload.

Error Responses

No explicit error response is returned by this handler; on DB failure, an empty array may be returned.

Visibility Filtering

  • Global formulas.
  • Formulas owned by current user.
  • Private formulas shared with current user's email.

Behavior/Processing

  • Uses visibility filter for non-global admins.
  • Excludes expression field from response.
  • When for_widgets is provided, response contains only _id and title.

Database Collections

CollectionUsed forData touched by this endpoint
countly.calculated_metricsEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.

Examples

/o/calculated_metrics/metrics?
app_id=64f5c0d8f4f7ac0012ab3456
/o/calculated_metrics/metrics?
app_id=64f5c0d8f4f7ac0012ab3456&
for_widgets=true


Last Updated

2026-02-16