> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GetSiteDataUsage # Package: operations # Namespace: SiteDataUsageService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/cms/operations/site-data-usage/get-site-data-usage.md ## Permission Scopes: SCOPE.DC-DATA.SITE_DATA_USAGE_READ: SCOPE.DC-DATA.SITE_DATA_USAGE_READ ## Introduction Retrieves the current data usage and resource limits for a site. By default, returns cached values. Set `consistentRead` to `true` to retrieve real-time values. > **Note:** that using `consistentRead` results in a slower response and should only be used when near real-time accuracy is needed. For example, just before enforcing a resource limit. --- ## REST API ### Schema ``` Method: getSiteDataUsage Description: Retrieves the current data usage and resource limits for a site. By default, returns cached values. Set `consistentRead` to `true` to retrieve real-time values. > **Note:** that using `consistentRead` results in a slower response and should only be used when near real-time accuracy is needed. For example, just before enforcing a resource limit. URL: https://www.wixapis.com/wix-data/v1/site-data-usage Method: GET Method parameters: query param name: consistentRead | type: consistentRead | description: Whether to return real-time values instead of cached values. Setting this to `true` results in a slower response. Use only when near real-time accuracy is critical, such as just before enforcing a resource limit. Default: `false` query param name: fields | type: array | description: Fields to return in the response. If not provided, all fields are returned. Supported properties: `storageLimitInBytes`, `itemCountLimit`, `collectionCountLimit`, `collectionCount`, `totalUsedLive`, `totalUsedSandbox`, `dataCollectionUsages` Return type: GetSiteDataUsageResponse - name: siteDataUsage | type: SiteDataUsage | description: Retrieved site data usage. - name: storageLimitInBytes | type: string | description: Maximum storage allowed for all native collections combined, in bytes. Storage usage is shared between the live and sandbox environments. For example, with a limit of 1 GB, the live environment could use 700 MB and the sandbox 300 MB before the limit is reached. When this limit is reached, writes to collections fail. - name: itemCountLimit | type: string | description: Maximum number of data items allowed per environment. This limit applies separately to the live and sandbox environments. For example, with a limit of 1,000, both the live and sandbox environments can each contain 1,000 items independently. When this limit is reached in an environment, writes to collections in that environment fail. - name: collectionCountLimit | type: integer | description: Maximum number of native data collections allowed. - name: collectionCount | type: integer | description: Total number of native data collections. - name: totalUsedLive | type: Usage | description: Storage and item usage across all native collections in the live environment. - name: bytes | type: string | description: Storage used, in bytes. - name: items | type: string | description: Number of data items. - name: totalUsedSandbox | type: Usage | description: Storage and item usage across all native collections in the sandbox environment. - name: dataCollectionUsages | type: array | description: Storage and item usage per native data collection. - name: dataCollectionId | type: string | description: Data collection GUID. - name: displayName | type: string | description: Data collection display name. - name: dataCollectionType | type: CollectionType | description: Data collection type. Currently, only native collections are returned. - enum: - NATIVE: User-created collection. - WIX_APP: [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). - BLOCKS_APP: Collection created by a Wix Blocks app. - EXTERNAL: Collection located in externally connected storage. - name: totalUsedLive | type: Usage | description: Storage and item usage in the live environment. - name: totalUsedSandbox | type: Usage | description: Storage and item usage in the sandbox environment. ``` ### Examples ### Get site data usage ```curl curl -X GET 'https://wixapis.com/wix-data/v1/site-data-usage' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` ### Get only collection count and data usage per collection ```curl curl -X GET 'https://wixapis.com/wix-data/v1/site-data-usage?fields=dataCollectionUsages&fields=collectionCount' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.operations.SiteDataUsageService.getSiteDataUsage(options) Description: Retrieves the current data usage and resource limits for a site. By default, returns cached values. Set `consistentRead` to `true` to retrieve real-time values. > **Note:** that using `consistentRead` results in a slower response and should only be used when near real-time accuracy is needed. For example, just before enforcing a resource limit. Method parameters: param name: options | type: GetSiteDataUsageOptions none - name: fields | type: array | description: Fields to return in the response. If not provided, all fields are returned. Supported properties: `storageLimitInBytes`, `itemCountLimit`, `collectionCountLimit`, `collectionCount`, `totalUsedLive`, `totalUsedSandbox`, `dataCollectionUsages` - name: consistentRead | type: boolean | description: Whether to return real-time values instead of cached values. Setting this to `true` results in a slower response. Use only when near real-time accuracy is critical, such as just before enforcing a resource limit. Default: `false` Return type: PROMISE - name: siteDataUsage | type: SiteDataUsage | description: Retrieved site data usage. - name: storageLimitInBytes | type: string | description: Maximum storage allowed for all native collections combined, in bytes. Storage usage is shared between the live and sandbox environments. For example, with a limit of 1 GB, the live environment could use 700 MB and the sandbox 300 MB before the limit is reached. When this limit is reached, writes to collections fail. - name: itemCountLimit | type: string | description: Maximum number of data items allowed per environment. This limit applies separately to the live and sandbox environments. For example, with a limit of 1,000, both the live and sandbox environments can each contain 1,000 items independently. When this limit is reached in an environment, writes to collections in that environment fail. - name: collectionCountLimit | type: integer | description: Maximum number of native data collections allowed. - name: collectionCount | type: integer | description: Total number of native data collections. - name: totalUsedLive | type: Usage | description: Storage and item usage across all native collections in the live environment. - name: bytes | type: string | description: Storage used, in bytes. - name: items | type: string | description: Number of data items. - name: totalUsedSandbox | type: Usage | description: Storage and item usage across all native collections in the sandbox environment. - name: dataCollectionUsages | type: array | description: Storage and item usage per native data collection. - name: dataCollectionId | type: string | description: Data collection GUID. - name: displayName | type: string | description: Data collection display name. - name: dataCollectionType | type: CollectionType | description: Data collection type. Currently, only native collections are returned. - enum: - NATIVE: User-created collection. - WIX_APP: [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). - BLOCKS_APP: Collection created by a Wix Blocks app. - EXTERNAL: Collection located in externally connected storage. - name: totalUsedLive | type: Usage | description: Storage and item usage in the live environment. - name: totalUsedSandbox | type: Usage | description: Storage and item usage in the sandbox environment. ``` ### Examples ### getSiteDataUsage ```javascript import { data } from '@wix/data-site-usage-service'; async function getSiteDataUsage(options) { const response = await data.getSiteDataUsage(options); }; ``` ### getSiteDataUsage (with elevated permissions) ```javascript import { data } from '@wix/data-site-usage-service'; import { auth } from '@wix/essentials'; async function myGetSiteDataUsageMethod(options) { const elevatedGetSiteDataUsage = auth.elevate(data.getSiteDataUsage); const response = await elevatedGetSiteDataUsage(options); } ``` ### getSiteDataUsage (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { data } from '@wix/data-site-usage-service'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { data }, // Include the auth strategy and host as relevant }); async function getSiteDataUsage(options) { const response = await myWixClient.data.getSiteDataUsage(options); }; ``` ---