Klaviyo · Schema

CustomMetricResponseObjectResource

MarketingEmailSMSCustomer DataE-CommerceAutomation

Properties

Name Type Description
type object
id string The ID of the custom metric
attributes object
relationships object
links object
View JSON Schema on GitHub

JSON Schema

klaviyo-custommetricresponseobjectresource-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/CustomMetricResponseObjectResource",
  "title": "CustomMetricResponseObjectResource",
  "type": "object",
  "properties": {
    "type": {
      "$ref": "#/components/schemas/CustomMetricEnum"
    },
    "id": {
      "description": "The ID of the custom metric",
      "type": "string",
      "example": "925e385b52fb405715f3616c337cc65c"
    },
    "attributes": {
      "type": "object",
      "properties": {
        "name": {
          "description": "The name for this custom metric. Names must be unique across the account.         Attempting to create a metric with a duplicate name will return a 400 status code.",
          "type": "string",
          "example": "My custom metric"
        },
        "created": {
          "description": "The datetime when this custom metric was created.",
          "type": "string",
          "format": "date-time",
          "example": "2025-04-15T00:00:00Z"
        },
        "updated": {
          "description": "The datetime when this custom metric was updated.",
          "type": "string",
          "format": "date-time",
          "example": "2025-04-15T00:00:00Z"
        },
        "definition": {
          "description": "The definition of a custom metric. It is composed of a list of         `metric_groups`. Each group specifies how to query a particular metric with         customized filters and the value property to calculate conversion value measurements         (if applicable). The groups are combined with `AND` relationships, i.e., conversion         and conversion value measurements for each group will be added together to get the final         result.",
          "example": {
            "aggregation_method": "value",
            "metric_groups": [
              {
                "metric_id": "AAAAAA",
                "metric_filters": [
                  {
                    "property": "my_string_property",
                    "filter": {
                      "type": "string",
                      "operator": "starts-with",
                      "value": "some_substring"
                    }
                  },
                  {
                    "property": "my_numeric_property",
                    "filter": {
                      "type": "numeric",
                      "operator": "greater-than-or-equal",
                      "value": 999
                    }
                  }
                ],
                "value_property": "$value"
              },
              {
                "metric_id": "BBBBBB",
                "metric_filters": [
                  {
                    "property": "my_boolean_property",
                    "filter": {
                      "type": "boolean",
                      "operator": "equals",
                      "value": false
                    }
                  },
                  {
                    "property": "my_list_property",
                    "filter": {
                      "type": "list",
                      "operator": "contains",
                      "value": "some_value_in_a_list"
                    }
                  }
                ],
                "value_property": "my_numeric_property"
              }
            ]
          },
          "$ref": "#/components/schemas/CustomMetricDefinition"
        }
      },
      "required": [
        "name",
        "created",
        "updated",
        "definition"
      ]
    },
    "relationships": {
      "type": "object",
      "properties": {
        "metrics": {
          "type": "object",
          "properties": {
            "data": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "type",
                  "id"
                ],
                "properties": {
                  "type": {
                    "$ref": "#/components/schemas/MetricEnum"
                  },
                  "id": {
                    "description": "Related metrics",
                    "type": "string"
                  }
                }
              }
            },
            "links": {
              "$ref": "#/components/schemas/RelationshipLinks"
            }
          }
        }
      }
    },
    "links": {
      "$ref": "#/components/schemas/ObjectLinks"
    }
  },
  "required": [
    "type",
    "id",
    "attributes",
    "links"
  ]
}