B
SZN 2026 / BUILDER GUIDE
Kalshi logo

How to Build a Kalshi Sports Betting Bot

Build your own automated trading bot for Kalshi MLB and NFL game lines, with the exact risk limits ours runs with.

EDUCATIONAL / NO KEYS / NO API ACCESS

WHAT THE BOT DOES, IN 30 SECONDS

The bot reads your model picks, finds the matching open Kalshi market, and places orders that pass your risk limits. It runs on a schedule several times a day so late-opening markets get caught. Every bet is queued, executed with retries, then graded from the Kalshi settlement. This guide shows the four stages, the setup, and the exact limits our bot runs with. It does not hand out our keys or our API.

New to Kalshi? Sign up with our referral link.

HOW THE BOT WORKS
01SCAN

Read your model picks and find the matching open Kalshi market for each one.

02QUEUE

Store every qualifying bet as a row with a status field, so nothing is lost between passes.

03EXECUTE

Place the order, and retry on a network or rate-limit failure instead of dropping the bet.

04GRADE

Settle each bet from the Kalshi market result, not from your own score feed.

Run all four stages on a schedule, several passes per day, so markets that open late still get caught.

SETUP STEPS
  1. 01Open a Kalshi account , verify it and fund it.
  2. 02Build and test on Kalshi's demo environment first. Demo credentials are separate from production.
  3. 03Create an API key in your Kalshi account settings. Save the private key file right away because Kalshi shows it only once.
  4. 04Store the key ID and private key as server-side secrets (environment variables in your host). Never put them in browser code or commit them to git.
  5. 05Pick a host that can run on a schedule, for example a serverless function plus a cron job, or a small always-on server.
  6. 06Sign every request. Headers: KALSHI-ACCESS-KEY, KALSHI-ACCESS-TIMESTAMP (milliseconds), KALSHI-ACCESS-SIGNATURE. The signature is RSA-PSS SHA-256 over timestamp + HTTP method + path. Sign the path WITHOUT the query string.
  7. 07Get picks from your own model. Each pick needs the game, bet type, line, and your model probability.
  8. 08Match each pick to a Kalshi market, compute the edge (your probability minus the Kalshi ask price), and queue it only if it passes your limits.
  9. 09Place orders, then grade each bet from the settled market result, not from your own score feed.
PLACEHOLDER SIGNING FUNCTION
// Placeholder signing function. No real keys here.
// Check docs.kalshi.com for the current base URLs and endpoints.
import crypto from "node:crypto";

const KEY_ID = process.env.YOUR_KEY_ID;       // your key id, server-side
const PRIVATE_KEY = process.env.YOUR_PRIVATE_KEY; // PEM string, server-side

export function signRequest(method, path) {
  const timestamp = Date.now().toString();
  const message = timestamp + method.toUpperCase() + path; // path WITHOUT query string
  const signer = crypto.createSign("RSA-SHA256");
  signer.update(message);
  const signature = signer.sign(
    { key: PRIVATE_KEY, padding: crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST },
    "base64"
  );
  return {
    "KALSHI-ACCESS-KEY": KEY_ID,
    "KALSHI-ACCESS-TIMESTAMP": timestamp,
    "KALSHI-ACCESS-SIGNATURE": signature,
  };
}

Check Kalshi's API docs at docs.kalshi.com for the current base URLs and endpoints.

OUR EXAMPLE CONSTRAINTS

THE LIMITS OUR BOT RUNS WITH

UNIT SIZE$100 flat per bet. Contracts = floor(unit / ask price in cents).
DAILY CAP$600 of placed stake per game date, shared across all sports. At $100 units that is 6 bets.
EDGE FLOOR VS KALSHI2%. Model probability must beat the live Kalshi ask by at least 2 points, re-checked right before the order.
MODEL GATE FIRSTThe bot only takes picks our model marks live. Paper-mode picks are skipped.
START BUFFERNo new bets within 10 minutes of first pitch or kickoff.
LOOKAHEADPicks can queue up to 4 days ahead and place when the edge is found, to capture closing line value.
RETRIESUp to 6 placement attempts per bet, so one network error does not mean a missed bet.
FILL CAPContracts are capped at the size available at the ask. A thin book gives a small fill, not an error.
NO LINE SHOPPINGIf Kalshi has no strike at the exact line the model published, skip the pick. Never move it to the nearest strike.
ONE BET PER MARKETSkip a market that is already queued.
SWITCHESA live on/off flag, an auto-execute flag, and a kill switch that stops all placement at once.
MARKETSMLB game totals and run line, NFL game totals and moneyline. MLB moneyline and NFL spread are turned off in our setup.

These are our settings, not advice. Size your own unit to your own bankroll.

GOTCHAS WE HIT
COLLATERAL IS PER EXCHANGE SHARD

Kalshi runs markets on more than one shard. Cash on one shard cannot back an order on another. The Kalshi website moves the money for you, the API does not. Turn on Kalshi's automatic balance allocation across the shards you trade. A "user not found" or "insufficient balance" error on one sport only usually means this.

CANCELS ARE SHARD-ROUTED TOO

Pass the exchange index when you cancel, or the cancel lands on the wrong shard.

SIGNING WITH THE QUERY STRING ATTACHED

Including the query string in the signed path gives a signature error. Sign the path only.

KALSHI TICKER DATES ARE EASTERN TIME

Match games on the team pair, not only the date, or a late game rolls into the next day.

TEAM CODES DIFFER BETWEEN SOURCES

For example JAX vs JAC, LA vs LAR. Map them or you drop teams with no error.

NFL TOTAL STRIKES DO NOT STEP BY 0.5

Match on the numeric strike, not on a half-point ladder like a sportsbook.

A TIED NFL MONEYLINE SETTLES AT 50 CENTS A SIDE

Grade ties as 50, not as a loss, or your record drifts.

RETRY ERRORED ROWS

If the bot only picks up pending rows, one failure means a missed bet for the day. Re-scan errored rows each pass.

A SCHEDULED JOB THAT SAYS "OK" CAN STILL HAVE FAILED EVERY ITEM INSIDE IT

Check what it wrote, not just the run status.

FAQ

Is a Kalshi bot legal?

Kalshi is a CFTC-regulated exchange and offers an API for automated trading. Check availability in your state.

Can I use BankrollSZN picks?

Our Monte Carlo picks are on the site. This guide does not give access to our API or our bot.

How much money do I need?

Enough that your unit is a small part of your bankroll. Our example is $100 units with a $600 daily cap.

Does the bot win?

Not guaranteed. Track every bet and grade it from settlement.

RESPONSIBLE GAMING

21+. Bet within your means. If you or someone you know has a gambling problem, call 1-800-GAMBLER. This guide is educational and is not financial advice.

SHARP • DISCIPLINED • WRY • IN IT FOR THE LONG RUN

See less. Show the number. Let the season talk.

How to build a Kalshi sports betting bot

A step by step guide to building your own Kalshi trading bot for MLB and NFL game lines. Covers how the bot works across four stages, the setup steps, the exact risk limits our bot runs with, and the gotchas we hit in production.

This guide is educational. It does not give access to our API, our keys, or our bot. Use your own model and your own Kalshi account.

Frequently asked questions

Is a Kalshi bot legal?

Kalshi is a CFTC-regulated exchange and offers an API for automated trading. Check availability in your state.

Can I use BankrollSZN picks?

Our Monte Carlo picks are on the site. This guide does not give access to our API or our bot.

How much money do I need?

Enough that your unit is a small part of your bankroll. Our example is $100 units with a $600 daily cap.

Does the bot win?

Not guaranteed. Track every bet and grade it from settlement.