Why Google Solutions Products Pricing Getting started Docs Support
Docs Support


Google Cloud Platform logo

Google Cloud Asset Inventory: Node.js Client

release level npm version codecov

Cloud Asset Inventory is a storage service that keeps a five week history of Google Cloud Platform (GCP) asset metadata. It allows you to export all asset metadata at a certain timestamp or timeframe.

Using the client library

  1. Select or create a Cloud Platform project.

  2. Enable billing for your project.

  3. Enable the Google Cloud Asset Inventory API.

  4. Set up authentication with a service account so you can access the API from your local workstation.

  5. Install the client library:

     npm install --save @google-cloud/asset
  6. Try an example:

  const asset = require('@google-cloud/asset');
  const client = new asset.v1beta1.AssetServiceClient({
    // optional auth parameters.

  // Your Google Cloud Platform project ID
  const projectId = await client.getProjectId();
  const projectResource = client.projectPath(projectId);

  // var dumpFilePath = 'Dump file path, e.g.: gs://<my_bucket>/<my_asset_file>'
  const outputConfig = {
    gcsDestination: {
      uri: dumpFilePath,
  const request = {
    parent: projectResource,
    outputConfig: outputConfig,

  // Handle the operation using the promise pattern.
  const [operation] = await client.exportAssets(request);
  // Operation#promise starts polling for the completion of the operation.
  const [result] = await operation.promise();
  // Do things with with the response.

The Cloud Asset Node.js Client API Reference documentation also contains samples.


This library follows Semantic Versioning.

This library is considered to be in alpha. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time.

More Information: Google Cloud Platform Launch Stages


Contributions welcome! See the Contributing Guide.


Apache Version 2.0


What's Next

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.