{"id":12990,"library":"configcat-publicapi-node-client","title":"ConfigCat Public API Node.js Client","description":"The `configcat-publicapi-node-client` is a Node.js client library designed for programmatic interaction with the ConfigCat Public Management API. Unlike ConfigCat SDKs which are used for evaluating feature flags, this client enables comprehensive Create, Read, Update, and Delete (CRUD) operations on entities such as Feature Flags, Configurations, Environments, and Products within the ConfigCat platform. It is a Swagger-generated client, currently at stable version 3.2.1, and receives frequent updates, often driven by security enhancements and regenerations based on the latest Public Management API models and endpoints. This frequent release cycle ensures compatibility with the evolving ConfigCat API and incorporates important security patches.","status":"active","version":"3.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/configcat/configcat-publicapi-node-client","tags":["javascript","typescript"],"install":[{"cmd":"npm install configcat-publicapi-node-client","lang":"bash","label":"npm"},{"cmd":"yarn add configcat-publicapi-node-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add configcat-publicapi-node-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primary client class for interacting with the ConfigCat Public API. ESM import is preferred.","wrong":"const ConfigCatPublicApi = require('configcat-publicapi-node-client').ConfigCatPublicApi;","symbol":"ConfigCatPublicApi","correct":"import { ConfigCatPublicApi } from 'configcat-publicapi-node-client';"},{"note":"Used to provide client configuration, including API credentials and base path.","wrong":"import { Config } from 'configcat-publicapi-node-client'; // Incorrect class name","symbol":"Configuration","correct":"import { Configuration } from 'configcat-publicapi-node-client';"},{"note":"Example of a type definition (DTO) for API responses or request bodies, typically used with TypeScript.","symbol":"ProductModel","correct":"import { ProductModel } from 'configcat-publicapi-node-client';"}],"quickstart":{"code":"import { ConfigCatPublicApi, Configuration } from 'configcat-publicapi-node-client';\n\nconst CONFIGCAT_API_USERNAME = process.env.CONFIGCAT_API_USERNAME ?? '';\nconst CONFIGCAT_API_PASSWORD = process.env.CONFIGCAT_API_PASSWORD ?? '';\nconst CONFIGCAT_BASE_URL = 'https://api.configcat.com';\n\nif (!CONFIGCAT_API_USERNAME || !CONFIGCAT_API_PASSWORD) {\n  console.error('Environment variables CONFIGCAT_API_USERNAME and CONFIGCAT_API_PASSWORD must be set.');\n  process.exit(1);\n}\n\nasync function listProducts() {\n  try {\n    const config = new Configuration({\n      username: CONFIGCAT_API_USERNAME,\n      password: CONFIGCAT_API_PASSWORD,\n      basePath: CONFIGCAT_BASE_URL\n    });\n\n    const publicApi = new ConfigCatPublicApi(config);\n\n    console.log('Fetching products from ConfigCat Public API...');\n    const products = await publicApi.products.getProducts();\n\n    if (products.length > 0) {\n      console.log(`Successfully fetched ${products.length} products.`);\n      products.forEach(product => {\n        console.log(`- Product ID: ${product.productId}, Name: ${product.name}`);\n      });\n    } else {\n      console.log('No products found.');\n    }\n  } catch (error) {\n    if (error instanceof Error) {\n      console.error('Error fetching products:', error.message);\n      if (error.message.includes('401')) {\n        console.error('Please check your API credentials (username/password) and ensure they are correct.');\n      }\n    } else {\n      console.error('An unknown error occurred:', error);\n    }\n  }\n}\n\nlistProducts();","lang":"typescript","description":"Initializes the ConfigCat Public API client with Basic Authentication and lists all available products. Requires `CONFIGCAT_API_USERNAME` and `CONFIGCAT_API_PASSWORD` environment variables."},"warnings":[{"fix":"Review the specific release notes for the version you are upgrading to. Update client instantiation, method calls, and data models in your code to align with the new API structure.","message":"Multiple v3.x.x releases (e.g., v3.2.0, v3.1.1, v3.1.0, v3.0.0) include changes due to 'regenerated the client based on the latest Public Management API models and endpoints'. These regenerations can introduce breaking changes to method signatures, request/response DTOs, or available endpoints. Users should review release notes carefully when upgrading between minor versions of v3 to avoid unexpected runtime errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Regularly run `npm update configcat-publicapi-node-client` and integrate updates into your CI/CD pipeline to maintain a secure environment.","message":"The client receives frequent security updates. While not always breaking, it's crucial to regularly update the package to the latest version to ensure your application benefits from critical security patches and vulnerability fixes. Neglecting updates can expose your application to known security risks.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure you are using the correct ConfigCat package for your use case: `configcat-publicapi-node-client` for management, and `@configcat/sdk/node` for feature flag evaluation.","message":"This package is the *Public Management API client* for programmatic control of ConfigCat resources (e.g., feature flags). It is distinct from the *ConfigCat SDKs* (like `@configcat/sdk/node` or the legacy `configcat-node`), which are used for *evaluating* feature flags within your application. Do not confuse their purposes or attempt to use this client for feature flag evaluation, as it is explicitly designed for management operations.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Verify that the `username` and `password` provided to the `Configuration` object are correct Public API credentials, not SDK keys. Ensure they are properly loaded from environment variables or a secure configuration.","cause":"Invalid or missing Public API credentials (username and/or password).","error":"Error: Request failed with status code 401"},{"fix":"Check the `basePath` in your `Configuration` object. Confirm that the IDs or keys used in your API calls (`productId`, `configId`, `featureFlagKey`, etc.) actually exist within your ConfigCat account.","cause":"The requested API endpoint or resource (e.g., a specific product ID, feature flag ID) was not found.","error":"Error: Request failed with status code 404"},{"fix":"Ensure the `ConfigCatPublicApi` is properly instantiated with a `Configuration` object. If upgrading, refer to the release notes for any API model changes that might have renamed or reorganized methods (e.g., `api.products.getProducts()` might have become `api.productOperations.list()`).","cause":"The `ConfigCatPublicApi` client was not initialized correctly, or the API structure has changed after a client regeneration, leading to a non-existent method call.","error":"TypeError: Cannot read properties of undefined (reading 'getProducts')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}