Feed in your roster, get back the optimal lineup for any week — QB, two RBs, two WRs, a TE, and a FLEX — chosen by projected points so you never leave a sneaky-good play on the bench.
/api/v1/projections/{week}?position={POS} — projected points for every player at a position that weekPass a week number; filter by position. Omit season and the API uses the current NFL season automatically.
curl -H "x-api-key: YOUR_KEY" \
"https://api.gridirondata.com/api/v1/projections/1?position=RB"
{
"season": "2026",
"week": 1,
"count": 19,
"projections": [
{ "player_name": "Bijan Robinson", "position": "RB", "projected_points": 21.4 },
{ "player_name": "Jahmyr Gibbs", "position": "RB", "projected_points": 20.8 }
]
}
ROSTER = [
("Josh Allen", "QB"), ("Jalen Hurts", "QB"),
("Bijan Robinson", "RB"), ("Chuba Hubbard", "RB"), ("David Montgomery", "RB"),
("CeeDee Lamb", "WR"), ("Drake London", "WR"), ("DK Metcalf", "WR"),
("Trey McBride", "TE"),
]
# Slots to fill, in priority order. FLEX takes the best leftover RB/WR/TE.
SLOTS = ["QB", "RB", "RB", "WR", "WR", "TE", "FLEX"]
FLEX_OK = {"RB", "WR", "TE"}
import requests
API = "https://api.gridirondata.com/api/v1"
H = {"x-api-key": "YOUR_KEY"}
WEEK = 1
# 1. Pull projections for the positions we care about, index by player name
proj = {}
for pos in {"QB", "RB", "WR", "TE"}:
data = requests.get(f"{API}/projections/{WEEK}", headers=H, params={"position": pos}).json()
for p in data.get("projections", []):
proj[p["player_name"]] = (pos, float(p.get("projected_points", 0)))
# 2. Attach projections to your roster
players = []
for name, pos in ROSTER:
pts = proj.get(name, (pos, 0.0))[1]
players.append({"name": name, "pos": pos, "pts": pts})
# 3. Fill each slot greedily with the best eligible, unused player
used, lineup = set(), []
for slot in SLOTS:
eligible = [p for p in players if p["name"] not in used and
(p["pos"] == slot or (slot == "FLEX" and p["pos"] in FLEX_OK))]
best = max(eligible, key=lambda p: p["pts"], default=None)
if best:
used.add(best["name"]); lineup.append((slot, best))
total = sum(p["pts"] for _, p in lineup)
for slot, p in lineup:
print(f"{slot:5} {p['name']:20} {p['pts']:5.1f}")
print(f"Projected total: {total:.1f}")
seasons.2026.injury_status from /players/{id} before locking your lineup.