API Reference
The Grufity API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
To authenticate the request, utilize the Grufity API along with the API key available on your profile page.
The capability to perform bulk requests is not supported by the Grufity API. Each request allows you to work on a single object at a time.
The Grufity API differs for every account as we release new versions and tailor functionality. These docs are customized to your version of the API and display data, which only you can see.
https://api.grufity.com/
Grufity API collection
Grufity Developer API's collection contain various API's to fetch various metrics for a stock ticker or macro-economic data. This can be used to get both historical and latest metrics.
Step 1: Send requests
You can find you API key in your profile page.
Step 2: View responses
AUTHORIZATION API Key | |
---|---|
Key | X-API-KEY |
Value | <Please Replace this with your API Key> |
Stock API's
Collection of APIs to fetch Stock Metrics and Historical Stocks and Macro-Economic data.
AUTHORIZATION API Key |
---|
This folder is using API Key from collection Grufity API collection |
Get Latest Stock Metrics
https://api.grufity.com/stock/getallmetrics?ticker=AAPL
HEADERS | |
---|---|
X-API-KEY | <Please Replace this with your API Key> |
PARAMS | |
---|---|
ticker | AAPL |
1library(RCurl)
2headers = c(
3 "X-API-KEY" = "<Please Replace this with your API Key>"
4)
5res <- getURL("https://api.grufity.com/stock/getallmetrics?ticker=AAPL", .opts=list(httpheader = headers, followlocation = TRUE))
6cat(res)
{
"data": [
{
"code": "AAPL.PS",
"metrics": "P/S",
"value": 7.550273,
"date": "2023-06-16"
},
{
"code": "AAPL.PE",
"metrics": "P/E",
"value": 30.826351,
"date": "2023-06-16"
},
{
"code": "AAPL.MKTCAP",
"metrics": "Market Cap",
"value": 2907572237520,
"date": "2023-06-16"
},
{
"code": "AAPL.MKTEBT",
"metrics": "Mkt Cap / EBT",
"value": 26.023667,
"date": "2023-06-16"
},
{
"code": "AAPL.ROA",
"metrics": "ROA (%)",
"value": 27.446813,
"date": "2022-12-31"
},
{
"code": "AAPL.ROE",
"metrics": "ROE (%)",
"value": 167.770198,
"date": "2022-12-31"
},
{
"code": "AAPL.CR",
"metrics": "Curr. Ratio",
"value": 0.93802,
"date": "2022-12-31"
},
{
"code": "AAPL.TO.REC",
"metrics": "Rec. T/O",
"value": 16.315973,
"date": "2022-12-31"
},
{
"code": "AAPL.PER.AVGCOLL",
"metrics": "Avg. Coll. Days",
"value": 22.370716,
"date": "2022-12-31"
},
{
"code": "AAPL.DEBT.EQ",
"metrics": "Debt/Eq.",
"value": 2.145169,
"date": "2022-09-30"
},
{
"code": "AAPL.DEBT.RAT",
"metrics": "Debt %",
"value": 0.308146,
"date": "2022-09-30"
},
{
"code": "AAPL.INT.COV",
"metrics": "Int. Cov.",
"value": 34.026235,
"date": "2022-12-31"
},
{
"code": "AAPL.LTCAP",
"metrics": "LT Cap. Rat",
"value": 0.682052,
"date": "2022-09-30"
},
{
"code": "AAPL.ASS.SAL",
"metrics": "Assets/Sales",
"value": 0.894746,
"date": "2022-12-31"
},
{
"code": "AAPL.SAL.INV",
"metrics": "Sales/Invy.",
"value": 56.823607,
"date": "2022-12-31"
},
{
"code": "AAPL.INT.CFOPER",
"metrics": "Int./Cashflow",
"value": 34.700617,
"date": "2022-12-31"
},
{
"code": "AAPL.DEBT.CFOPER",
"metrics": "Debt/Cashflow",
"value": 1.123744,
"date": "2022-09-30"
},
{
"code": "AAPL.TO.ASSET",
"metrics": "Assets T/O",
"value": 1.117636,
"date": "2022-12-31"
},
{
"code": "AAPL.EBT.MGN",
"metrics": "EBT Mgn",
"value": 0.292837,
"date": "2022-12-31"
},
{
"code": "AAPL.PCF",
"metrics": "P/CF",
"value": 26.532817,
"date": "2023-06-16"
},
{
"code": "AAPL.REV.TTM",
"metrics": "Sales",
"value": 385095000000,
"date": "2023-03-31"
},
{
"code": "AAPL.REV.TTM",
"metrics": "Sales",
"value": 387537000000,
"date": "2022-12-31"
},
{
"code": "AAPL.NETINC.TTM",
"metrics": "Earnings(TTM)",
"value": 94321000000,
"date": "2023-03-31"
},
{
"code": "AAPL.NETINC.TTM",
"metrics": "Earnings(TTM)",
"value": 95171000000,
"date": "2022-12-31"
},
{
"code": "AAPL.PCHG|30",
"metrics": "1M %Chg",
"value": 0.0708,
"date": "2023-06-16"
},
{
"code": "AAPL.PCHG|180",
"metrics": "6M %Chg",
"value": 0.3748,
"date": "2023-06-16"
},
{
"code": "AAPL.PCHG|365",
"metrics": "1Y Return",
"value": 0.4261,
"date": "2023-06-16"
},
{
"code": "AAPL.RETURNS|1095",
"metrics": "3Y Cum. Return",
"value": 0.2874,
"date": "2023-06-16"
},
{
"code": "AAPL.RETURNS|1825",
"metrics": "5Y Cum. Return",
"value": 0.3252,
"date": "2023-06-16"
},
{
"code": "AAPL.RETURNS|3650",
"metrics": "10Y Cum. Return",
"value": 0.2999,
"date": "2023-06-16"
},
{
"code": "AAPL.EBT.TTM",
"metrics": "EBT (TTM)",
"value": 111728000000,
"date": "2023-03-31"
},
{
"code": "AAPL.EBT.TTM",
"metrics": "EBT (TTM)",
"value": 113485000000,
"date": "2022-12-31"
},
{
"code": "AAPL.ASSETS",
"metrics": "Assets",
"value": 332160000000,
"date": "2023-03-31"
},
{
"code": "AAPL.ASSETS",
"metrics": "Assets",
"value": 346747000000,
"date": "2022-12-31"
},
{
"code": "AAPL.LIABS",
"metrics": "Liabilities",
"value": 270002000000,
"date": "2023-03-31"
},
{
"code": "AAPL.LIABS",
"metrics": "Liabilities",
"value": 290020000000,
"date": "2022-12-31"
},
{
"code": "AAPL.SEQ",
"metrics": "Shareholders Equity",
"value": 62158000000,
"date": "2023-03-31"
},
{
"code": "AAPL.SEQ",
"metrics": "Shareholders Equity",
"value": 56727000000,
"date": "2022-12-31"
},
{
"code": "AAPL.DIV.PS.TTM",
"metrics": "Dividend/Share (TTM)",
"value": 0.92,
"date": "2023-03-31"
},
{
"code": "AAPL.DIV.PS.TTM",
"metrics": "Dividend/Share (TTM)",
"value": 0.91,
"date": "2022-12-31"
},
{
"code": "AAPL.CFOPER.TTM",
"metrics": "Cash From Oper. (TTM)",
"value": 109584000000,
"date": "2023-03-31"
},
{
"code": "AAPL.CFOPER.TTM",
"metrics": "Cash From Oper. (TTM)",
"value": 109190000000,
"date": "2022-12-31"
},
{
"code": "AAPL.CFFIN.TTM",
"metrics": "Cash From Fin. (TTM)",
"value": -115526000000,
"date": "2023-03-31"
},
{
"code": "AAPL.CFFIN.TTM",
"metrics": "Cash From Fin. (TTM)",
"value": -118153000000,
"date": "2022-12-31"
},
{
"code": "AAPL.CFINV.TTM",
"metrics": "Cash From Inv. (TTM)",
"value": 3891000000,
"date": "2023-03-31"
},
{
"code": "AAPL.CFINV.TTM",
"metrics": "Cash From Inv. (TTM)",
"value": -7693000000,
"date": "2022-12-31"
},
{
"code": "AAPL.VOL|Y",
"metrics": "Vol.",
"value": 0.236,
"date": "2023-12-31"
},
{
"code": "AAPL.DRAWDN.PROB20|5Y",
"metrics": "Prob. of 20% Loss",
"value": 60.77,
"date": "2023-06-16"
},
{
"code": "AAPL.DRAWDN.PROB30|5Y",
"metrics": "Prob. of 30% Loss",
"value": 16.92,
"date": "2023-06-16"
},
{
"code": "AAPL.DRAWDN.PROB40|5Y",
"metrics": "Prob. of 40% Loss",
"value": 0,
"date": "2023-06-16"
},
{
"code": "AAPL.REV.TTM|PCHG.1Y",
"metrics": "Rev %, 1Y",
"value": -0.23885,
"date": "2023-03-31"
},
{
"code": "AAPL.NETINC.TTM|PCHG.1Y",
"metrics": "Income %, 1Y",
"value": -7.469466,
"date": "2023-03-31"
},
{
"code": "AAPL.FCF",
"metrics": "FCF",
"value": 30218000000,
"date": "2022-12-31"
},
{
"code": "AAPL.FCF.TTM",
"metrics": "FCF (TTM)",
"value": 97498000000,
"date": "2022-12-31"
},
{
"code": "AAPL.FCF.PS.TTM",
"metrics": "FCF Per Share (TTM)",
"value": 6.154242,
"date": "2022-12-31"
},
{
"code": "AAPL.FCF.YIELD",
"metrics": "FCF Yield",
"value": 3.352969,
"date": "2023-06-16"
},
{
"code": "AAPL.EBITDA.TTM",
"metrics": "EBITDA",
"value": 128048000000,
"date": "2022-12-31"
},
{
"code": "AAPL.EV",
"metrics": "EV",
"value": 2882885237520,
"date": "2023-06-16"
},
{
"code": "AAPL.EV.EBITDA",
"metrics": "EV/EBITDA",
"value": 22.755249,
"date": "2023-06-16"
},
{
"code": "AAPL.EBIT.TTM",
"metrics": "EBITDA",
"value": 116725000000,
"date": "2022-12-31"
},
{
"code": "AAPL.PFCF",
"metrics": "Price / FCF",
"value": 29.824313,
"date": "2023-06-16"
},
{
"code": "AAPL.EBITDA.MGN",
"metrics": "EBITDA Margin",
"value": 0.330415,
"date": "2022-12-31"
},
{
"code": "AAPL.NETINC.MGN",
"metrics": "Earnings Margin(TTM)",
"value": 0.245579,
"date": "2022-12-31"
}
]
}
Get Historical Metrics Data
https://api.grufity.com/stock/gethistoricaldata?code=AAPL.REV.TTM
For example, For Apple Revenue code is AAPL.REV
Revenue (Trailing 12 Months), $ Change = REV.TTM|CHG Revenue (Trailing 12 Months), $ Change, 1 year = REV.TTM|CHG.1Y
Name | Abbreviation |
---|---|
Revenue | REV |
Net Income | NETINC |
Cost of Revenue | COSTREV |
Earnings Before Taxes | EBT |
Assets | ASSETS |
Liabilities | LIABS |
Shareholder's Equity | SEQ |
Cash and Cash Equivalents | CASHEQ |
Depreciation Amortization | DEPAMOR |
Long Term Debt | DEBT.LT |
Cashflow From Operations | CFOPER |
Cashflow From Financing Activities | CFFIN |
Cashflow From Investing Activities | CFINV |
Price to Sales | PS |
Price to Earnings | PE |
Return on Equity | ROE |
Return on Assets | ROA |
HEADERS | |
---|---|
X-API-KEY | <Please Replace this with your API Key> |
PARAMS | |
---|---|
code | AAPL.REV.TTM |
1library(RCurl)
2headers = c(
3 "X-API-KEY" = "<Please Replace this with your API Key>"
4)
5res <- getURL("https://api.grufity.com/stock/gethistoricaldata?code=AAPL.REV.TTM", .opts=list(httpheader = headers, followlocation = TRUE))
6cat(res)
{
"data": [
{
"date": "2023-03-31",
"value": 385095000000
},
{
"date": "2022-12-31",
"value": 387537000000
},
{
"date": "2022-09-30",
"value": 394328000000
},
{
"date": "2022-06-30",
"value": 387542000000
},
{
"date": "2022-03-31",
"value": 386017000000
},
{
"date": "2021-12-31",
"value": 378323000000
},
{
"date": "2021-09-30",
"value": 365817000000
},
{
"date": "2021-06-30",
"value": 347155000000
},
{
"date": "2021-03-31",
"value": 325406000000
},
{
"date": "2020-12-31",
"value": 294135000000
},
{
"date": "2020-09-30",
"value": 274515000000
},
{
"date": "2020-06-30",
"value": 273857000000
},
{
"date": "2020-03-31",
"value": 267981000000
},
{
"date": "2019-12-31",
"value": 267683000000
},
{
"date": "2019-09-30",
"value": 260174000000
},
{
"date": "2019-06-30",
"value": 259034000000
},
{
"date": "2019-03-31",
"value": 258490000000
},
{
"date": "2018-12-31",
"value": 261612000000
},
{
"date": "2018-09-30",
"value": 265595000000
},
{
"date": "2018-06-30",
"value": 255274000000
},
{
"date": "2018-03-31",
"value": 247417000000
},
{
"date": "2017-12-31",
"value": 239176000000
},
{
"date": "2017-09-30",
"value": 229234000000
},
{
"date": "2017-06-30",
"value": 223507000000
},
{
"date": "2017-03-31",
"value": 220457000000
},
{
"date": "2016-12-31",
"value": 218118000000
},
{
"date": "2016-09-30",
"value": 215639000000
},
{
"date": "2016-06-30",
"value": 220288000000
},
{
"date": "2016-03-31",
"value": 227535000000
},
{
"date": "2015-12-31",
"value": 234988000000
},
{
"date": "2015-09-30",
"value": 233715000000
},
{
"date": "2015-06-30",
"value": 224337000000
},
{
"date": "2015-03-31",
"value": 212164000000
},
{
"date": "2014-12-31",
"value": 199800000000
},
{
"date": "2014-09-30",
"value": 182795000000
},
{
"date": "2014-06-30",
"value": 178144000000
},
{
"date": "2014-03-31",
"value": 176035000000
},
{
"date": "2013-12-31",
"value": 173992000000
},
{
"date": "2013-09-30",
"value": 170910000000
},
{
"date": "2013-06-30",
"value": 169404000000
},
{
"date": "2013-03-31",
"value": 169104000000
},
{
"date": "2012-12-31",
"value": 164687000000
},
{
"date": "2012-09-30",
"value": 156508000000
},
{
"date": "2012-06-30",
"value": 148812000000
},
{
"date": "2012-03-31",
"value": 142360000000
},
{
"date": "2011-12-31",
"value": 127841000000
},
{
"date": "2011-09-30",
"value": 108249000000
},
{
"date": "2011-06-30",
"value": 100322000000
},
{
"date": "2011-03-31",
"value": 87451000000
},
{
"date": "2010-12-31",
"value": 76283000000
},
{
"date": "2010-09-30",
"value": 65225000000
},
{
"date": "2010-06-30",
"value": 57089000000
},
{
"date": "2010-03-31",
"value": 51123000000
},
{
"date": "2009-12-31",
"value": 46708000000
},
{
"date": "2009-09-30",
"value": 42905000000
},
{
"date": "2009-06-30",
"value": 43605000000
},
{
"date": "2009-03-31",
"value": 41335000000
},
{
"date": "2008-12-31",
"value": 43001333333.3333
},
{
"date": "2008-09-30",
"value": 37491000000
},
{
"date": "2008-06-30",
"value": 29856000000
},
{
"date": "2007-09-30",
"value": 24578000000
}
]
}
Health Check
The
Support: contact@grufity.com
(For any specific issues feel free to write to us)
Twitter: @grufity (https://twitter.com/grufity)
Grufity API Health Check
https://api.grufity.com/health
1library(RCurl)
2res <- getURL("https://api.grufity.com/health", .opts=list(followlocation = TRUE))
3cat(res)
{
"message": "Grufity API Service is healthy"
}