{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instasent/json-schema/instasent-segment-usage-schema.json",
  "title": "SegmentUsage",
  "description": "Where each segment of the project is actually used. **Only segments with at least\none reference appear**: a segment that is listed but missing here is an orphan,\nwhich is what this endpoint exists to make visible. Flows carry no segment\nreference and are deliberately not counted.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instasent-segment-api-openapi.yml#/components/schemas/SegmentUsage",
  "type": "object",
  "properties": {
    "segments": {
      "type": "object",
      "description": "Keyed by segment uid.",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "campaigns": {
            "type": "integer",
            "description": "Campaigns that have targeted this segment."
          },
          "lastTargetedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a campaign last targeted it, ISO 8601."
          },
          "automations": {
            "type": "integer",
            "description": "Automations that enroll from this segment."
          },
          "activeAutomations": {
            "type": "integer",
            "description": "How many of those automations are active. A segment alive only\nthrough inactive automations is effectively unused.\n"
          }
        }
      }
    },
    "computedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the map was aggregated, ISO 8601. Cached ten minutes."
    }
  },
  "required": [
    "segments",
    "computedAt"
  ]
}