Toggl API client
Name | Type | Description |
---|---|---|
options |
optional
Client options |
Members
-
staticTogglClient.USER_AGENT
-
User agent string
-
authData
-
Result of authentication call
Methods
-
staticTogglClient.createUser(email, password, timezone, callback)
-
Create new user
Name Type Description email
string User e-mail address
password
string User password
timezone
string optional Timezone. UTC by default.
callback
function Accepts arguments: (err, userData)
-
staticTogglClient.defaultClient(){TogglClient}
-
Return default API client
-
Set default settings for client
Name Type Description newDefaults
object -
addProjectUser(projectId, userId, options, fields, callback)
-
Add user to project
Name Type Description projectId
number | string Project ID
userId
number | string User ID
options
object optional Project user options
fields
string[] optional List of User fields to populate
callback
function Accepts arguments: (err, projectUser)
-
addProjectUsers(projectId, userIds, options, fields, callback)
-
Add several users to project
Name Type Description projectId
number | string Project ID
userIds
Array.<number> | Array.<string> User IDs
options
object optional Project user options
fields
string[] optional List of User fields to populate
callback
function Accepts arguments: (err, projectUsers)
-
addTimeEntriesTags()
-
Add time entries tags
-
Make authentication call only if you use username & password
Name Type Description callback
function optional Accepts arguments: (err, userData)
-
changeUserPassword(currentPassword, password, callback)
-
Change user password
Name Type Description currentPassword
string optional Current password
password
string New password
callback
function Accepts arguments: (err)
-
createClient(data, callback)
-
Create a client
Name Type Description data
object New client data
callback
function Accepts arguments: (err, clientData)
-
createProject(data, callback)
-
Create a project
Name Type Description data
object New project data
callback
function Accepts arguments: (err, projectData)
-
createTag(name, workspaceId, callback)
-
Create tag
Name Type Description name
string Tag name
workspaceId
number | string Workspace ID
callback
function Accepts arguments: (err, tag)
-
createTask(name, projectId, data, callback)
-
Create task
Name Type Description name
string Task name
projectId
number | string ID of project for what task is created
data
object Task options
callback
function Accepts arguments: (err, task)
-
createTimeEntry(data, callback)
-
Create time entry
Name Type Description data
object Time entry data
callback
function Accepts arguments: (err, timeEntry)
-
deleteClient(clientId, callback)
-
Delete client
Name Type Description clientId
number | string Client ID
callback
function Accepts arguments: (err)
-
deleteProject(projectId, callback)
-
Delete project
Name Type Description projectId
number | string Project ID
callback
function Accepts arguments: (err)
-
deleteProjects(projectIds, callback)
-
Delete projects
Name Type Description projectIds
Array.<number> | Array.<string> Project IDs
callback
function Accepts arguments: (err)
-
deleteProjectUser(puID, callback)
-
Delete project user
Name Type Description puID
number | string Project user ID
callback
function Accepts arguments: (err)
-
deleteProjectUsers(puIDs, callback)
-
Delete project users
Name Type Description puIDs
Array.<number> | Array.<string> Project user IDs
callback
function Accepts arguments: (err)
-
deleteTag(tagId, callback)
-
Delete tag
Name Type Description tagId
number | string Tag Id
callback
function Accepts arguments: (err)
-
deleteTask(taskId, callback)
-
Delete task
Name Type Description taskId
number | string Task ID
callback
function Accepts arguments: (err)
-
deleteTasks(taskIds, callback)
-
Delete several tasks
Name Type Description taskIds
Array.<number> | Array.<string> Task IDs
callback
function Accepts arguments: (err)
-
deleteTimeEntry(teId, callback)
-
Delete time entry
Name Type Description teId
number | string Time entry Id
callback
function Accepts arguments: (err)
-
deleteWorkspaceUser(wuId, callback)
-
Delete workspace user
Name Type Description wuId
number | string Workspace user Id
callback
function Accepts arguments: (err)
-
Call when client is no longer needed
-
detailedReport(opts, callback)
-
Get detailed report
Name Type Description opts
object Request options
callback
function Accepts arguments: (err, report)
-
getClientData(clientId, callback)
-
Get client details
Name Type Description clientId
number | string Client ID
callback
function Accepts arguments: (err, clientData)
-
getClientProjects(clientId, active, callback)
-
Get client projects
Name Type Description clientId
number | string Client ID
active
string | boolean Filter projects: active (true), archived (false), both
callback
function Accepts arguments: (err, projects)
-
getClients(callback)
-
Get list of clients
Name Type Description callback
function Accepts arguments: (err, clients)
-
getCurrentTimeEntry(callback)
-
Get current running time entry
Name Type Description callback
function Accepts arguments: (err, timeEntry)
-
getProjectData(projectId, callback)
-
Get project data
Name Type Description projectId
number | string Project ID
callback
function Accepts arguments: (err, projectData)
-
getProjectTasks(projectId, callback)
-
Get project tasks list
Name Type Description projectId
number | string Project ID
callback
function Accepts arguments: (err, tasks)
-
getProjectUsers(projectId, callback)
-
Get project users list
Name Type Description projectId
number | string Project ID
callback
function Accepts arguments: (err, users)
-
getTaskData(taskId, callback)
-
Get task details
Name Type Description taskId
number | string Task ID
callback
function Accepts arguments: (err, task)
-
getTimeEntries(startDate, endDate, callback)
-
Get time entries started in a specific time range
Name Type Description startDate
string | number | Date | moment optional Date range start
endDate
string | number | Date | moment optional Date range end
callback
function Accepts arguments(err, timeEntries)
-
getTimeEntryData(teId, callback)
-
Get time entry details
Name Type Description teId
number | string Time entry Id
callback
function Accepts arguments: (err, timeEntry)
-
getUserData(options, callback)
-
Get user data
Name Type Description options
object Request options
callback
function Accepts arguments: (err, userData)
-
getWorkspaceClients(wId, callback)
-
Get workspace users
Name Type Description wId
number | string Workspace Id
callback
function Accepts arguments: (err, clients)
-
getWorkspaceData(wId, callback)
-
Get workspace data
Name Type Description wId
number | string Workspace Id
callback
function Accepts arguments: (err, workspace)
-
getWorkspaceProjects(wId, options, callback)
-
Get workspace projects
Name Type Description wId
number | string Workspace Id
options
object optional Request options
callback
function Accepts arguments: (err, projects)
-
getWorkspaces(callback)
-
Get data about all workspaces
Name Type Description callback
function Accepts arguments: (err, workspaces)
-
getWorkspaceTags(wId, callback)
-
Get workspace tags
Name Type Description wId
number | string Workspace Id
callback
function Accepts arguments: (err, tags)
-
getWorkspaceTasks(wId, options, callback)
-
Get workspace tasks
Name Type Description wId
number | string Workspace Id
options
object optional Request options
callback
function Accepts arguments: (err, tasks)
-
getWorkspaceUsers(wId, actualUsers, callback)
-
Get workspace users
Name Type Default Description wId
number | string Workspace Id
actualUsers
boolean true optional Return actual users or 'workspace user' objects
callback
function Accepts arguments: (err, users)
- See:
-
- https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspaces.md#get-workspace-users
- @see https://github.com/toggl/toggl_api_docs/blob/master/chapters/workspace_users.md#get-workspace-users
-
inviteUsers(workspaceId, emails, callback)
-
Invite users to workspace
Name Type Description workspaceId
number | string Workspace Id
emails
string[] E-mail addresses
callback
function Accepts arguments: (err, users, notifications)
-
removeTimeEntriesTags()
-
Remove time entries tags
-
resetApiToken(callback)
-
Reset API token
Name Type Description callback
function Accepts arguments: (err)
-
startTimeEntry(data, callback)
-
Create time entry and start it
Name Type Description data
object Time entry data
callback
function Accepts arguments: (err, timeEntry)
-
stopTimeEntry(teId, callback)
-
Stop time entry
Name Type Description teId
number | string Time entry Id
callback
function Accepts arguments: (err, timeEntry)
-
summaryReport(opts, callback)
-
Get summary report
Name Type Description opts
object Request options
callback
function Accepts arguments: (err, report)
-
updateClient(clientId, data, callback)
-
Update client details
Name Type Description clientId
number | string Client ID
data
object Client data
callback
function Accepts arguments: (err, clientData)
-
updateProject(projectId, data, callback)
-
Update project details
Name Type Description projectId
number | string project ID
data
object Project data
callback
function Accepts arguments: (err, projectData)
-
updateProjectUser(puID, options, fields, callback)
-
Update project user data
Name Type Description puID
number | string Project user ID
options
object Project user options
fields
string[] optional List of User fields to populate
callback
function Accepts arguments: (err, projectUser)
-
updateProjectUsers(puIDs, options, fields, callback)
-
Update data for several project users
Name Type Description puIDs
Array.<number> | Array.<string> Project user IDs
options
object Project user options
fields
string[] optional List of User fields to populate
callback
function Accepts arguments: (err, projectUsers)
-
updateTagName(tagId, name, callback)
-
Update tag name
Name Type Description tagId
number | string Tag Id
name
string New tag name
callback
function Accepts arguments: (err, tag)
-
updateTask(taskId, data, fields, callback)
-
Update task
Name Type Description taskId
number | string Task ID
data
object Update data
fields
string[] optional Fields to include into output
callback
function Accepts arguments: (err, task)
-
updateTasks(taskIds, data, fields, callback)
-
Update tasks
Name Type Description taskIds
Array.<number> | Array.<string> Task IDs
data
object Update data
fields
string[] optional Fields to include into output
callback
function Accepts arguments: (err, task)
-
updateTimeEntriesTags(teIds, tags, action, callback)
-
Update time entries tags
Name Type Description teIds
Array.<number> | Array.<string> Time entries Ids
tags
string[] Tags to add/remove
action
string 'add' or 'remove'
callback
function Accepts arguments: (err, timeEntries)
-
updateTimeEntry(teId, data, callback)
-
Update time entry
Name Type Description teId
number | string Time entry Id
data
object Update data
callback
function Accepts arguments: (err, timeEntry)
-
updateUserData(data, callback)
-
Update user data
Name Type Description data
object Update data
callback
function -
updateWorkspace(wId, data, callback)
-
Update workspace data
Name Type Description wId
number | string Workspace Id
data
object Update data
callback
function Accepts arguments: (err, workspace)
-
updateWorkspaceUser(wuId, options, callback)
-
Update workspace user
Name Type Description wuId
number | string Workspace user Id
options
object Update data
callback
function Accepts arguments: (err, workspaceUser)
-
weeklyReport(opts, callback)
-
Get weekly report
Name Type Description opts
object Request options
callback
function Accepts arguments: (err, report)