Skip to main content
POST
/
organisations
/
{orgId}
/
workspaces
/
{workspaceId}
/
metrics
Create a new metric
curl --request POST \
  --url https://api.meetsquad.ai/organisations/{orgId}/workspaces/{workspaceId}/metrics \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "Daily Active Users",
  "ownerId": "<string>",
  "description": "Number of unique users who performed any action in the last 24 hours",
  "unit": "users",
  "type": "custom",
  "targetOperator": "greater_than",
  "targetValue": 100,
  "targetDirection": "up",
  "currentValue": 150,
  "previousValue": 140,
  "periodType": "calendar",
  "periodValue": "month",
  "timeseries": [
    {
      "date": "2023-11-07T05:31:56Z",
      "value": 85
    }
  ],
  "relatedOutcomes": [
    "<unknown>"
  ],
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "outcomeIds": [
    "7b9e5d2c-f314-48a9-be56-9843a2f6c019"
  ]
}
'
{
  "data": {
    "id": "7b9e5d2c-f314-48a9-be56-9843a2f6c019",
    "title": "Daily Active Users",
    "ownerId": "user_123456789",
    "createdAt": "2023-01-01T00:00:00.000Z",
    "updatedAt": "2023-01-01T00:00:00.000Z",
    "description": "Number of unique users who performed any action in the last 24 hours",
    "unit": "users",
    "type": "custom",
    "targetOperator": "greater_than",
    "targetValue": 100,
    "targetDirection": "up",
    "currentValue": 150,
    "previousValue": 140,
    "periodType": "calendar",
    "periodValue": "month",
    "timeseries": [
      {
        "date": "2023-11-07T05:31:56Z",
        "value": 85
      }
    ],
    "relatedOutcomes": [
      "<unknown>"
    ]
  }
}

Authorizations

Authorization
string
header
required

JWT authentication for organization-scoped endpoints.

Path Parameters

orgId
string
required

Organization ID

workspaceId
string
required

Workspace ID

Body

application/json

Request schema for creating a metric

title
string
required

Display name for the metric

Example:

"Daily Active Users"

ownerId
string
required
description
string

Detailed description of the metric

Example:

"Number of unique users who performed any action in the last 24 hours"

unit
string

Unit of measurement for the metric

Example:

"users"

type
enum<string>
default:custom

Category/type of the metric

Available options:
engagement,
conversion,
revenue,
nps,
csat,
ces,
ratio,
custom
targetOperator
enum<string>

Comparison operator for the target

Available options:
greater_than,
less_than,
equal_to
targetValue
number

Target value to achieve

Example:

100

targetDirection
enum<string>
default:up

Direction of improvement (up = higher is better, down = lower is better)

Available options:
up,
down
currentValue
number

Current value of the metric

Example:

150

previousValue
number

Previous value of the metric for comparison

Example:

140

periodType
enum<string>

Type of period for metric comparison

Available options:
rolling,
calendar
Example:

"calendar"

periodValue
enum<string>

Specific period value for metric comparison

Available options:
day,
week,
month,
quarter,
year,
7-day,
30-day,
90-day
Example:

"month"

timeseries
object[]

Historical values for trend analysis

Related outcomes that use this metric

id
outcomeIds
string[]

Array of outcome IDs to associate with this metric

Example:
["7b9e5d2c-f314-48a9-be56-9843a2f6c019"]

Response

Success

Response containing a single metric

data
object
required

Metric data representing a measurable KPI result