{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/api-ninjas-com/json-schema/api-ninjas-com-baseball-game-schema.json",
  "title": "BaseballGame",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api-ninjas-com-baseball-api-openapi.yml#/components/schemas/BaseballGame",
  "type": "object",
  "properties": {
    "game_id": {
      "type": "string",
      "description": "Unique, permanent id of the game."
    },
    "league": {
      "type": "string",
      "enum": [
        "mlb"
      ]
    },
    "sport": {
      "type": "string",
      "enum": [
        "baseball"
      ]
    },
    "season": {
      "type": "integer",
      "description": "Year the season starts."
    },
    "season_label": {
      "type": "string"
    },
    "season_type": {
      "type": "string",
      "enum": [
        "preseason",
        "regular",
        "postseason"
      ]
    },
    "date": {
      "type": "string",
      "format": "date",
      "description": "Game day in US Eastern time."
    },
    "start_time": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string",
      "enum": [
        "scheduled",
        "in_progress",
        "final",
        "postponed",
        "canceled",
        "suspended",
        "delayed"
      ]
    },
    "status_detail": {
      "type": [
        "string",
        "null"
      ],
      "description": "While a game is in progress: top, middle, bottom or end of the inning. While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead."
    },
    "period": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Current or last inning played; extra innings continue the count. While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead."
    },
    "clock": {
      "type": [
        "string",
        "null"
      ],
      "description": "Always null: baseball has no game clock."
    },
    "home_team": {
      "$ref": "#/$defs/BaseballTeamRef"
    },
    "away_team": {
      "$ref": "#/$defs/BaseballTeamRef"
    },
    "home_score": {
      "type": [
        "integer",
        "null"
      ],
      "description": "While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead."
    },
    "away_score": {
      "type": [
        "integer",
        "null"
      ],
      "description": "While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead."
    },
    "period_scores": {
      "type": [
        "object",
        "null"
      ],
      "description": "Runs per inning, with every extra inning. While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead.",
      "properties": {
        "home": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "away": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        }
      }
    },
    "hits": {
      "type": [
        "object",
        "null"
      ],
      "description": "hits per team. While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead.",
      "properties": {
        "home": {
          "type": "integer"
        },
        "away": {
          "type": "integer"
        }
      }
    },
    "errors": {
      "type": [
        "object",
        "null"
      ],
      "description": "errors per team. While a game is in progress, the free plan receives the string \"This field is for premium subscribers only.\" instead.",
      "properties": {
        "home": {
          "type": "integer"
        },
        "away": {
          "type": "integer"
        }
      }
    },
    "decided_in": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "regulation",
        "extra_innings",
        null
      ]
    },
    "winner": {
      "type": [
        "string",
        "null"
      ],
      "description": "team_id of the winner of a final game; null before then."
    },
    "venue": {
      "$ref": "#/$defs/BaseballVenue"
    },
    "neutral_site": {
      "type": "boolean"
    },
    "original_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "First scheduled date of a moved game."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "BaseballTeamRef": {
      "type": "object",
      "properties": {
        "team_id": {
          "type": "string",
          "description": "Team id, e.g. mlb-nyy."
        },
        "name": {
          "type": "string"
        },
        "abbreviation": {
          "type": "string"
        }
      }
    },
    "BaseballVenue": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166-1 alpha-2"
        }
      }
    }
  }
}