{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/affiliaterail-com/json-schema/affiliaterail-com-referral-schema.json",
  "title": "Referral",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/affiliaterail-com-referrals-api-openapi.yml#/components/schemas/Referral",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^(sample_)?ref_",
      "description": "Prefixed id (`ref_…`)"
    },
    "object": {
      "type": "string",
      "enum": [
        "referral"
      ]
    },
    "program_id": {
      "type": "string",
      "pattern": "^(sample_)?prg_",
      "description": "Prefixed id (`prg_…`)"
    },
    "partner_id": {
      "type": "string",
      "pattern": "^(sample_)?part_",
      "description": "Prefixed id (`part_…`)"
    },
    "link_id": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^(sample_)?lnk_",
      "description": "Prefixed id (`lnk_…`)"
    },
    "landing_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "utm": {},
    "tracked_by": {
      "type": "string",
      "enum": [
        "link",
        "coupon",
        "manual",
        "api"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "visit",
        "lead",
        "converted"
      ]
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601, UTC"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601, UTC"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601, UTC"
    }
  },
  "required": [
    "id",
    "object",
    "program_id",
    "partner_id",
    "link_id",
    "landing_url",
    "tracked_by",
    "status",
    "expires_at",
    "created_at",
    "updated_at"
  ]
}