Getting startedGeneralCRMDealsInvoicesSubscriptionsProductsTicketsTimetracking & TasksCallsMeetingsPlanningProjectsExternal costsNotesFilesUsers & TeamsCustom Fields

Teamleader Deals 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 deals to Teamleader.

Manipulating deals

Adding a deal

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

Required POST parameters for deals

  • contact_or_company: contact or company: Who is related to this deal?
  • contact_or_company_id: integer: ID of the related contact or company
  • title: string: eg 'Interesting business deal'
  • source: string: eg 'Google Adwords'

Extra POST parameters for item lines (required)

  • 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)
  • account_1: id of the bookkeeping account (optional)
  • subtitle_1: string (optional)

  • description_2: string
  • price_2: decimal
  • ...
  • custom_field_ID: replace ID by the ID of your custom field.

Optional POST parameters

  • sys_department_id: ID of the department the deal will be added to
  • responsible_sys_client_id: integer: id of the user that is responsible for this deal
  • description: string: If this parameter is filled out a quotation (PDF) is generated by Teamleader using the text provided and the items. The PDF is accessible via the web interface.
  • budget_estimation: decimal: budget estimation for this deal. This value will be overwritten once a quotation is made for this deal
  • optional_contact_id: integer: if this deal is related to a company, you can specify the ID of a related contact within that company via this parameter
  • filter_double_sales: integer: if set to 1, an extra check added to make sure the deal isn't a double of the previous one.

Sample output

Example output: 41664 (id of the deal that was added)

Updating deal information

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

Required POST parameters

  • deal_id: integer: ID of the deal

Optional POST parameters

  • title: string: new title of the deal
  • source: string: new source of the deal
  • responsible_sys_client_id: integer: new responsible user for the deal
  • phase_id: integer: new phase id this deal should be moved to
  • budget_estimation: decimal: budget estimation for this deal. This value will be overwritten once a quotation is made for this deal
  • custom_field_ID: replace ID by the ID of your custom field. (eg custom_field_310)

Sample output

Example output: OK or JSON array with more information

Updating Deal items

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

Required POST parameters

  • deal_id: integer: ID of the deal
  • 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)
  • account_1: id of the bookkeeping account (optional)
  • subtitle_1: string (optional)

  • description_2: string
  • price_2: decimal
  • ...
  • custom_field_ID: replace ID by the ID of your custom field.

Sample output

Example output: OK or JSON array with more information

Sending deal via email

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

Required POST parameters

  • sale_id: integer: ID of the deal
  • email: string: email address of the client whereto send the deal.
  • subject: string: email subject
  • message: string: email message. Add <link> to the message to print out the InvoiceCloud link. (not required when using an email template, leave empty or discard from request when using template_id)

Optional POST parameters

  • template_id: integer: ID of the email message created in Teamleader.

Sample output

Example output: Example output: JSON array indicating the success or failure of this call. 

Searching deals

Searching all deals

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

Required POST parameters

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

Optional POST parameters

  • searchby: string: a search string. Teamleader will try to search deals matching this string.
  • selected_customfields: comma-separated list of the IDs of the custom fields you wish to select (max 10). Example: '42,142'
  • filter_by_phase_id: integer: Teamleader try and return deals with the phase_id set here.
  • segment_id: integer: The ID of a segment created for deals. Teamleader will try to return the deals matching the segment.

Sample output

Example output: JSON array containing all matching Teamleader deals. Each entry in the array is an associative array containing information about the deal. The most important keys for this array are: id, title, customer_name, total_price_excl_vat, probability, phase_id, responsible_user_id, source_id, values of all custom fields that you have defined for deals.

Searching all deals related to a contact/company

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

Required POST parameters

  • contact_or_company: set to either contact or company
  • contact_or_company_id: integer: ID of the related contact or company

Sample output

Example output: JSON array containing an array matching all deals related to this contact or company.

Searching all deals related to a project

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

Required POST parameters

  • project_id: integer: ID of the related project

Sample output

Example output: JSON array containing an array matching all deals related to this project.

Fetching deal information

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

Required POST parameters

  • deal_id: integer: the ID of the deal

Sample output

Example output: JSON array containing info about the deal

Fetching deal phase changes for a single deal

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

Required POST parameters

  • deal_id: integer: the ID of the deal

Sample output

Example output: JSON array containing all phase changes a deal underwent.

Fetching deal phase changes for all deals in a certain time range

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

Required POST parameters

  • date_from: date (dd/mm/yyyy): the start date of the period
  • date_to: date (dd/mm/yyyy): the end date of the period

Sample output

Example output: JSON array containing all phase changes that occurred in this period.

Fetching all deal phases

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

Required POST parameters

  • none

Sample output

Example output: JSON array containing the ID's and names of all the available deal phases

Fetching deal sources

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

Required POST parameters

  • none

Sample output

Example output: JSON array containing the ID's and names of all the available deal sources