{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/affiliaterail-com/json-schema/affiliaterail-com-program-list-schema.json",
  "title": "ProgramList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/affiliaterail-com-programs-api-openapi.yml#/components/schemas/ProgramList",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Program"
      }
    },
    "has_more": {
      "type": "boolean",
      "description": "Pass the last object's id as `starting_after` to fetch the next page"
    },
    "total_count": {
      "type": "integer",
      "description": "Count of every object matching the filters, ignoring the cursor"
    }
  },
  "required": [
    "data",
    "has_more",
    "total_count"
  ],
  "$defs": {
    "Program": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(sample_)?prg_",
          "description": "Prefixed id (`prg_…`)"
        },
        "object": {
          "type": "string",
          "enum": [
            "program"
          ]
        },
        "name": {
          "type": "string"
        },
        "product_name": {
          "type": "string"
        },
        "website_url": {
          "type": "string"
        },
        "currency": {
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "description": "ISO-4217"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "paused"
          ]
        },
        "subdomain": {
          "type": "string"
        },
        "custom_domain": {
          "type": [
            "string",
            "null"
          ]
        },
        "terms_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "terms_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "cookie_days": {
          "type": "integer"
        },
        "url_params": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "commission_on_net_revenue": {
          "type": "boolean"
        },
        "holding_period_days": {
          "type": "integer"
        },
        "min_payout_minor": {
          "type": "integer",
          "description": "Integer minor units (cents, pence). Never a float, never a string."
        },
        "payout_term": {
          "type": "string",
          "enum": [
            "net_15",
            "net_30",
            "net_60"
          ]
        },
        "payout_methods": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "paypal",
              "wise",
              "bank_transfer",
              "wire",
              "crypto",
              "payoneer"
            ]
          }
        },
        "block_self_referrals": {
          "type": "boolean"
        },
        "blocked_countries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "require_tax_forms": {
          "type": "boolean"
        },
        "auto_payouts_enabled": {
          "type": "boolean"
        },
        "processor": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "stripe",
            "paddle",
            "chargebee",
            "manual",
            "api",
            null
          ]
        },
        "stats": {
          "$ref": "#/$defs/ProgramStats"
        },
        "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",
        "name",
        "product_name",
        "website_url",
        "currency",
        "status",
        "subdomain",
        "custom_domain",
        "terms_url",
        "terms_version",
        "cookie_days",
        "url_params",
        "commission_on_net_revenue",
        "holding_period_days",
        "min_payout_minor",
        "payout_term",
        "payout_methods",
        "block_self_referrals",
        "blocked_countries",
        "require_tax_forms",
        "auto_payouts_enabled",
        "processor",
        "created_at",
        "updated_at"
      ]
    },
    "ProgramStats": {
      "type": "object",
      "properties": {
        "partners": {
          "type": "integer"
        },
        "active_partners": {
          "type": "integer"
        },
        "clicks": {
          "type": "integer"
        },
        "referrals": {
          "type": "integer"
        },
        "customers": {
          "type": "integer"
        },
        "sales_minor": {
          "type": "integer",
          "description": "Integer minor units (cents, pence). Never a float, never a string."
        },
        "commissions_minor": {
          "type": "integer",
          "description": "Integer minor units (cents, pence). Never a float, never a string."
        }
      },
      "required": [
        "partners",
        "active_partners",
        "clicks",
        "referrals",
        "customers",
        "sales_minor",
        "commissions_minor"
      ]
    }
  }
}