{
  "openapi": "3.1.0",
  "info": {
    "title": "Can I run GTA? API",
    "version": "1.1.0",
    "description": "Check a PC's specs against the requirements of every PC Grand Theft Auto release. Omitted specs come back as unknown, never as a pass."
  },
  "servers": [
    {
      "url": "https://canirungta.com"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkGtaCompatibility",
        "summary": "Check specs against every PC GTA version",
        "description": "Pass at least one of cpu, gpu, ram, vram, disk.",
        "parameters": [
          {
            "name": "cpu",
            "in": "query",
            "description": "CPU marketing name, e.g. 'Ryzen 5 5600' or 'Core i7-9700K'. Needed for a CPU verdict.",
            "example": "Ryzen 5 5600",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "gpu",
            "in": "query",
            "description": "GPU marketing name, e.g. 'RTX 3060' or 'Radeon RX 6600'. Needed for a GPU verdict.",
            "example": "RTX 3060",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ram",
            "in": "query",
            "description": "System RAM in GB",
            "example": 16,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "vram",
            "in": "query",
            "description": "GPU memory in GB; only used together with gpu",
            "example": 12,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "disk",
            "in": "query",
            "description": "Free disk space in GB",
            "example": 200,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "os",
            "in": "query",
            "description": "Operating system; defaults to windows",
            "example": "windows",
            "schema": {
              "type": "string",
              "enum": [
                "windows",
                "linux",
                "macos",
                "mobile"
              ]
            }
          },
          {
            "name": "windows",
            "in": "query",
            "description": "Windows major version; pass 10 for Windows 10 and 11. Omitted = OS check unknown on newer games.",
            "example": 10,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "version",
            "in": "query",
            "description": "Limit results to these version ids, comma-separated; default all. Ids: gta-vi, gta-v-enhanced, gta-v-2015, gta-iv-complete, gta-iv-original, gta-sa-definitive, gta-sa-original, gta-vc-definitive, gta-vc-original, gta-iii-definitive, gta-iii-original",
            "example": "gta-v-enhanced",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One result per GTA version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResponse"
                }
              }
            }
          },
          "400": {
            "description": "No specs supplied"
          }
        }
      }
    },
    "/api/versions.json": {
      "get": {
        "operationId": "listGtaRequirements",
        "summary": "Published minimum and recommended specs per GTA version",
        "responses": {
          "200": {
            "description": "Array of versions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GtaVersion"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GtaVersion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "gta-vi",
              "gta-v-enhanced",
              "gta-v-2015",
              "gta-iv-complete",
              "gta-iv-original",
              "gta-sa-definitive",
              "gta-sa-original",
              "gta-vc-definitive",
              "gta-vc-original",
              "gta-iii-definitive",
              "gta-iii-original"
            ]
          },
          "title": {
            "type": "string"
          },
          "edition": {
            "type": "string"
          },
          "confidence": {
            "type": "string",
            "enum": [
              "official",
              "approximate",
              "unannounced"
            ]
          },
          "sourceUrl": {
            "type": "string"
          },
          "minimum": {
            "type": "object",
            "description": "null = no published figure",
            "properties": {
              "ramGb": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "vramGb": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "diskGb": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "cpu": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Any one qualifies"
              },
              "gpu": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                },
                "description": "Any one qualifies"
              }
            }
          },
          "recommended": {
            "oneOf": [
              {
                "type": "object",
                "description": "null = no published figure",
                "properties": {
                  "ramGb": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "vramGb": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "diskGb": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "cpu": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "description": "Any one qualifies"
                  },
                  "gpu": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "description": "Any one qualifies"
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Missing fields fall back to the minimum"
          },
          "os": {
            "type": "object",
            "properties": {
              "minWindowsMajor": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "requires64Bit": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CheckResponse": {
        "type": "object",
        "properties": {
          "input": {
            "type": "object"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "suggestions": {
            "type": "object",
            "description": "Closest recognised names for an unrecognised cpu or gpu; retry with one of them",
            "properties": {
              "cpu": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "gpu": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "resultsUrl": {
            "type": "string",
            "description": "Web page showing this check; share it with the user"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "gta-vi",
                    "gta-v-enhanced",
                    "gta-v-2015",
                    "gta-iv-complete",
                    "gta-iv-original",
                    "gta-sa-definitive",
                    "gta-sa-original",
                    "gta-vc-definitive",
                    "gta-vc-original",
                    "gta-iii-definitive",
                    "gta-iii-original"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "edition": {
                  "type": "string"
                },
                "summary": {
                  "type": "string",
                  "description": "One-sentence explanation of the verdict"
                },
                "verdict": {
                  "type": "string",
                  "enum": [
                    "runs-well",
                    "runs",
                    "cannot",
                    "unknown",
                    "needs-windows",
                    "unsupported"
                  ]
                },
                "confidence": {
                  "type": "string",
                  "enum": [
                    "official",
                    "approximate",
                    "unannounced"
                  ]
                },
                "sourceUrl": {
                  "type": "string"
                },
                "checks": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "pass",
                          "fail",
                          "unknown"
                        ]
                      },
                      "actual": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "required": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "note": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}