{"id":16046,"library":"grexx-api","title":"Grexx Platform API TypeScript Client","description":"The `grexx-api` package provides a strongly-typed TypeScript client for interacting with the Grexx Platform API, which is generated from an OpenAPI 3.0.2 specification. It enables developers to manage various Grexx platform entities such as cases, datasets, forms, and tasks programmatically. This client abstracts the HTTP request details, offering a more intuitive and type-safe interface for API operations. As of version 13.6.2, it is actively maintained, with new releases typically aligning with updates to the underlying Grexx Platform API or improvements in the OpenAPI generator itself. Its primary differentiator is the full TypeScript support, ensuring compile-time safety and a better development experience compared to direct HTTP requests.","status":"active","version":"13.6.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install grexx-api","lang":"bash","label":"npm"},{"cmd":"yarn add grexx-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add grexx-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Used for global client configuration like base URL and authentication tokens. Primarily designed for ESM imports.","wrong":"const OpenAPI = require('grexx-api').OpenAPI;","symbol":"OpenAPI","correct":"import { OpenAPI } from 'grexx-api';"},{"note":"Imports the service client for Case-related API endpoints. Each major API entity typically has its own service export.","wrong":"const CaseService = require('grexx-api').CaseService;","symbol":"CaseService","correct":"import { CaseService } from 'grexx-api';"},{"note":"For importing TypeScript types/interfaces like `CaseInfo` which represent API response structures. Use `import type` for clarity and bundler optimization.","wrong":"import { CaseInfo } from 'grexx-api';","symbol":"CaseInfo","correct":"import type { CaseInfo } from 'grexx-api';"}],"quickstart":{"code":"import { OpenAPI, CaseService } from 'grexx-api';\n\n// Configure the API client with your base URL and API key\nOpenAPI.BASE = process.env.GREXX_API_BASE_URL ?? 'https://name.grexx.today/api/v1';\nOpenAPI.TOKEN = process.env.GREXX_API_KEY ?? 'your-api-key'; // Replace with a secure way to load your API key\n\nconst casePath = 'example-case-id'; // Replace with a valid case ID from your Grexx platform\n\nCaseService.caseInfo(casePath, { css: true, rootline: false })\n  .then(response => {\n    console.log('Successfully fetched Case Info:');\n    console.log(`Case ID: ${response.id}`);\n    console.log(`Case Title: ${response.title}`);\n  })\n  .catch(error => {\n    console.error('Error fetching case info:', error.message || error);\n    if (error.status) {\n      console.error(`Status: ${error.status}, Body: ${JSON.stringify(error.body)}`);\n    }\n  });","lang":"typescript","description":"Demonstrates initializing the Grexx API client and retrieving information for a specific case using the `CaseService`."},"warnings":[{"fix":"Always review the release notes or changelog for specific breaking changes when upgrading major versions. Regenerate or update client code if you are using a custom OpenAPI generator, and adapt your application code to the new API contract.","message":"Major version updates (e.g., v12 to v13) typically introduce breaking changes, which directly correspond to significant updates or refactorings in the underlying Grexx Platform API's OpenAPI specification. These changes may include altered endpoint paths, renamed parameters, different response body structures, or changes in required authentication schemes.","severity":"breaking","affected_versions":">=12.0"},{"fix":"For multi-tenant or multi-user applications, consider wrapping API calls within a function or class that accepts configuration parameters specific to each request or user, or ensure that global settings are managed carefully with proper isolation mechanisms (e.g., using a fresh instance of the client configuration for each request if the library supports it, or dynamically setting it with care).","message":"The `OpenAPI.TOKEN` and `OpenAPI.BASE` configurations are global. If you are developing a server-side application that needs to interact with multiple Grexx instances or different user contexts, direct modification of these global properties can lead to race conditions or incorrect API calls. Ensure these are set appropriately for the current request context.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Store API keys and sensitive configurations in environment variables, a secure vault service (e.g., AWS Secrets Manager, HashiCorp Vault), or a `.env` file for local development. Access them at runtime using `process.env.YOUR_API_KEY`.","message":"API keys (OpenAPI.TOKEN) and base URLs (OpenAPI.BASE) should never be hardcoded directly into production application code or committed to version control. This is a significant security risk.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure `import { CaseService } from 'grexx-api';` is at the top of your file and that `grexx-api` is correctly installed via `npm install grexx-api`.","cause":"The `CaseService` or other service client was not correctly imported or `grexx-api` itself failed to load.","error":"TypeError: Cannot read properties of undefined (reading 'caseInfo')"},{"fix":"Verify that `OpenAPI.TOKEN` is set correctly with a valid, unexpired API key for your Grexx instance. Check the API key's permissions on the Grexx platform.","cause":"The provided `OpenAPI.TOKEN` is either missing, invalid, or has expired, preventing authentication with the Grexx Platform API.","error":"Error: Request failed with status code 401 (Unauthorized)"},{"fix":"Double-check `OpenAPI.BASE` against your Grexx platform's API documentation. Confirm that the `casePath` or other resource identifiers are correct and exist on your Grexx instance.","cause":"The `OpenAPI.BASE` URL is incorrect, the specific API endpoint does not exist at the provided path, or the resource (e.g., `casePath`) does not exist on the Grexx platform.","error":"Error: Request failed with status code 404 (Not Found)"}],"ecosystem":"npm"}