Registry / crm-productivity / toggl-api

toggl-api

JSON →
library0.1.1jsnpmunverified

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.

npm install toggl-api
INSTALL
IMPORT
SIG · TOGGL-API
T
toggl-api
crm-productivityjavascriptv0.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TogglClient
const TogglClient = require('toggl-api');
import TogglClient from 'toggl-api';
This package is CommonJS only; ESM import does not work out of the box.
TogglClient
import TogglClient from 'toggl-api';
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.
toggl
const toggl = new (require('toggl-api'))('api_token');
const toggl = require('toggl-api')('api_token');
The module exports the constructor, not an instance. You must call new on the required value.

Demonstrates creating a Toggl client with an API token, fetching time entries, and listing workspaces using callbacks.

const TogglClient = require('toggl-api'); const toggl = new TogglClient(process.env.TOGGL_API_TOKEN ?? ''); toggl.getTimeEntries({ start_date: '2023-01-01', end_date: '2023-01-31' }, (err, entries) => { if (err) { console.error(err); return; } console.log(entries); }); toggl.getWorkspaces((err, workspaces) => { if (err) { console.error(err); return; } console.log(workspaces); });
Debug
Known issues
gotchaConstructor expects API token as first argument; passing anything else will cause authentication failures.
fix
Ensure you pass a valid Toggl API token string (not email/password) to the constructor.
affects: >=0.0.0
gotchaPackage uses callbacks and does not support Promises natively. No promise wrappers provided.
fix
Use util.promisify() to convert callback methods to Promise-based usage.
affects: >=0.0.0
gotchaNo TypeScript definitions available. Using in a TypeScript project will require manual type declarations.
fix
Create a .d.ts file or use a type assertion (any) for the client instance.
affects: >=0.0.0
gotchaPackage has limited error handling; network errors may not provide detailed messages.
fix
Implement custom error handling and check err object for status codes.
affects: >=0.0.0
deprecatedToggl API v8 endpoints (used by this library) are deprecated; Toggl has moved to v9.
fix
Consider migrating to a library supporting Toggl API v9 or directly calling the new API.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: toggl.getTimeEntries is not a function
Incorrectly importing the module; e.g., using default import without new keyword.
fix
Ensure you do: const TogglClient = require('toggl-api'); const toggl = new TogglClient(token);
Error: Invalid API token
Passing an invalid or expired API token to constructor.
fix
Verify your Toggl API token from Toggl settings and ensure it is active.
RequestError: getaddrinfo ENOTFOUND api.track.toggl.com
Network DNS resolution failure, possibly due to no internet or proxy issues.
fix
Check your network connection and DNS settings. Ensure api.track.toggl.com is reachable.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
45 hits · last 30 days
node
42
OpenAI (training)
1
Resources
toggl-api — npm install toggl-api · libregistry