{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendraven-ai/json-schema/sendraven-ai-conversion-metrics-schema.json",
  "title": "ConversionMetrics",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendraven-ai-api-openapi.json#/components/schemas/ConversionMetrics",
  "type": "object",
  "required": [
    "goal_id",
    "broadcast_id",
    "automation_id",
    "from",
    "to",
    "conversions",
    "converters",
    "revenue",
    "sent",
    "conversion_rate",
    "by_variant",
    "by_step"
  ],
  "properties": {
    "goal_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The goal_id filter, or null for all goals."
    },
    "broadcast_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "automation_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "from": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "to": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "conversions": {
      "type": "integer",
      "minimum": 0,
      "description": "Attributed conversions, counting every purchase."
    },
    "converters": {
      "type": "integer",
      "minimum": 0,
      "description": "Distinct people among them."
    },
    "revenue": {
      "type": "array",
      "description": "Summed value per currency, from conversions that carried one. Values in different currencies are never added together, so a single-currency workspace has one entry and one with no values has none.",
      "items": {
        "type": "object",
        "required": [
          "currency",
          "amount"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217, upper case."
          },
          "amount": {
            "type": "number",
            "description": "Rounded to two decimal places."
          }
        }
      }
    },
    "sent": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Messages the campaign or automation sent. null unless broadcast_id or automation_id is given."
    },
    "conversion_rate": {
      "type": [
        "number",
        "null"
      ],
      "description": "converters / sent. null when sent is null or 0."
    },
    "by_variant": {
      "type": [
        "array",
        "null"
      ],
      "description": "One row per A/B variant, in the campaign's order. null unless broadcast_id names an A/B test.",
      "items": {
        "type": "object",
        "required": [
          "key",
          "conversions",
          "converters",
          "revenue",
          "sent",
          "conversion_rate"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "conversions": {
            "type": "integer",
            "minimum": 0,
            "description": "Attributed conversions, counting every purchase."
          },
          "converters": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct people among them."
          },
          "revenue": {
            "type": "array",
            "description": "Summed value per currency, from conversions that carried one. Values in different currencies are never added together, so a single-currency workspace has one entry and one with no values has none.",
            "items": {
              "type": "object",
              "required": [
                "currency",
                "amount"
              ],
              "properties": {
                "currency": {
                  "type": "string",
                  "description": "ISO 4217, upper case."
                },
                "amount": {
                  "type": "number",
                  "description": "Rounded to two decimal places."
                }
              }
            }
          },
          "sent": {
            "type": "integer",
            "minimum": 0,
            "description": "Messages accepted for sending in this row."
          },
          "conversion_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "converters / sent, 0 to 1 in practice. null when sent is 0."
          }
        }
      }
    },
    "by_step": {
      "type": [
        "array",
        "null"
      ],
      "description": "One row per current step, in order. Figures follow the step id, so a step keeps its own conversions after the sequence is edited. null unless automation_id is given.",
      "items": {
        "type": "object",
        "required": [
          "step",
          "step_id",
          "conversions",
          "converters",
          "revenue",
          "sent",
          "conversion_rate"
        ],
        "properties": {
          "step": {
            "type": "integer",
            "minimum": 1,
            "description": "Its position now, numbered from 1."
          },
          "step_id": {
            "type": "string"
          },
          "conversions": {
            "type": "integer",
            "minimum": 0,
            "description": "Attributed conversions, counting every purchase."
          },
          "converters": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct people among them."
          },
          "revenue": {
            "type": "array",
            "description": "Summed value per currency, from conversions that carried one. Values in different currencies are never added together, so a single-currency workspace has one entry and one with no values has none.",
            "items": {
              "type": "object",
              "required": [
                "currency",
                "amount"
              ],
              "properties": {
                "currency": {
                  "type": "string",
                  "description": "ISO 4217, upper case."
                },
                "amount": {
                  "type": "number",
                  "description": "Rounded to two decimal places."
                }
              }
            }
          },
          "sent": {
            "type": "integer",
            "minimum": 0,
            "description": "Messages accepted for sending in this row."
          },
          "conversion_rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "converters / sent, 0 to 1 in practice. null when sent is 0."
          }
        }
      }
    }
  }
}