Getting startedGeneralCRMDealsInvoicesSubscriptionsProductsTicketsTimetracking & TasksCallsMeetingsPlanningProjectsExternal costsNotesFilesUsers & TeamsCustom Fields

Teamleader Timetracking API

This document assumes you have your API key and know how to perform a POST request (see Getting started)

This part of the api allows you to add new timetracking entries to Teamleader.

Manipulating timetracking & tasks

Adding timetracking

API endpoint: https://app.teamleader.eu/api/addTimetracking.php

Required POST parameters

  • description: string: description of the activity.
  • start_date: integer: start date of the activity as Unix timestamp (seconds).
  • end_date: integer: end date of the activity as Unix timestamp (seconds).
  • worker_id: ID: id of the user. Use API call below to find all possibilities.
  • task_type_id: ID: category of the task. Use API call below to find all possibilities.

Extra POST parameters for adding additional costs (optional)

  • description_1: string
  • price_1: decimal
  • amount_1: decimal
  • vat_1: 00/ 06 / 12 / 21 / CM / EX / MC / VCMD: the vat tariff for this line
  • product_id_1: id of the product (optional)
  • subtitle_1: string (optional)

  • description_2: string
  • price_2: decimal
  • ...

Optional POST parameters

  • for: contact, company or project_milestone: who should this activity be billed to?
  • for_id: pass the Teamleader ID of the contact, company or milestone in Teamleader.
  • invoiceable: 0/1. Can this time be invoiced later or not? This parameter has no effect for project-related timetracking, because invoiceability is determined by the related milestone.
  • subtract_break 0/1: if this parameter is set to 1. Lunchbreaks will be substracted from the timetracking.
  • related_object_type: none, task: What kind of item is this activity related to?
  • related_object_id: if this activity is related to a task, pass in the task ID.

Sample output

Example output: OK or error message.

Updating timetracking

API endpoint: https://app.teamleader.eu/api/updateTimetracking.php

Required POST parameters

  • timetracking_id: integer: ID of the timetracking to update.

Optional POST parameters

  • description: string: description of the activity.
  • start_date: integer: start date of the activity as Unix timestamp (seconds).
  • end_date: integer: end date of the activity as Unix timestamp (seconds).
  • worker_id: ID: id of the user. Use API call below to find all possibilities.
  • task_type_id: ID: category of the task. Use API call below to find all possibilities.
  • for: contact, company or project_milestone: who should this activity be billed to?
  • for_id: pass the Teamleader ID of the contact, company or milestone in Teamleader.
  • invoiceable: 0/1. Can this time be invoiced later or not? This parameter has no effect for project-related timetracking, because invoiceability is determined by the related milestone.
  • subtract_break 0/1: if this parameter is set to 1. Lunchbreaks will be substracted from the timetracking.
  • related_object_type: none, task: What kind of item is this activity related to?
  • related_object_id: if this activity is related to a task, pass in the task ID.

Extra POST parameters for adding additional costs (optional)

  • description_1: string
  • price_1: decimal
  • amount_1: decimal
  • vat_1: 00/ 06 / 12 / 21 / CM / EX / MC / VCMD: the vat tariff for this line
  • product_id_1: id of the product (optional)
  • subtitle_1: string (optional)

  • description_2: string
  • price_2: decimal
  • ...

Sample output

Example output: OK or error message.

Adding a task

API endpoint: https://app.teamleader.eu/api/addTask.php

Required POST parameters

  • description: string: description of the task.
  • due_date: integer: due date of the task as Unix timestamp (seconds).
  • user_id OR team_id: ID: id of the user or team. Use API call below to find all possibilities. (pick one)
  • task_type_id: ID: category of the task. Use API call below to find all possibilities.
  • duration: integer: amount of mintues that should be spent on this task.
  • priority: string: Pick a priority for this task: either A, B, C or D.

Optional POST parameters

  • for: contact, company or project_milestone: who should this task be billed to?
  • for_id: pass the Teamleader ID of the contact, company or milestone in Teamleader.
  • creator_user_id: ID: id the user that created this task.
  • related_deal_id: ID: id of the deal related to this task.
  • related_ticket_id: ID: id of the ticket related to this task.
  • custom_field_ID: replace ID by the ID of your custom field.

Sample output

Example output: ID of the task or error message.

Updating a task

API endpoint: https://app.teamleader.eu/api/updateTask.php

Required POST parameters

  • task_id: ID: the id of the task.

Optional POST parameters

  • description: string: description of the task.
  • duration: integer: amount of mintues that should be spent on this task.
  • task_type_id: ID: category of the task. Use API call below to find all possibilities.
  • user_id: ID: id of the user. Use API call below to find all possibilities.
  • priority: string: Pick a priority for this task: either A, B, C or D.
  • done: 0/1: 1 means this task has been finished.
  • custom_field_ID: replace ID by the ID of your custom field.

Sample output

Example output: ID of the task or error message.

Deleting a task

API endpoint: https://app.teamleader.eu/api/deleteTask.php

Required POST parameters

  • task_id: id: the task id.

Sample output

Example output: JSON array indicating the success or failure of this call. Tasks that already
have related timetracking will be archived, not deleted.

Searching timetracking & tasks

Fetching a single timetracking entry by ID

API endpoint: https://app.teamleader.eu/api/getTimetrackingEntry.php

Required POST parameters

  • timetracking_id: ID: the id of the timetracking entry

Sample output

JSON array containing information about the timetracking entry.
  • id: id of the timetracking
  • user_id: id of the user
  • employee_name: string
  • date: unix timestamp
  • date_formatted: dd/mm/yyyy
  • duration: duration of the timetracking in minutes
  • contact_id: id of the related contact
  • company_id: id of the related company
  • project_id: id of the related project
  • project_title: string
  • description: string
  • milestone_id: id of the related milestone
  • milestone_title: string
  • ticket_id: id of the related ticket
  • is_invoicable: boolean
  • related_to: array containing the types and id's of the related objects

Fetching timetracking entries in a certain time range

API endpoint: https://app.teamleader.eu/api/getTimetracking.php

Required POST parameters (NOTE: the maximum request period is one month)

  • date_from: date (dd/mm/yyyy): the start date of the period you are requesting timetracking for
  • date_to: date (dd/mm/yyyy): the end date of the period you are requesting timetracking for

Optional POST parameters (NOTE: filters cannot be combined)

  • user_id: ID: return only timetracking tracked by this user
  • project_id: ID: return only timetracking related to this project
  • company_id: ID: return only timetracking related to this company
  • contact_id: ID: return only timetracking related to this contact

Sample output

Example output: JSON array containing information about the timetracking entries.
  • id: id of the timetracking
  • user_id: id of the user
  • employee_name: string
  • date: unix timestamp
  • date_formatted: dd/mm/yyyy
  • duration: duration of the timetracking in minutes
  • contact_id: id of the related contact
  • company_id: id of the related company
  • project_id: id of the related project
  • project_title: string
  • description: string
  • milestone_id: id of the related milestone
  • milestone_title: string
  • ticket_id: id of the related ticket
  • is_invoicable: boolean
  • related_to: array containing the types and id's of the related objects

Fetching timetracking entries related to a task

API endpoint: https://app.teamleader.eu/api/getTimetrackingForTask.php

Required POST parameters

  • task_id: id: the task id

Sample output

Example output: JSON array containing information about the timetracking entries.
  • id: id of the timetracking
  • user_id: id of the user
  • date: unix timestamp
  • date_formatted: dd/mm/yyyy
  • duration: duration of the timetracking in minutes
  • is_invoicable: boolean

Fetching tasks

API endpoint: https://app.teamleader.eu/api/getTasks.php

Required POST parameters

  • amount: integer: the amount of tasks returned per request (1 - 100)
  • pageno: integer: the current page (the first page is 0)

Optional POST parameters

  • selected_customfields: comma-separated list of the IDs of the custom fields you wish to select (max 10). Example: '42,142'
  • user_id: ID: return only tasks for this user

Sample output

Example output: JSON array containing information about the task entries.
	
  • id: id of the task
  • description: description of the task
  • project_id: id of the related project
  • milestone_id: id of the related milestone

Fetching a task

API endpoint: https://app.teamleader.eu/api/getTask.php

Required POST parameters (NOTE: the maximum request period is one month)

  • task_id: id: the task id

Sample output

Example output: JSON array containing information about the task.
  • estimated_time_required: time in minutes
  • estimated_time_used: time in minutes
  • description: string
  • finished: boolean
  • date_finished: unix timestamp
  • date_finished_formatted: dd/mm/yyyy
  • priority: string
  • due_date: unix timestamp
  • due_date_formatted: dd/mm/yyyy
  • project_id: id of the related project
  • project_name: string
  • milestone_name: string
  • related_ticket_id: id of the related ticket
  • client_type: string containing 'contact' or 'company'
  • client_id: id of the related customer
  • client_name: string
  • responsible_users: array containing the team_id and user id's
  • creator_name: id of the related milestone
  • deleted: boolean
  • type_id: id of the type

Miscellaneous

Getting all task types

API endpoint: https://app.teamleader.eu/api/getTaskTypes.php

Required POST parameters

  • none

Sample output

Example output: JSON array containing ID's and descriptions of all task types.
  • id: id of the task type
  • name: string

Getting prepaid information

API endpoint: https://app.teamleader.eu/api/getPrepaidInfo.php

Required POST parameters

  • contact_or_company: contact or company
  • contact_or_company_id:integer: ID of the contact or company

Sample output

Example output: JSON array containing the amount of prepaid currency left and the hourly rate for this client.
  • pricing_type: string
  • hourly_rate: float
  • prepaid_money_left: float

Getting the default cost per kilometer

API endpoint: https://app.teamleader.eu/api/getCostPerKm.php

Sample output

Example output: JSON array containing default cost per kilometer.
This cost is used when calculating the cost for driving to a meeting.

Setting the hourly pricing for a contact, company or project

API endpoint: https://app.teamleader.eu/api/setHourlyPricing.php

Required POST parameters

  • for: contact, company or project
  • for_id:integer: ID of the contact, company or project
  • hourly_pricing:by_user, by_task_type or a number

Optional POST parameters

  • update_existing_timetracking: 0/1. If set to 1, existing timetracking entries for this object that are not yet invoiced will have the updated pricing. Default: 0.

Sample output

Example output: OK or error message.