Getting startedGeneralCRMDealsInvoicesSubscriptionsProductsTicketsTimetracking & TasksCallsMeetingsPlanningProjectsExternal costsNotesFilesUsers & TeamsCustom Fields

Teamleader Subscriptions 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 subscriptions to Teamleader.

Manipulating subscriptions

Adding a subscription to Teamleader

Note on subscription start dates:
You can create a subscription that starts in the past, but Teamleader will only generate invoices for future dates.

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

Required POST parameters for new subscriptions

  • contact_or_company: contact or company: Who is the subscription for?
  • contact_or_company_id:integer: ID of the contact or company
  • sys_department_id: ID of the department the invoice will be added to
  • date_start: date (dd/mm/yyyy): date the first invoice should be created.
  • repeat_after: Pick one: monthly, twomonthly, quarterly, sixmonthly, yearly, twoyearly
  • title: String (eg: Hosting, Domain names,..)

Extra POST parameters for items in the subscription

  • 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
  • ...

Optional POST parameters

  • date_end: date (dd/mm/yyyy): date this subscription should expire.
  • related_deal_id: ID of the deal this subscription is related to
  • permanent_invoicing string: When set to 0 this subscription won't be automatically booked. Default enabled
  • autosend_invoice string: When set to 1, this subscription invoice will be send automatically
  • autosend_bpost string: When set to 1, this subscription invoice through physical mail will be send automatically
  • comments string
  • days_in_advance string: Set to 0 to send out the invoice on the day it's due. Defaults to 7 days
  • payment_term: 0D / 7D / 10D / 15D / 21D / 30D / 45D / 60D / 30DEM / 60DEM / 90DEM. Default: 30D
  • custom_field_ID: replace ID by the ID of your custom field.

Sample output

Example output: 41666 (id of the subscription that was added)

Updating a subscription

Note on updates:
It is not possible to change period duration or start dates for subscriptions once the first invoice has been generated.

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

Required POST parameters for new subscriptions

  • subscription_id: ID of the subscription

Optional POST parameters

  • date_start: date (dd/mm/yyyy): date the first invoice should be created.
  • repeat_after: Pick one: monthly, twomonthly, quarterly, sixmonthly, yearly, twoyearly
  • custom_field_ID: replace ID by the ID of your custom field.

Sample output

Example output: OK if the subscription was updated. If the edit was not successful, an error message will be returned.
All changes made via the API to subscription will be registered in the tracking section of the subscription.

Deleting a subscription

Notes:
If a subscription has already generated at least once invoice, it will will be deactivated. If no invoices have been generated, the subscription will be deleted.

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

Required POST parameters for new subscriptions

  • subscription_id: ID of the subscription

Sample output

Example output: A JSON object will be returned indicated the status of the deletion.
A reason will be provided if the call failed.

Searching subscriptions

Searching subscriptions

https://app.teamleader.eu/api/getSubscriptions.php

Required POST parameters

  • amount: integer: the amount of subscriptions returned per request (1 - 100)
  • pageno: integer: the current page (the first page is 0)
  • selected_customfields: comma-separated list of the IDs of the custom fields you wish to select (max 10). Example: '42,142'

Optional POST parameters

  • searchby: string: a search string. Teamleader will try to match each part of the string to the subscription title and content.

Sample output

Example output: JSON array containing all matching Teamleader subscriptions. Each entry in the array is an associative array containing information about the subscriptions.

  • id: id of the subscription
  • active: boolean
  • title: string
  • repeat: string
  • client_name: string
  • department_name: string
  • department_id: id of the department
  • date_start: unix timestamp
  • date_start_formatted: mm/dd/yyyy
  • date_end: unix timestamp
  • date_end_formatted: mm/dd/yyyy
  • total_price_excl_vat: float
  • total_price_incl_vat: float
  • next_renewal_date: unix timestamp
  • next_renewal_date_formatted: dd/mm/yyyy
  • contact_or_company: string containing 'contact' or 'company'
  • contact_or_company_id: id of the contact or company

Fetching subscription information

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

Required POST parameters

  • subscription_id: integer: the ID of the subscription

Sample output

Example output: JSON array containing info about the subscription

  • id: id of the subscription
  • active: boolean
  • title: string
  • repeat: string
  • department_id: id of the department
  • date_start: unix timestamp
  • date_start_formatted: mm/dd/yyyy
  • date_end: unix timestamp
  • date_end_formatted: boolean
  • total_price_excl_vat: float
  • total_price_incl_vat: float
  • next_renewal_date: unix timestamp
  • next_renewal_date_formatted: mm/dd/yyyy
  • items: array containing the text, amount, line_total_excl_vat, line_total_incl_vat, vat_rate, account, subtitle, description and product_id
  • for: string containing 'contact' or 'company'
  • for_id: id of the related contact or company
  • custom fields: array containing the id's of the custom fields and their values

Fetching all invoices created by a subscription

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

Required POST parameters

  • subscription_id: integer: the ID of the subscription

Sample output

Example output: JSON array containing the invoice IDs this subscription has generated.

  • subscription_id: id of the subscription
  • subscription_title: string

Fetching all subscriptions related to an invoice

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

Required POST parameters

  • invoice_id: integer: the ID of the invoice

Sample output

Example output: JSON array containing the subscription IDs that were involved in generating this invoice. Multiple entries can be returned, because subscriptions can be merged into one invoice when they have the same renewal date.

Fetching all subscriptions related to a deal

To search subscriptions: https://app.teamleader.eu/api/getSubscriptionsByDeal.php

Required POST parameters

  • deal_id: ID of the deal

Sample output

Example output: JSON encoded array containing all the subscriptions related to this deal.

Fetching all subscriptions related to a contact or company

To search subscriptions: https://www.teamleader.be/api/getSubscriptionsByContactOrCompany.php

Required POST parameters

  • contact_or_company: contact or company: Who is the subscription for?
  • contact_or_company_id:integer: ID of the contact or company

Sample output

Example output: JSON encoded array containing all the subscriptions related to this contact or company.