API Reference

Interact with LineupGen from your terminal, send API requests in your programs, and programmatically generate lineups.

The LineupGen API uses API keys to authenticate requests. You can view and manage your API key(s) in your LineupGen account dashboard.

Your API key(s) carry many privileges, so be sure to keep them secure! Do not share your secret API key(s) in publicly accessible areas such as GitHub, client-side code, and so forth.

import requests

# token available in your account dashboard
LINEUPGEN_TOKEN = "your-lineupgen-token"
LINEUPGEN_URL = "https://api.lineupgen.com/v1/lineups/generate"

headers = [
    "Position",
    "Name + ID",
    "Name",
    "ID",
    "Roster Position",
    "Salary",
    "Game Info",
    "TeamAbbrev",
    "AvgPointsPerGame"
]

# example inputs
# see example data below
players = [headers, [...player1....], [...player2...]]
sport = "NFL"


headers = {
    "Authorization": "Token " + LINEUPGEN_TOKEN,
    "Content-Type": "application/json",
}

payload = {
    "players": players,
    "sport": sport,
    "num": 1,
    "min_salary_cap": 0,
    "max_salary_cap": 50000,
    "show_total_cost": True,
    "multi_team": True,
    "multi_game": True,
}

r = requests.post(LINEUPGEN_URL, json=payload, headers=headers)
r.raise_for_status()

res = r.json()
print(res["lineups"])

// token available in your account dashboard
const token = 'your-lineupgen-token'

const url = 'https://api.lineupgen.com/v1/lineups/generate'

const response = await fetch(url, {
  headers: {
    Authorization: 'Token ' + token,
    'Content-Type': 'application/json',
  },
  method: 'POST',
  body: JSON.stringify({
    players, // includes header row
    sport,
    num,
    min_salary_cap,
    max_salary_cap,
    show_total_cost,
    multi_team,
    multi_game,
  }),
})

const jsonResponse = await response.json()

// Expect that status code is in 200-299 range
if (response.ok) {
  return jsonResponse.lineups
}
Request Payload
KeyTypeDescriptionDefaultOptional
players*ArrayPlayer data for competitionno
sportString"CFB", "GOLF", "MLB", "MMA", "NAS", "NBA", "NFL", "SOC", "TEN"no
numNumberNumber of lineups to generate. If omitted, num = 1.1yes
min_salary_capNumberMinimum total cost of each lineup. If omitted, min_salary_cap = 0.0yes
max_salary_capNumberMaximum total cost of each lineup. If omitted, max_salary_cap = 50000.50000yes
show_total_costBooleanShow total cost for each lineup. If omitted, show_total_cost = FALSE.FALSEyes
multi_teamBooleanPlayers from more than 1 team are required in each lineup. If omitted, multi_team = FALSE.FALSEyes
multi_gameBooleanPlayers from more than 1 game are required in each lineup. If omitted, multi_game = FALSE.FALSEyes
Response Payload
KeyTypeDescription
lineupsArrayGenerated lineups
countNumberNumber of lineups generated
successBooleanIf the request was successful
HTTP Status Code Summary
CodeDescription
200- OKEverything worked as expected.
400 - Bad RequestThe request was unacceptable, often due to missing a required parameter.
401 - UnauthorizedNo valid API key provided
402 - Request FailedThe parameters were valid but the request failed.
403 - ForbiddenThe API key doesn't have permissions to perform the request.
404 - Not FoundThe requested resource doesn't exist.
409 - ConflictThe request conflicts with another request.
500, 502, 503, 504 - Server ErrorsSomething went wrong on LineupGen's end. (These are rare.)
Example Player Data Structure
let players = [
  [
    "Position",
    "Name + ID",
    "Name",
    "ID",
    "Roster Position",
    "Salary",
    "Game Info",
    "TeamAbbrev",
    "AvgPointsPerGame"
  ],
  [
    "G",
    "Scottie Scheffler (15517110)",
    "Scottie Scheffler",
    15517110,
    "G",
    11400,
    "Sanderson Farms Championship",
    "Golf",
    74.59
  ],
  [
    "G",
    "Louis Oosthuizen (15517111)",
    "Louis Oosthuizen",
    15517111,
    "G",
    10800,
    "Sanderson Farms Championship",
    "Golf",
    70.15
  ],
  [
    "G",
    "Sungjae Im (15517112)",
    "Sungjae Im",
    15517112,
    "G",
    10500,
    "Sanderson Farms Championship",
    "Golf",
    68.93
  ],
  [
    "G",
    "Will Zalatoris (15517113)",
    "Will Zalatoris",
    15517113,
    "G",
    10200,
    "Sanderson Farms Championship",
    "Golf",
    77.75
  ],
  [
    "G",
    "Byeong Hun An (15517114)",
    "Byeong Hun An",
    15517114,
    "G",
    10000,
    "Sanderson Farms Championship",
    "Golf",
    60.59
  ],
  ...
]
*Required column headers

The players data must include the following column headers as the first row:

  • Name + ID
  • Name
  • ID
  • Roster Position
  • Salary
  • Game Info
  • TeamAbbrev

These column headers are included in the lineup template.