Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

February 1st 2023: Disable Totals

What is Disable Totals?

Deprecating Feature

For any API that has disable_totals as an input parameter and total as an output responses, this feature will be deprecated soon. For announcements, please subscribe to the Changelog page.

disable_totals is an optional input parameter that allows you to control whether the total field returned with your Moralis API responses. By default, disable_totals is set to true if not specified, which will result in the total having a null value. Therefore, if you need to have the total field in your responses, make sure to set disable_totals as false within each of your API calls.

Use Cases

Disable Totals feature is created to improve query speed performance on Moralis API by 10x. This is possible because disabling the calculation of totals will save Moralis a huge amount of computing resources and thus results in faster response times.

However, if you need total field within your application, then Disable Totals feature might be irrelevant for you and you should instead set the disable_totals value to false to disable it.

Disable Totals with Moralis API

To enable Disable Totals feature, you can simply set the disable_totals value to true to the options object when calling Moralis.

The following example shows how you can implement disable totals using the Moralis SDKs.

const Moralis = require("moralis").default;

try {
const address = "0x26fcbd3afebbe28d0a8684f790c48368d21665b5";

const chain = "eth";

const disableTotal = true;

await Moralis.start({
apiKey: "YOUR_API_KEY",
// ...and any other configuration
});

const response = await Moralis.EvmApi.nft.getWalletNFTs({
address,
chain,
disableTotal,
});

console.log(response?.result);
} catch (e) {
console.error(e);
}