Export NBA Classic DFS lineups as ready-to-upload CSV
When your downstream workflow uploads directly to an operator, use `optimizerLineupsCsv` (`response_format: "csv"`) to retrieve slot-ordered CSV rows ready for DraftKings or FanDuel import.
- What it is
- Optimizes 3 NBA Classic lineups on slate `1243812` with `min_unique_players: 2` and streams back the direct operator CSV upload string.
- When to use it
- Use this when automating pre-lock DraftKings or FanDuel upload CSV pipelines without converting JSON responses manually.
- What you get back
- CSV line count plus the exact header row and top 3 optimized lineup rows.
1.Generate NBA Classic lineups in CSV format
Call `optimizerLineupsCsv` on NBA Classic slate `1243812` requesting 3 lineups with at least 2 unique players between lineups.
POST request (requires your API key in STAT_API_KEY). Run the SDK program on the right or the curl snippet below.
{
"lineup_count": 3,
"min_unique_players": 2,
"response_format": "csv"
}const csvText = await api.dfs.slates.optimizerLineupsCsv(1243812, { lineup_count: 3, min_unique_players: 2 })The complete program
Every step as one runnable file. It reads STAT_API_KEY from the environment, and is the same file that ships in the cookbook project for each SDK.
import { StatApi } from '@stat-api/client'
const api = new StatApi() // reads STAT_API_KEY from the environment
// Generate NBA Classic lineups in CSV format
const csvText = await api.dfs.slates.optimizerLineupsCsv(1243812, { lineup_count: 3, min_unique_players: 2 })
// Preview exported CSV header and rows
const csvLines = csvText.split('\n').map((s) => s.replace(/\r$/, '')).filter((s) => s.length > 0)
console.log(`CSV lines=${csvLines.length}`)
for (const line of csvLines.slice(0, 4)) console.log(line)Verified output across all 4 SDKs
TypeScript, Python, Go, and Java execute cleanly and print byte-identical output:
CSV lines=4
PG,SG,SF,PF,C,G,F,UTIL,rank,salary,projected_points,stack_summary
44955918,44955996,44956024,44956295,44956012,44956164,44956219,44956113,1,50000,284.73,Unstacked
44955918,44955996,44956164,44956295,44956113,44955985,44956219,44956059,2,49900,281.94,Unstacked
44955918,44955996,44955941,44956184,44956113,44956164,44956219,44956295,3,49900,281.15,Unstacked