API Instructions
5The Fantasy Football Analytics API allows developers to programmatically access our data in JSON format. Users must pay for a standalone subscription to obtain a unique API key granting access. To subscribe to the API, contact us at sales@fantasyfootballanalytics.net.
There are two API subscription types, “Basic” and “Premier”, both of which allow access to seasonal and weekly projections for previous seasons and to seasonal projections for the current season. Only the “Premier” subscription allows access to weekly projections for the current season. Both subscriptions also allow unrestricted access to ADP data for all seasons to date.
The API has two endpoints, “proj” and “adp”, which allow the user to get averaged projections and ADP data, respectively. API requests are expected to be made in the form of a simple HTTP GET, with users specifying various query parameters. Specifically, the optional query parameters for the “proj” endpoint are:
• pos: One of “qb” (default), “rb”, “wr”, “te”, “k”, “dst”, “dl”, “lb”, or “db”.
• season: A year between 2008 and the most recent NFL season (default), inclusive.
• week: An integer between 0 and 20, inclusive. The option week = 0 (default) corresponds to seasonal projections, whereas all other options correspond to weekly projections. The options week > 17 are used to designate playoff weeks. Weekly projections are not available for seasons prior to 2015.
• type: Scheme used to average individual projection sources; one of “average” (simple average; default), “robust” (robust average, which is resistant to outliers), or “weight” (weighted average, whereby the weights are based on historical projection accuracy).
The optional query parameters for the “adp” endpoint are:
• season: A year between 2015 and the most recent NFL season (default), inclusive.
• type: League type; either “std” (standard; default) or “ppr” (points-per-reception).
API calls can be made using a programming language of your choice. In particular, the example below demonstrates how to get weighted average projections for team defenses for the 2016 season using R. (Be sure to replace “YOUR_API_KEY” with your actual unique API key for the Authorization header.) Analogously, ADP data may be retrieved by changing the “endpoint” parameter to “adp” and setting the query parameters appropriately.
# query parameters pos <- "dst" season <- 2016 week <- 0 type <- "weight" # construct API URL protocol <- "https" host <- "api.fantasyfootballanalytics.net/api" endpoint <- "proj" query.string <- paste0("?pos=", pos, "&season=", season, "&week=", week, "&type=", type) URL <- paste0(protocol, "://", host, "/", endpoint, query.string) # API key api.key <- "YOUR_API_KEY" # call API to get JSON json <- httr::content(httr::GET(URL, httr::add_headers(Authorization = paste("Basic", api.key))), type = "text") # convert JSON to data frame df <- jsonlite::fromJSON(json)
Please note that empty/null values are intentionally omitted from the returned JSON, following Google’s JSON style guide.
{
"player": "Saquon Barkley",
"position": "RB",
"team": "NYG",
"rushAtt": 267.7298,
"rushYds": 1278.529,
"rushTds": 10.5618,
"rec": 87.4195,
"recYds": 695.697,
"recTds": 3.7501,
"fumbles": 2.15,
"twoPts": 1.34,
"rush40": 6.51,
"rec40": 2.05,
"games": 16,
"returnTds": 0,
"returnYds": 0
}
The attribute-value pairs in the ADP object do not vary with season or league type; an example of the ADP object for the 2019 season is provided below:
{
"player": "Saquon Barkley",
"position": "RB",
"team": "NYG",
"adp": 1.3125
}
how far back do the weekly projections go?
https://fantasyfootballanalytics.net/about-the-site/faq#historicalProjections
Is the ADP data into the season? I’m looking for weekly updated rest-of-season rankings type data and ADP would work if people still are drafting during the season?
I subscribed and do not see an API key when I click “my account”. could you help me locate this so I can get the past seasons projections data?
You are subscribed to FFA Insider, not the API. To subscribe to the API, sign up for the Basic API or Premier API package, as described here:
https://fantasyfootballanalytics.net/2018/06/fantasy-football-analytics-api.html