Client for the Toggl API built for async and await support
npm i toggl-clientconst togglClient = require('toggl-client');
const client = togglClient({ apiToken: YOUR_API_TOKEN });- TogglClient
- Workspaces
- Workspace
- defaultToEmpty
- mapData
- Clients
- Groups
- Tags
- ProjectUsers
- Projects
- TimeEntries
- Reports
- User
Main class to interact with the toggl API.
Calling togglClient({ apiToken: YOUR_API_TOKEN }); returns an instance of this class.
workspacesWorkspacesprojectsProjectstimeEntriesTimeEntriesclientsClientsgroupsGroupstagsTagsprojectUsersProjectUsersuserUser
Access workspaces. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md
Lists all workspaces
Returns Array<Workspace> List of workspaces
Gets a workspace by id
Returns (Workspace | undefined) Workspace or undefined if the given workspace does not exist
Updates an existing workspace
Returns Workspace The updated workspace
Gets a list of users associated with the workspace
Returns any List of users associated with the workspace
Gets a list of clients associated with the workspace
Returns any List of clients associated with the workspace
Gets a list of groups associated with the workspace
Returns any List of groups associated with the workspace
Gets a list of projects associated with the workspace
Returns any List of projects associated with the workspace
Gets a list of tasks associated with the workspace
Returns any List of tasks associated with the workspace
Gets a list of tags associated with the workspace
Returns any List of tags associated with the workspace
Type: Object
idnumber Id of the workspacenamenumber Name of the workspacepremiumboolean True if premium features are enabledadminboolean True if requesting user has admin access to the workspacedefault_hourly_ratenumber Default hourly rate only shown for requesting admin usersdefault_currencystring Default currencyonly_admins_may_create_projectsbooleanonly_admins_see_billable_ratesbooleanonly_admins_see_team_dashboardbooleanroundingnumber type of roundingrounding_minutesnumber round up to nearest minuteatdate Indicates when the workspace was created or updated
Returns the input data or an empty array
dataany Input data
Returns any any
Parses the input and returns the data property or an undefined This was used heavily in the v8 API and may no longer be needed in v9.
resany A response from the Toggl API
Returns any object||undefined
Access clients. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/clients.md
Gets a list of clients
Returns any an array of clients
Creates a new client
clientany
Returns any Created client
Gets a client by id
Returns any client or undefined if no client with specified id was found
Updates a client
Returns any updated client
Deletes a client by id
Lists projects associated with the given client
Access groups. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/groups.md
Creates a group
groupany
Returns any group created
Updates a group
Returns any result of update operation
Deletes a group
Access Tags. See https://developers.track.toggl.com/docs/api/tags
Validates that a tag contains the name property.
tagObject The tag object to be validated
- Throws Error 'The tag must include name'
Creates a new tag
workspace_idnumber Id of the workspacetagobject A tag object with the propertynameand optionallyworkspace_id
Returns any Tag created
Updates an existing tag
workspace_idnumber Id of the workspaceid(number | string) Id of the tag to be updatedtagobject A tag object with the propertynameand optionallyworkspace_id
Returns any Updated tag
Deletes an existing tag
Access project users. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/project_users.md
Gets a project user by id
Updates an existing project user
Deletes an existing project user
Creates a new project user
project_userany
Returns any project user created
Access projects. See https://developers.track.toggl.com/docs/api/projects
Creates a new project
workspace_id(number) Id of the workspace to be updatedprojectany
Returns any Project created
Gets an existing project by id
Returns any Project if a project with the specified id exists, othererwise undefined
Gets all projects
Returns any Project if a project with the specified id exists, othererwise undefined
Updates an existing project
workspace_id(number) Id of the workspace to be updatedproject_id(number) Id of the project to be updatedprojectany
Returns any The updated project
Deletes an existing project
workspace_idproject_idid(number) Id of the project to be deleted
Gets tasks associated with the given project
workspace_idproject_idid(number) Id of the project
Returns any Array of tasks associated with the project
Access time entries. See https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md
Gets the time entry specified by id. Due to limitations of the v9 API, start_date must not be earlier than 3 months ago. If you want results further back, use the reports endpoints.
idany
Returns any TimeEntry
Delete an existing time entry
idnumber
Lists time entries. The query must include start_date and end_date. Note that due to
limitations of the v9 API, start_date must not be earlier 3 months ago. If you want results
further back, use the reports endpoints.
queryany must includestart_dateandend_dateand must be within the last 30 days.
Returns any List of time entries
Creates a new time entry
time_entryany must includeworkspace_idandstart
Returns any
Creates a new time entry
time_entryany must includeworkspace_idandstart
Returns any
Stops the current running time entry
time_entry
Returns any
Gets the current running time entry
Returns any
Updates an existing time entry
idnumbertime_entryany
Returns any
Access reports. See https://github.com/toggl/toggl_api_docs/blob/master/reports.md
Weekly report https://developers.track.toggl.com/docs/reports/weekly_reports#post-search-time-entries
workspaceIdparams
Weekly report containing all pages fetched with wait time between requests of 1010ms https://developers.track.toggl.com/docs/reports/weekly_reports#post-search-time-entries
workspaceIdparams
Detailed report URL: GET https://api.track.toggl.com/reports/api/v3/workspace/{workspace_id}/search/time_entries https://developers.track.toggl.com/docs/reports/detailed_reports#post-load-totals-detailed-report params must include start_date
workspaceIdparams
Detailed report containing all pages fetched with wait time between requests of 1010ms URL: GET https://api.track.toggl.com/reports/api/v3/workspace/{workspace_id}/search/time_entries https://developers.track.toggl.com/docs/reports/detailed_reports#post-load-totals-detailed-report params must include start_date
workspaceIdparams
Summary report URL: GET https://api.track.toggl.com/reports/api/v2/summary
workspaceIdparams
Summary report containing all pages fetched with wait time between requests of 1010ms URL: GET https://api.track.toggl.com/reports/api/v2/summary
workspaceIdparams
Access users. See https://developers.track.toggl.com/docs/api/me
Gets the current user
Returns any The current user.See https://developers.track.toggl.com/docs/api/me#get-me
Updates the user. You can only update country_id, current_password, default_workspace_id, email, fullname,name, password, timezone
See https://developers.track.toggl.com/docs/api/me#put-me
userany
Returns any The updated user.
Resets API token https://developers.track.toggl.com/docs/api/authentication#post-resettoken
Returns any New API token {String}