{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scrip-dev/json-schema/scrip-dev-participant-detail-response-schema.json",
  "title": "ParticipantDetailResponse",
  "description": "A participant with their attributes, counters, tags, program memberships, tiers and balances.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scrip-dev-openapi.json#/components/schemas/ParticipantDetailResponse",
  "properties": {
    "attributes": {
      "additionalProperties": {
        "description": "Attribute value",
        "type": "string"
      },
      "description": "Key-value metadata. Rules read each key as `participant.attribute.<key>`, which is null if unset, or with `get(participant.attributes, \"key\", \"\")`. An empty object when the participant has none.",
      "type": "object"
    },
    "balances": {
      "description": "Current balances per asset, split by bucket",
      "items": {
        "$ref": "#/$defs/Balance"
      },
      "type": "array"
    },
    "counter_settings": {
      "additionalProperties": {
        "$ref": "#/$defs/CounterSettingResponse"
      },
      "description": "Auto-reset settings for the counters that have one, keyed by counter key. An empty object when no counter resets. Set them with `reset_after` on a counter in PATCH.",
      "type": "object"
    },
    "counters": {
      "additionalProperties": {
        "description": "Counter value as a string for precision",
        "type": "string"
      },
      "description": "Numeric accumulators, returned as strings for precision. An empty object when the participant has none.",
      "type": "object"
    },
    "created_at": {
      "description": "When the participant was created",
      "format": "date-time",
      "type": "string"
    },
    "display_name": {
      "description": "The name to show for the participant.",
      "type": "string"
    },
    "email": {
      "description": "Contact email",
      "type": "string"
    },
    "enrollments": {
      "description": "The participant's programs with the time each enrollment began, oldest first, in the same order as `program_ids`. Returned with the programs section; absent when the participant has no enrollments.",
      "items": {
        "$ref": "#/$defs/ParticipantEnrollmentResponse"
      },
      "type": "array"
    },
    "external_id": {
      "description": "Your application's identifier for this participant",
      "type": "string"
    },
    "first_name": {
      "description": "The participant's first name.",
      "type": "string"
    },
    "id": {
      "description": "The id of the participant. Use it in `participant_id` fields and paths.",
      "format": "uuid",
      "type": "string"
    },
    "last_active_at": {
      "description": "When the participant was last active from a processed event or balance change (RFC 3339; null when never active).",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "last_name": {
      "description": "The participant's last name.",
      "type": "string"
    },
    "phone": {
      "description": "Contact phone",
      "type": "string"
    },
    "program_ids": {
      "description": "Programs this participant is enrolled in",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "status": {
      "description": "The participant's lifecycle state.",
      "enum": [
        "ACTIVE",
        "SUSPENDED",
        "CLOSED"
      ],
      "type": "string"
    },
    "tag_details": {
      "description": "The participant's tags with how apps show them, in tag order. Returned with `expand[]=tag_details`; an empty list when the participant has no tags.",
      "items": {
        "$ref": "#/$defs/ParticipantTagDetail"
      },
      "type": "array"
    },
    "tags": {
      "description": "Labels for segmentation. Rules read a tag as `participant.tag.<name>` (true or false) or `'name' in participant.tags`. An empty list when the participant has none.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "tiers": {
      "additionalProperties": {
        "$ref": "#/$defs/TierState"
      },
      "description": "Current tier level per tier type",
      "type": "object"
    },
    "updated_at": {
      "description": "When the participant was last modified",
      "format": "date-time",
      "type": "string"
    }
  },
  "type": "object",
  "$defs": {
    "Balance": {
      "description": "One asset's balance for a participant, a group or a program wallet, split into available, held and deferred amounts.",
      "properties": {
        "asset_id": {
          "description": "Asset the balance is in.",
          "format": "uuid",
          "type": "string"
        },
        "available": {
          "description": "Amount in the available bucket. For a `LOT` asset, it can include value past its `expires_at` for a few minutes, until Scrip records the expiration.",
          "type": "string"
        },
        "available_value": {
          "$ref": "#/$defs/Money",
          "description": "What `available` is worth in money, using the asset's `value_per_unit` and rounded down to the currency's smallest unit. Present only on participant detail and balance reads. Omitted when the asset has no `value_per_unit` or the amount is too large to represent. A reward with its own `values_per_unit` can cost a different number of points than this value suggests."
        },
        "deferred": {
          "description": "Amount that becomes available when its `matures_at` time passes.",
          "type": "string"
        },
        "held": {
          "description": "Amount set aside by a hold or a pending redemption, plus pending rewards waiting to settle. It is not part of `available`.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "CounterResetPeriod": {
      "description": "Calendar periods a counter totals separately, using the event timestamp for rule actions. Changing the period or time zone starts empty totals.",
      "properties": {
        "timezone": {
          "description": "IANA time zone used for period boundaries. Omit for UTC.",
          "type": "string"
        },
        "type": {
          "description": "DAY, Monday-based WEEK, MONTH, or NONE to remove the calendar reset.",
          "enum": [
            "DAY",
            "WEEK",
            "MONTH",
            "NONE"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "CounterSettingResponse": {
      "description": "The automatic reset setting of one counter.",
      "properties": {
        "last_reset_at": {
          "description": "When the counter last reset, or when its reset window started.",
          "format": "date-time",
          "type": "string"
        },
        "reset_after": {
          "description": "How long the counter keeps its value before it resets to zero, such as `24h` or `720h`.",
          "type": "string"
        },
        "reset_period": {
          "$ref": "#/$defs/CounterResetPeriod",
          "description": "Calendar period and time zone for this counter; absent for a duration reset or a declared `window`."
        },
        "window": {
          "$ref": "#/$defs/CounterWindow",
          "description": "The periods this counter adds up. Present only when the counter's state definition declares a `window`."
        }
      },
      "type": "object"
    },
    "CounterWindow": {
      "description": "The periods a counter adds up. Its value is the total of the current period and the `count` minus 1 periods before it.",
      "properties": {
        "count": {
          "description": "Periods the counter adds up, including the current one. At most 90 for DAY, 52 for WEEK and 36 for MONTH.",
          "maximum": 90,
          "minimum": 1,
          "type": "integer"
        },
        "timezone": {
          "description": "IANA time zone for period boundaries. Omit for UTC.",
          "type": "string"
        },
        "unit": {
          "description": "Length of one period. A WEEK starts on Monday.",
          "enum": [
            "DAY",
            "WEEK",
            "MONTH"
          ],
          "type": "string"
        }
      },
      "required": [
        "count",
        "unit"
      ],
      "type": "object"
    },
    "Money": {
      "description": "A fiat amount: an integer count of the currency's minor units, such as cents, and the ISO 4217 currency code.",
      "properties": {
        "amount_minor": {
          "description": "Amount in the currency's minor units, such as cents for USD",
          "type": "integer"
        },
        "currency": {
          "description": "ISO 4217 currency code",
          "type": "string"
        }
      },
      "required": [
        "amount_minor",
        "currency"
      ],
      "type": "object"
    },
    "ParticipantEnrollmentResponse": {
      "description": "A program the participant is enrolled in, and when the enrollment began.",
      "properties": {
        "enrolled_at": {
          "description": "When the participant first joined the program (RFC 3339). Closing and reopening the enrollment keeps this time.",
          "format": "date-time",
          "type": "string"
        },
        "program_id": {
          "description": "The program the participant is enrolled in.",
          "format": "uuid",
          "type": "string"
        }
      },
      "type": "object"
    },
    "ParticipantTagDetail": {
      "description": "A tag the participant has, with the label, description, icon and category from its definition, and when it was last added.",
      "properties": {
        "added_at": {
          "description": "When the tag was last added to the participant (RFC 3339).",
          "format": "date-time",
          "type": "string"
        },
        "category": {
          "description": "The tag's category, from its definition.",
          "type": "string"
        },
        "description": {
          "description": "What the tag means, from its definition.",
          "type": "string"
        },
        "icon_url": {
          "description": "An HTTPS URL of an image for the tag, from its definition.",
          "type": "string"
        },
        "key": {
          "description": "The tag as rules and participant reads name it.",
          "type": "string"
        },
        "label": {
          "description": "The name people see, from the tag's definition. Absent when the tag has no definition.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "TierProgress": {
      "description": "How far the participant is from the next level that has qualification criteria, with one entry for each way to qualify.",
      "properties": {
        "next_level": {
          "description": "Key of the lowest level above the current one that has qualification criteria.",
          "type": "string"
        },
        "paths": {
          "description": "Each way to reach the next level. The participant qualifies when every criterion in any one path passes.",
          "items": {
            "$ref": "#/$defs/TierProgressPath"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "TierProgressCriterion": {
      "description": "One counter comparison with the participant's current value. `threshold`, `value` and `remaining` are decimal strings.",
      "properties": {
        "counter": {
          "description": "Counter key the comparison reads.",
          "type": "string"
        },
        "operator": {
          "description": "Comparison operator.",
          "enum": [
            ">=",
            ">",
            "==",
            "<=",
            "<"
          ],
          "type": "string"
        },
        "remaining": {
          "description": "Amount still needed to pass. Present only for the >= operator. It is 0 once the comparison passes.",
          "type": "string"
        },
        "satisfied": {
          "description": "Whether this comparison passes now.",
          "type": "boolean"
        },
        "threshold": {
          "description": "Threshold the counter is compared to.",
          "type": "string"
        },
        "value": {
          "description": "The participant's current counter value. A counter with no value yet reads as `0`.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "TierProgressPath": {
      "description": "One way to reach the next level. Every criterion in it must pass.",
      "properties": {
        "criteria": {
          "description": "The counter comparisons in this path.",
          "items": {
            "$ref": "#/$defs/TierProgressCriterion"
          },
          "type": "array"
        },
        "satisfied": {
          "description": "Whether every criterion in this path passes now. A SUSPENDED or CLOSED participant does not advance even when it passes.",
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "TierState": {
      "description": "A participant's or group's standing in one tier: the level, its rank, and when they earned it and when it ends.",
      "properties": {
        "acquired_at": {
          "description": "When this tier level was earned",
          "format": "date-time",
          "type": "string"
        },
        "benefits": {
          "additionalProperties": {},
          "description": "Benefits granted by this tier level",
          "type": "object"
        },
        "expires_at": {
          "description": "When this tier level expires",
          "format": "date-time",
          "type": "string"
        },
        "level": {
          "description": "Current tier level name",
          "type": "string"
        },
        "progress": {
          "$ref": "#/$defs/TierProgress",
          "description": "Progress to the next level. Only `GET /v1/participants/{participant_id}/state/tiers/{tier_key}` returns it. Absent when no level above the current one has qualification criteria, or the tier is archived."
        },
        "rank": {
          "description": "Numeric rank within the tier (higher = better)",
          "type": "integer"
        }
      },
      "type": "object"
    }
  }
}