{"id":18173,"library":"box-typescript-sdk-gen","title":"Box TypeScript SDK Gen","description":"Official Box TypeScript SDK generated from the Box OpenAPI specification. Current stable version is 1.19.1, with frequent releases (multiple per month) as part of an auto-generation pipeline. It provides full coverage of the Box API, including AI, classification, chunk uploads, webhooks, and sign requests. Supports both ESM and CJS, includes TypeScript types, and offers built-in retries with exponential backoff, authentication, and request cancellation. Key differentiators vs older Box SDKs: rapid API updates (days vs months), embedded documentation via JSDoc, and generated code consistency across languages. Requires Node.js >=16.","status":"active","version":"1.19.1","language":"javascript","source_language":"en","source_url":"https://github.com/box/box-typescript-sdk-gen","tags":["javascript","box","sdk","api","rest","boxsdk","typescript"],"install":[{"cmd":"npm install box-typescript-sdk-gen","lang":"bash","label":"npm"},{"cmd":"yarn add box-typescript-sdk-gen","lang":"bash","label":"yarn"},{"cmd":"pnpm add box-typescript-sdk-gen","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for multipart form data requests","package":"form-data","optional":false},{"reason":"HTTP client for API calls","package":"node-fetch","optional":false}],"imports":[{"note":"BoxClient is a named export, not default. ESM import is required for tree-shaking; CJS require is also valid.","wrong":"import BoxClient from 'box-typescript-sdk-gen'","symbol":"BoxClient","correct":"import { BoxClient } from 'box-typescript-sdk-gen'"},{"note":"Class name includes 'Box' prefix, consistent with other auth types like BoxJWT, BoxCCG.","wrong":"import { DeveloperTokenAuth } from 'box-typescript-sdk-gen'","symbol":"BoxDeveloperTokenAuth","correct":"import { BoxDeveloperTokenAuth } from 'box-typescript-sdk-gen'"},{"note":"Both ESM and CJS work, but TypeScript expects named import for type inference.","wrong":"const BoxOAuth = require('box-typescript-sdk-gen').BoxOAuth","symbol":"BoxOAuth","correct":"import { BoxOAuth } from 'box-typescript-sdk-gen'"}],"quickstart":{"code":"import { BoxClient, BoxDeveloperTokenAuth } from 'box-typescript-sdk-gen';\n\nconst auth = new BoxDeveloperTokenAuth({ token: process.env.BOX_DEV_TOKEN ?? '' });\nconst client = new BoxClient({ auth });\n\nasync function main() {\n  const me = await client.users.getUserById({ userId: 'me' });\n  console.log(`Logged in as ${me.name} (${me.login})`);\n\n  const items = await client.folders.getFolderItems({ folderId: '0' });\n  for (const item of items.entries) {\n    console.log(`${item.type}: ${item.name}`);\n  }\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Authenticate with a developer token and retrieve current user info and root folder contents."},"warnings":[{"fix":"Use import { BoxClient } from 'box-typescript-sdk-gen' instead of import BoxClient from 'box-typescript-sdk-gen'.","message":"ESM imports must use named exports; default import is not available.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace old import paths with new generated SDK.","message":"Old Box TypeScript SDK (non-generated) is deprecated; migrate to this SDK.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Pass auth config as an object: new BoxDeveloperTokenAuth({ token: '...' }).","message":"Constructor arguments for auth classes changed to object parameter in v1.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 16 or later.","message":"Node.js >=16 required; the SDK does not work in older Node versions due to fetch and other modern APIs.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ESM imports (import ... from ...).","message":"CJS require() works but is not recommended; ESM is preferred for tree-shaking and type safety.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Update to v1.19.1 or later which fixes ESM build.","message":"In v1.18.0, form-data was bumped to 4.0.4, which may cause issues with older Node.js fetch implementations.","severity":"breaking","affected_versions":">=1.18.0 <1.19.0"},{"fix":"Use the updated verifySignature method which handles both escaped and unescaped bodies.","message":"Webhook signature verification changed in v1.16.0: body is now escaped before signing.","severity":"gotcha","affected_versions":">=1.16.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install box-typescript-sdk-gen' and ensure your Node.js version is >=16.","cause":"Package not installed or wrong import path.","error":"Cannot find module 'box-typescript-sdk-gen'"},{"fix":"Use 'import { BoxClient } from 'box-typescript-sdk-gen'' (curly braces).","cause":"Default import used instead of named import (or wrong import style).","error":"TypeError: BoxClient is not a constructor"},{"fix":"Ensure authentication is set up correctly, e.g., new BoxDeveloperTokenAuth({ token: process.env.BOX_DEV_TOKEN }) and pass to BoxClient.","cause":"BoxClient not properly initialized due to missing auth or invalid token.","error":"Uncaught TypeError: Cannot read properties of undefined (reading 'getUserById')"},{"fix":"Check network connectivity and proxy settings. Ensure the environment allows outbound HTTPS requests.","cause":"Network issue; the SDK cannot reach Box API endpoints.","error":"Error: connect ECONNREFUSED 127.0.0.1:443"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}