{"id":18861,"library":"toggl-api","title":"Toggl API for Node.js","description":"A Node.js client library for interacting with the Toggl time tracking API. Currently at version 1.0.2, this package provides a simple wrapper around Toggl's REST API endpoints, supporting authentication via API tokens and enabling operations such as fetching time entries, projects, and workspaces. It is a lightweight, dependency-light solution for integrating Toggl into Node.js applications, though it lacks TypeScript definitions and has limited documentation. The library follows a callback-based pattern typical of older Node.js packages.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/7eggs/node-toggl-api","tags":["javascript","api","toggl","timetracking"],"install":[{"cmd":"npm install toggl-api","lang":"bash","label":"npm"},{"cmd":"yarn add toggl-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add toggl-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS only; ESM import does not work out of the box.","wrong":"import TogglClient from 'toggl-api';","symbol":"TogglClient","correct":"const TogglClient = require('toggl-api');"},{"note":"If using a bundler or Node.js with esm, you may need to use default interop. However, the package has no default export; use require or wrap.","wrong":null,"symbol":"TogglClient","correct":"import TogglClient from 'toggl-api';"},{"note":"The module exports the constructor, not an instance. You must call new on the required value.","wrong":"const toggl = require('toggl-api')('api_token');","symbol":"toggl","correct":"const toggl = new (require('toggl-api'))('api_token');"}],"quickstart":{"code":"const TogglClient = require('toggl-api');\nconst toggl = new TogglClient(process.env.TOGGL_API_TOKEN ?? '');\n\ntoggl.getTimeEntries({ start_date: '2023-01-01', end_date: '2023-01-31' }, (err, entries) => {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  console.log(entries);\n});\n\ntoggl.getWorkspaces((err, workspaces) => {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  console.log(workspaces);\n});","lang":"javascript","description":"Demonstrates creating a Toggl client with an API token, fetching time entries, and listing workspaces using callbacks."},"warnings":[{"fix":"Ensure you pass a valid Toggl API token string (not email/password) to the constructor.","message":"Constructor expects API token as first argument; passing anything else will cause authentication failures.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use util.promisify() to convert callback methods to Promise-based usage.","message":"Package uses callbacks and does not support Promises natively. No promise wrappers provided.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Create a .d.ts file or use a type assertion (any) for the client instance.","message":"No TypeScript definitions available. Using in a TypeScript project will require manual type declarations.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Implement custom error handling and check err object for status codes.","message":"Package has limited error handling; network errors may not provide detailed messages.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider migrating to a library supporting Toggl API v9 or directly calling the new API.","message":"Toggl API v8 endpoints (used by this library) are deprecated; Toggl has moved to v9.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure you do: const TogglClient = require('toggl-api'); const toggl = new TogglClient(token);","cause":"Incorrectly importing the module; e.g., using default import without new keyword.","error":"TypeError: toggl.getTimeEntries is not a function"},{"fix":"Verify your Toggl API token from Toggl settings and ensure it is active.","cause":"Passing an invalid or expired API token to constructor.","error":"Error: Invalid API token"},{"fix":"Check your network connection and DNS settings. Ensure api.track.toggl.com is reachable.","cause":"Network DNS resolution failure, possibly due to no internet or proxy issues.","error":"RequestError: getaddrinfo ENOTFOUND api.track.toggl.com"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}