# cPanel API 2 Functions - StatsBar::stat Warning: The cPanel API 2 system is deprecated. We **strongly** recommend that you use [UAPI](/cpanel/introduction) instead of cPanel API 2. ## Description This function retrieves an account's statistics. Warning: We **strongly** recommend that you use the following [UAPI](/cpanel/introduction/) function instead of this function: - [`StatsBar::get_stats`](/openapi/cpanel/operation/get_stats/) — This function retrieves a cPanel account's statistics. ## Examples WHM API (JSON) ```undefined syntaxhighlighter-pre https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=StatsBar&cpanel_jsonapi_func=stat&display=ftpaccounts%7Cperlversion%7Cdedicatedip&warnings=0&warninglevel=high&warnout=0&infinityimg=/home/example/infinity.png&infinitylang="infinity"&rowcounter=even ``` Note: For more information, read our [Calls from the WHM API](/whm/use-whm-api-to-call-cpanel-api-and-uapi) documentation. LiveAPI PHP Class ```undefined syntaxhighlighter-pre $cpanel = new CPANEL(); // Connect to cPanel - only do this once. // Display stats bar data for ftpaccounts|perlversion|dedicatedip $stats_bar = $cpanel->api2( 'StatsBar', 'stat', array( 'display' => 'ftpaccounts|perlversion|dedicatedip', 'warnings' => '0', 'warninglevel => 'high' 'warnout' => '0' 'infinityimg' => '/home/example/infinity.png' 'infinitylang' => 'infinity' 'rowcounter' => 'even' ) ); ``` Note: For more information, read our [Guide to the LiveAPI System](/guides/guide-to-the-liveapi-system/#guide-to-the-liveapi-system). LiveAPI Perl Module ```undefined syntaxhighlighter-pre my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once. # Display stats bar data for ftpaccounts|perlversion|dedicatedip my $stats_bar = $cpliveapi->api2( 'StatsBar', 'stat', { 'display' => 'ftpaccounts|perlversion|dedicatedip', 'warnings' => '0', 'warninglevel => 'high' 'warnout' => '0' 'infinityimg' => '/home/example/infinity.png' 'infinitylang' => 'infinity' 'rowcounter' => 'even' } ); ``` Note: For more information, read our [Guide to the LiveAPI System](/guides/guide-to-the-liveapi-system/#guide-to-the-liveapi-system). cPanel Tag System (deprecated) Warnings: - cPanel tags are **deprecated**. We **strongly** recommend that you **only** use the [LiveAPI](/guides/guide-to-the-liveapi-system) system to call the cPanel APIs. Examples are **only** present in order to help developers move from the old cPanel tag system to our [LiveAPI](/guides/guide-to-the-liveapi-system). - cPanel API 2 calls that use cPanel tags vary in code syntax and in their output. - For more information, read our [Deprecated cPanel Tag Usage](/cpanel-api-2/cpanel-api-2-deprecate-cpanel-tag-usage/) documentation. Command Line ```undefined syntaxhighlighter-pre cpapi2 --user=username StatsBar stat display=ftpaccounts%7Cperlversio%5C%7Cdedicatedip warnings=0 warninglevel=high warnout=0 infinityimg=\/home\/example\/infinity.png infinitylang=infinity rowcounter=even ``` div Notes: - You **must** URI-encode values. - `username` represents your account-level username. - You **must** include the `--user=username` option. - For more information and additional output options, read our [Guide to cPanel API 2](/cpanel-api-2/) documentation or run the `cpapi2 --help` command. - If you run CloudLinux™, you **must** use the full path of the `cpapi2` command: ```undefined syntaxhighlighter-pre /usr/local/cpanel/bin/cpapi2 ``` br Output (JSON) ```undefined syntaxhighlighter-pre { "cpanelresult": { "apiversion": 2, "func": "stat", "data": [ { "zeroisunlimited": 0, "percent": 0, "percent10": 0, "max": "unlimited", "item": "FTP Accounts", "feature": "ftpaccts", "percent5": 0, "id": "ftpaccounts", "phrase": "FTP Accounts", "module": "API::Ftp", "count": "3", "_count": "3", "name": "ftpaccounts", "_max": "unlimited", "percent20": 0, "_maxed": 0 }, { "count": null, "value": "5.10.1", "percent": 0, "percent10": 0, "max": "", "item": "Perl Version", "name": "perlversion", "percent20": 0, "percent5": 0, "_maxed": 0, "id": "perlversion", "phrase": "Perl Version", "module": "Serverinfo" }, { "count": null, "value": "10.215.214.95", "percent": 0, "percent10": 0, "max": "", "item": "Dedicated IP Address", "name": "dedicatedip", "percent20": 0, "percent5": 0, "_maxed": 0, "id": "dedicatedip", "phrase": "Dedicated IP Address", "condition": 1 } ], "event": { "result": 1 }, "module": "StatsBar" } } ``` Note: Use cPanel's *[API Shell](https://docs.cpanel.net/cpanel/advanced/api-shell-for-cpanel)* interface (*cPanel >> Home >> Advanced >> API Shell*) to directly test cPanel API calls. ## Parameters table colgroup col col col col col thead tr th Parameter th Type th Description th Possible values th Example tbody tr td code display td em string td p strong Required p A list of the account's statistics. td div div div div ul li code ftpaccounts — Information about the account's FTP accounts. li code perlversion — The server's Perl version. li code dedicatedip — cPanel account websites that use dedicated IP addresses. li code hostname — The server's hostname. li code operatingsystem — The server's operating system li code sendmailpath — The path to the system's sendmail binary. li code autoresponders — Information about the cPanel account's auto-responders. li code perlpath — The Perl binary's absolute code oath. li code emailforwarders — Information about the cPanel account's forwarders. li code bandwidthusage — Information about the account's bandwidth usage. li code emailfilters — Information the cPanel account's email filters. li code mailinglists — Information the cPanel account's mailing lists. li code diskusage — Information the account's disk space usage. li code phpversion — The server's PHP version. li code sqldatabases — Information about the account's SQL databases. li code apacheversion — The server's Apache version. li code kernelversion — The operating system's kernel version. li code shorthostname — The short version of your server's hostname. li code parkeddomains — Information about the cPanel account's parked domains (aliases). li code cpanelbuild — The server's cPanel build. li code theme — The cPanel account's theme. li code addondomains — Information about the cPanel account's addon domains. li code cpanelrevision — The build of cPanel that runs on the server. li code machinetype — The type of operating system your server runs. li code cpanelversion — The server's cPanel version. li code mysqldiskusage — The amount of disk space that the cPanel account's MySQL® databases use. li code mysqlversion — The server's MySQL version. li code subdomains — Information about the cPanel account's subdomains. li code postgresdiskusage — The amount of disk space that the cPanel account's PostgreSQL databases use. li code sharedip — Any of the cPanel account's websites that use a shared IP address. li code hostingpackage — The cPanel account's hosting package. li code emailaccounts — Information about the cPanel account's email accounts. p Separate each value with a pipe character ( code | ). td code ftpaccounts|perlversion|dedicatedip tr td code warnings td em Boolean td p strong Required p Whether to return all results. strong br td ul li code 1 — Return only warnings that exceed the code warninglevel parameter's value. li code 0 — Return all results. td code 0 tr td code warninglevel td em integer td p strong Required p The minimum level at which to return warnings. td A positive integer. td code 87 tr td code warnout td em Boolean td p strong Required p Whether to display results with a value of code 100% . td ul li code 1 — Display results with a value of code 100% li code 0 — Hide results with a value of code 100% td code 0 tr td p code infinityimg td em string td p strong Required p The full file path to an alternative infinity symbol. td An absolute file path to an image file. td code /home/example/infinity.png tr td code infinitylang td em string td p strong Required p A phrase represent infinity that the locales system can use. td A string value. td code infinity tr td code rowcounter td em string td p strong Required p The type of row. td ul li code odd li code even td code even ## Returns table colgroup col col col col col thead tr th Return th Type th Description th Possible vales th Example tbody tr td code zeroisunlimited td em Boolean td Whether a value of code 0 means unlimited or zero. td ul li code 1 — Unlimited. li code 0 — Zero. td code 1 tr td code percent10 td em integer td The percentage of value. td div p A positive integer. p Round to the nearest ten if applicable. td code 0 tr td code percent td em integer td The percentage of value, if applicable. td An integer value. td code 0 tr td code item td em string td A human-readable version of the queried item. td A string value. td code Disk Space Usage tr td code max td em string td The queried value's limit. td A string value. td code unlimited tr td code langkey td em string td The value's display locale. td A string value. td code INDXDiskUsage tr td code percent5 td em integer td The percentage of value. td div p An integer value. p span Round to the nearest five if applicable. td code 0 tr td code id td em string td The display key. td A string value. td code diskusage tr td code module td em string td The module that retrieved the information. td A string value. td code Quota tr td code count td em string td The queried data's value. td A string value. td code 0.77 tr td code _count td em string td The queried data's value. td A string value. td code 0.77 tr td code name td em string td The display key. td A string value. td code diskusage tr td code _max td em string td The queried parameter's limit. td A string value. td code unlimited tr td code normalized td em Boolean td Whether the function normalized the output values. td ul li code 1 — Normalized. li code 0 — Did strong not normalize. td code 1 tr td code _percent20 td em integer td The percentage of value. td div p An integer value. p span Round to the nearest twenty if applicable. td code 0 tr td code _maxed td em Boolean td Whether the values reached their maximum value. td ul li code 1 — Reached maximum value. li code 0 — Has strong not reached maximum value. td code 0 tr td code units td em string td The queried value's unit of measure. td A string value. td code MB