{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/kicksma-sh/json-schema/kicksma-sh-create-match-schema.json",
  "title": "CreateMatch",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kicksma-sh-openapi.json#/components/schemas/CreateMatch",
  "type": "object",
  "properties": {
    "type": {
      "default": "match",
      "description": "A match is exactly four players. A tournament is an americano with 4 to 64 players in fours.",
      "type": "string",
      "enum": [
        "match",
        "tournament"
      ]
    },
    "startsAt": {
      "type": "string",
      "minLength": 10,
      "maxLength": 40,
      "description": "ISO 8601 date-time. With an offset or Z it is absolute; without one it is read in tz. Example: 2026-09-11T19:00"
    },
    "tz": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "IANA time zone the players live in, for example Asia/Singapore or Asia/Bangkok."
    },
    "durationMinutes": {
      "description": "How long the court is booked: 60, 90 or 120 minutes. Omit for 90 (a match) or 120 (a tournament). The match page, the cards and the calendar invitation show it.",
      "type": "number",
      "enum": [
        60,
        90,
        120
      ]
    },
    "venue": {
      "description": "Club or court name. Enables the venue board and the booking link.",
      "type": "string",
      "maxLength": 80
    },
    "venueMapUrl": {
      "type": "string",
      "maxLength": 500,
      "format": "uri"
    },
    "court": {
      "description": "Court within the venue, e.g. \"3\".",
      "type": "string",
      "maxLength": 40
    },
    "capacity": {
      "description": "Tournaments only, a multiple of 4. Matches are always 4.",
      "type": "integer",
      "minimum": 4,
      "maximum": 64
    },
    "format": {
      "description": "Tournaments only. americano: partners rotate, everyone plays everyone. mexicano: courts by standings after round 1. king: winners move up a court, losers down.",
      "type": "string",
      "enum": [
        "americano",
        "mexicano",
        "king"
      ]
    },
    "fixedPairs": {
      "default": false,
      "description": "Tournaments only: two partners play every round together, in any format. Pairs sign up together (join_match with partner); a player alone is listed as needing a partner. Americano then rotates the opponents: every pair meets every other pair, and the table ranks pairs.",
      "type": "boolean"
    },
    "pointsPerMatch": {
      "description": "Tournaments only: fixed points per match (16, 21, 24, 32). Omit for free scoring; mexicano defaults to 24.",
      "type": "integer",
      "minimum": 4,
      "maximum": 99
    },
    "gamesTo": {
      "description": "Tournaments only: first to N games (4, 6, 8) instead of points; the table then ranks by matches won.",
      "type": "integer",
      "minimum": 2,
      "maximum": 12
    },
    "whenFull": {
      "default": "waitlist",
      "type": "string",
      "enum": [
        "waitlist",
        "closed"
      ]
    },
    "levelMin": {
      "description": "Level range 0 to 7 (Playtomic-style). Omit both for any level.",
      "anyOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 7
        },
        {
          "type": "null"
        }
      ]
    },
    "levelMax": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 7
        },
        {
          "type": "null"
        }
      ]
    },
    "verifiedLevelsOnly": {
      "default": false,
      "description": "With a range: only levels confirmed by an organizer, a coach or a club walk in; declared levels inside the range ask to join.",
      "type": "boolean"
    },
    "category": {
      "description": "Who the match is for: men, women or mixed. Omit for anyone. Information for the players who find it; nobody is checked when they join.",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "men",
            "women",
            "mixed"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "ageMin": {
      "description": "An age tag: 35, 45 or 55 means 35+, 45+ or 55+. Omit for any age. Information only; nobody is checked when they join.",
      "anyOf": [
        {
          "type": "number",
          "enum": [
            35,
            45,
            55
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string",
      "maxLength": 80
    },
    "note": {
      "type": "string",
      "maxLength": 500
    },
    "bookingUrl": {
      "description": "The club's booking page or confirmation link, shown to players.",
      "type": "string",
      "maxLength": 500,
      "format": "uri"
    },
    "cost": {
      "description": "What each player pays, as free text: 400 THB, €8, split 4 ways.",
      "type": "string",
      "maxLength": 40
    },
    "listOnVenueBoard": {
      "default": false,
      "description": "Show the match on the public venue board (/v/{venue-slug}). Off by default.",
      "type": "boolean"
    },
    "organizer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40,
          "description": "First name is enough."
        },
        "token": {
          "description": "Personal token of an existing Kicksmash player, returned by earlier calls, so the same person organizes again.",
          "type": "string",
          "minLength": 8,
          "maxLength": 64
        },
        "email": {
          "description": "Optional. Gets the organizer link and calendar invite by email.",
          "type": "string",
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "level": {
          "type": "number",
          "minimum": 0,
          "maximum": 7
        }
      },
      "required": [
        "name"
      ]
    },
    "organizerPlays": {
      "default": true,
      "description": "Seat the organizer in the match (default). False when they only organize.",
      "type": "boolean"
    }
  },
  "required": [
    "startsAt",
    "tz",
    "organizer"
  ]
}