StocksFundsScreenerSectorsWatchlists
  • API Reference
    • Overview
  • Grufity API collection
  • Stock API's
  • Health Check

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.

BASE URL
https://api.grufity.com/
CLIENT LIBRARIES
Select your preferred language.

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

RESTful APIs allow you to perform GET operations using the GET HTTP method.
This collection contains request for various sample data. Open each request, put your API key in header and click "Send" to fetch the result.

You can find you API key in your profile page.

Step 2: View responses

Observe the response tab for status code (
200 OK
), response time, and size.
AUTHORIZATION  API Key
KeyX-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.

Support: contact@grufity.com
(For any specific issues feel free to write to us)
Twitter: @grufity (https://twitter.com/grufity)
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
This GET request is used to "get" latest metrics data for a ticker. Use query parameters to specify the ticker you want data on (e.g., in this request, we have 
ticker=AAPL
).
A successful GET response will have a 
200 OK
 status, and will include JSON data with latest stock metrics for the specified stock. Along with value each metrics will have record date, abbreviated name and code. The code can be further used in Get Historical Metrics Data API to fetch historical data for a particular metrics.
HEADERS
X-API-KEY<Please Replace this with your API Key>
PARAMS
tickerAAPL
GET  REQUEST

r
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)
RESPONSE
200 OK
JSON
{
  "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
This GET request is used to "get" historical data for a single metrics of a ticker. Use query parameters to specify the metrics code you want data on (e.g., in this request, we have  
code=AAPL.REV.TTM
). The code is same as what you fetch using Get Latest Stock Metrics API.
A successful GET response will have a  
200 OK
  status, and will include JSON data with historical stock metrics data for the specified stock metrics. Along with value each metrics will have record date.
How series codes are built?
Seriescodes are generally go general to specific for stocks with standard abbreviations separated by dot.
For example, For Apple Revenue code is AAPL.REV
First is ticker: AAPL
Second is REV for Revenue
Third (optional) you can have TTM for Trailing Twelve Month
Combined: AAPL.REV.TTM (Apple's 12 month trailing Revenue)
Additionally, for a calculation type a "|".
So, for 1-year Percent Change on Apple Revenue you add |PCHG.1Y= AAPL.REV.TTM|PCHG.1Y
Typical Seriescode Buildup
Revenue = REV Revenue (Trailing 12 Months) = REV.TTM Revenue (Trailing 12 Months), Percent Change = REV.TTM|PCHG Revenue (Trailing 12 Months), Percent Change, 1 year = REV.TTM|PCHG.1Y

Revenue (Trailing 12 Months), $ Change = REV.TTM|CHG Revenue (Trailing 12 Months), $ Change, 1 year = REV.TTM|CHG.1Y
Various Common Series Abbreviations
Name Abbreviation
RevenueREV
Net IncomeNETINC
Cost of RevenueCOSTREV
Earnings Before TaxesEBT
AssetsASSETS
LiabilitiesLIABS
Shareholder's EquitySEQ
Cash and Cash EquivalentsCASHEQ
Depreciation AmortizationDEPAMOR
Long Term DebtDEBT.LT
Cashflow From OperationsCFOPER
Cashflow From Financing ActivitiesCFFIN
Cashflow From Investing ActivitiesCFINV
Price to SalesPS
Price to EarningsPE
Return on EquityROE
Return on AssetsROA
HEADERS
X-API-KEY<Please Replace this with your API Key>
PARAMS
codeAAPL.REV.TTM
GET  REQUEST

r
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)
RESPONSE
200 OK
JSON
{
  "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  

/health
  endpoints let you check overall health of Grufity API Server.

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
To check overall health of Grufity API's. If server is up it should return a success message.
GET  REQUEST

r
1library(RCurl)
2res <- getURL("https://api.grufity.com/health", .opts=list(followlocation = TRUE))
3cat(res)
RESPONSE
200 OK
JSON
{
  "message": "Grufity API Service is healthy"
}