{
  "openapi": "3.1.1",
  "info": {
    "title": "Rising Kingpin Heist Odds Calculator API",
    "version": "1.0.0",
    "summary": "Success chance, loot, arrest risk and fight odds for any Rising Kingpin crime before you commit it.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://risingkingpinodds.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Success chance, loot, arrest risk and fight odds for any Rising Kingpin crime before you commit it.",
        "description": "Computes the odds of a Rising Kingpin crime — from pickpocketing to the mail-train heist — for a crew with given stats, weapon, rank and heat: success chance, loot range and expected value, the chance that the police show up or the guards fight back, the win chance of that fight from 200 seeded simulations, the arrest risk and the sentence. The same function the game’s odds card and computer players use.\n\nMethodology:\n- Success chance = base chance of the crime + (skill − 50)/180 + 4 % per crew member above the minimum + 10 % with a firearm (robberies and heists) or 4 % with a melee weapon (robberies) + event bonuses − heat/400, limited to 5 %–92 %. Skill = the crime’s weighted stats (e.g. intelligence 0.7 and stealth 0.3 for the vault).\n- On failure the crime’s alarm share brings the police and its fight share makes the guards fight back; a won fight still gets the loot. Fight win chances come from 200 seeded simulations of the game’s turn-based fight (range, accuracy, damage and energy per weapon).\n- Arrest risk = failure × alarm × the chance of NOT getting away with the best option (flee then fight, or bribe then fight when they take the money and arrest you anyway — 15 %). Sentence = 1–5 weeks by tier + rank/3.\n- Expected value = chance of getting the loot × average loot value (goods at their base price, stolen cars at what a chop shop pays) − the expected bribe. Prison weeks, reputation and heat are shown separately.\n\nNumbers of the Rising Kingpin game — a fictional crime strategy game. Not advice of any kind.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "rising_kingpin_odds",
        "x-owner-app": "risingkingpin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RisingKingpinOddsInput"
              },
              "examples": {
                "example1": {
                  "summary": "Bank hold-up with two armed crooks",
                  "value": {
                    "crime": "holdup",
                    "crewSize": 2,
                    "rank": 3,
                    "weapon": "pistol"
                  }
                },
                "example2": {
                  "summary": "First pickpocketing on the metro",
                  "value": {
                    "crime": "pickpocket-train",
                    "crewSize": 1,
                    "rank": 0,
                    "intelligence": 50,
                    "weapon": "fists",
                    "hasCar": false,
                    "hideout": false,
                    "cash": 1200
                  }
                },
                "example3": {
                  "summary": "Mail train with a heavy crew",
                  "value": {
                    "crime": "mail-train",
                    "crewSize": 5,
                    "rank": 5,
                    "weapon": "smg",
                    "intelligence": 70,
                    "brutality": 70,
                    "strength": 65,
                    "energy": 45,
                    "event": "mailtrain",
                    "heat": 30,
                    "cash": 40000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RisingKingpinOddsResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RisingKingpinOddsInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "crime": {
            "title": "Crime",
            "type": "string",
            "enum": [
              "pickpocket-platform",
              "pickpocket-train",
              "pickpocket-park",
              "pickpocket-pier",
              "mug",
              "beg",
              "rob-shop",
              "rob-desk",
              "burgle-villa",
              "steal-car",
              "burgle-store",
              "holdup",
              "steal-containers",
              "crack-vault",
              "armored-truck",
              "rob-payoffice",
              "mail-train"
            ],
            "default": "holdup"
          },
          "crewSize": {
            "title": "Crew size (people taking part)",
            "type": "integer",
            "minimum": 1,
            "maximum": 7,
            "default": 2
          },
          "rank": {
            "title": "Rank of the boss (0 Nobody … 7 Kingpin)",
            "description": "0 Nobody, 1 Street Rat, 2 Hustler, 3 Crook, 4 Enforcer, 5 Racketeer, 6 Underboss, 7 Kingpin",
            "type": "integer",
            "minimum": 0,
            "maximum": 7,
            "default": 3
          },
          "heat": {
            "title": "Heat (wanted level, 0–100)",
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 10
          },
          "intelligence": {
            "title": "Intelligence of each crew member",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 55
          },
          "brutality": {
            "title": "Brutality",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 55
          },
          "strength": {
            "title": "Strength",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 50
          },
          "stealth": {
            "title": "Stealth",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 35
          },
          "escape": {
            "title": "Escape",
            "type": "integer",
            "minimum": 1,
            "maximum": 99,
            "default": 30
          },
          "energy": {
            "title": "Energy of each crew member",
            "type": "integer",
            "minimum": 1,
            "maximum": 80,
            "default": 35
          },
          "weapon": {
            "title": "Weapon of each crew member",
            "type": "string",
            "enum": [
              "fists",
              "knife",
              "bat",
              "pistol",
              "revolver",
              "shotgun",
              "smg",
              "rifle",
              "grenades"
            ],
            "default": "pistol"
          },
          "hasCar": {
            "title": "Getaway car (helps fleeing)",
            "type": "boolean",
            "default": true
          },
          "hideout": {
            "title": "Hideout rented (needed for the vault)",
            "type": "boolean",
            "default": true
          },
          "cash": {
            "title": "Cash on hand (for a bribe)",
            "type": "integer",
            "minimum": 0,
            "maximum": 100000000,
            "default": 5000
          },
          "event": {
            "title": "City event this week",
            "type": "string",
            "enum": [
              "none",
              "festival",
              "blackout",
              "vip",
              "election",
              "mailtrain"
            ],
            "default": "none"
          },
          "tip": {
            "title": "Hot tip (+10 %)",
            "type": "boolean",
            "default": false
          },
          "immunity": {
            "title": "Chief of police bribed",
            "type": "boolean",
            "default": false
          },
          "car": {
            "title": "Car to steal (only “Steal a car”)",
            "type": "string",
            "enum": [
              "rustbucket",
              "hatchback",
              "sedan",
              "van",
              "coupe",
              "muscle",
              "limo",
              "sports"
            ],
            "default": "sedan"
          },
          "carFrom": {
            "title": "Steal it from (only “Steal a car”)",
            "type": "string",
            "enum": [
              "cardealer",
              "villa"
            ],
            "default": "cardealer"
          }
        },
        "required": []
      },
      "RisingKingpinOddsResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "ok",
              "reason",
              "crime",
              "crimeName",
              "tier",
              "steps",
              "chance",
              "loot",
              "lootValue",
              "rep",
              "heat",
              "alarm",
              "fightShare",
              "fightWin",
              "police",
              "lootChance",
              "arrestRisk",
              "sentence",
              "expected",
              "notes",
              "requirements"
            ],
            "properties": {
              "ok": {
                "type": "boolean"
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "crime": {
                "type": "string"
              },
              "crimeName": {
                "type": "string"
              },
              "tier": {
                "type": "integer"
              },
              "steps": {
                "type": "integer"
              },
              "chance": {
                "type": "number"
              },
              "loot": {
                "type": "object"
              },
              "lootValue": {
                "type": "object",
                "properties": {
                  "min": {
                    "type": "integer"
                  },
                  "max": {
                    "type": "integer"
                  },
                  "mean": {
                    "type": "integer"
                  }
                }
              },
              "rep": {
                "type": "integer"
              },
              "heat": {
                "type": "integer"
              },
              "alarm": {
                "type": "number"
              },
              "fightShare": {
                "type": "number"
              },
              "fightWin": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "police": {
                "type": "object",
                "properties": {
                  "officers": {
                    "type": "integer"
                  },
                  "flee": {
                    "type": "number"
                  },
                  "fightWin": {
                    "type": "number"
                  },
                  "bribeCost": {
                    "type": "integer"
                  },
                  "bribeAffordable": {
                    "type": "boolean"
                  },
                  "escape": {
                    "type": "number"
                  }
                }
              },
              "lootChance": {
                "type": "number"
              },
              "arrestRisk": {
                "type": "number"
              },
              "sentence": {
                "type": "integer"
              },
              "expected": {
                "type": "integer"
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "requirements": {
                "type": "object"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}