Getting startedGeneralCRMDealsInvoicesSubscriptionsProductsTicketsTimetracking & TasksCallsMeetingsPlanningProjectsExternal costsNotesFilesUsers & TeamsCustom Fields

Teamleader Invoicing 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 invoices to Teamleader.

Manipulating invoices

Adding an Invoice to Teamleader

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

Required POST parameters for invoices

  • contact_or_company: contact or company: Who is the invoice 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

Extra POST parameters for invoice lines (required)

  • for_attention_of: string
  • payment_term: 0D / 7D / 10D / 15D / 21D / 30D / 45D / 60D / 30DEM / 60DEM / 90DEM
  • 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

  • draft_invoice: 0/1: set to 1 to insert this invoice as a draft.(default: 0)
  • layout_id: ID of the custom layout you wish to use for this invoice
  • date: date (dd/mm/yyyy): the date of the invoice. (default: today)
  • po_number: string
  • related_deal_id: ID of the deal this invoice is related to
  • direct_debit: 0/1: set to 1 to enable direct debit
  • comments: string
  • force_set_number: integer: force invoice number to the given integer

Sample output

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

Adding a credit note to Teamleader

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

Required POST parameters for invoices

  • invoice_id: ID of the invoice related to this credit note

Extra POST parameters for invoice 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
  • ...

Sample output

Example output: 2502 (id of the credit note that was added)

Updating the invoice payment status

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

Required POST parameters for invoices

  • invoice_id: integer: ID of the invoice that was paid
  • status: string: paid or not_paid

Sample output

Example output: message indicating the success of the operation.

Booking a draft invoice

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

Required POST parameters for invoices

  • invoice_id: integer: ID of the invoice that should be booked

Sample output

Example output: JSON array indicating the result of the call. The draft invoice will automatically
receive a number and will be dated.

Updating an invoice in Teamleader

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

Required POST parameters

  • invoice_id: ID of the invoice

Extra POST parameters for invoice 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.
  • ...

Sample output

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

Updating invoice comments

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

Required POST parameters

  • invoice_id: ID of the invoice
  • comments: string: comments that should be rendered to the invoice PDF

Sample output

Example output: Teamleader will return a status indicating wether or not the update was
successful.

Deleting an invoice

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

Required POST parameters

  • invoice_id: integer: ID of the invoice

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 invoices

Searching all invoices or credit notes

To search invoices: https://app.teamleader.eu/api/getInvoices.php
To search credit notes: https://app.teamleader.eu/api/getCreditnotes.php

Required POST parameters for invoices

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

Optional POST parameters

  • contact_or_company: contact or company: use this to filter by client
  • contact_or_company_id:integer: ID of the contact or company
  • deep_search: 0/1: pass 1 to return not just invoices related to the requested contact, but also to invoices related to linked companies
  • selected_customfields: comma-separated list of the IDs of the custom fields you wish to select (max 10). Example: '42,142' (only available for getInvoices.php).

Sample output

Example output: JSON encoded array containing all the permanent invoices, filtered by period and client.
The returned info contains the invoice date and number, totals and payment status.

Getting all invoices related to a project

To search invoices: https://app.teamleader.eu/api/getInvoicesByProject.php
To search credit notes: https://app.teamleader.eu/api/getCreditnotesByProject.php

Required POST parameters for invoices

  • project_id: ID of the project

Optional POST parameters

  • include_draft_invoices: 0/1: set this parameter to 1 to include draft invoices (default: 0)

Sample output

Example output: JSON encoded array containing all the permanent invoices related to this project.
The returned info contains the invoice date and number, totals and payment status.

Getting all invoices related to a deal

To search invoices: https://app.teamleader.eu/api/getInvoicesByDeal.php

Required POST parameters for invoices

  • deal_id: ID of the deal

Sample output

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

Search information about an invoice or credit note by ID

API endpoints:
To search invoices: https://app.teamleader.eu/api/getInvoice.php
To search credit notes: https://app.teamleader.eu/api/getCreditnote.php

Required POST parameters for invoices/credit notes

  • invoice_id or creditnote_id: integer: ID of the invoice or credit note you want to retrieve

Sample output

Example output: JSON encoded array containing information about the invoice.
The returned info contains the invoice date and number, totals and payment status.
The returned array also contains an item array containing all lines on the invoice.
Each line has information about the price, vat rate and accounting information.
Finally, there is also information about the discounts that may have granted.

Search all timetracking related to an invoice

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

Required POST parameters

  • invoice_id: integer: ID of the invoice

Sample output

Example output: JSON encoded array containing information about the timetracking related to this invoice.
This endpoint will retrieve the timetracking the invoice was initially based upon. The invoice content may
not reflect this timetracking anymore due to changes to the invoice content.

Search information about an invoice or credit note by invoice number and fiscal year

Note on fiscal year labels:
If your fiscal year is not identical to the calendar year, the label of your fiscal year might not be the year of the invoice date.

API endpoints:
To search invoices: https://app.teamleader.eu/api/getInvoiceByNr.php
To search credit notes: https://app.teamleader.eu/api/getCreditnoteByNr.php<

Required POST parameters for invoices

  • invoice_nr or creditnote_nr: integer: number of the invoice or credit note you want to retrieve
  • sys_department_id: integer: ID of the department the invoice belongs to
  • fiscal_year_label: string: Label of the fiscal year this invoice belongs to

Sample output

Example output: JSON encoded array containing information about the invoice.
The returned info contains the invoice date and number, totals and payment status.
The returned array also contains an item array containing all lines on the invoice.
Each line has information about the price, vat rate and accounting information.
Finally, there is also information about the discounts that may have granted.

Search information about an invoice by structured announcement (OGM)

API endpoints: https://app.teamleader.eu/api/getInvoiceByOGM.php

Required POST parameters for invoices

  • ogm: string: the entire OGM in the following format: +++xxx/yyy/zzzzz+++

Sample output

Example output: JSON encoded array containing information about the invoice.
The returned info contains the invoice date and number, totals and payment status.
The returned array also contains an item array containing all lines on the invoice.
Each line has information about the price, vat rate and accounting information.
Finally, there is also information about the discounts that may have granted.

Generating PDF files from invoices or credit notes

API endpoint:
To generate an invoice PDF: https://app.teamleader.eu/api/downloadInvoicePDF.php
To generate a credit note PDF: https://app.teamleader.eu/api/downloadCreditnotePDF.php

Required POST parameters for invoices

  • invoice_id or creditnote_id: integer: ID of the invoice or credit note you want to render to PDF

Sample output

Example output: Teamleader will return the PDF data and also sent the correct headers.
TIP: If you are using CURL and you want to use these headers in your output, use the CURLOPT_HEADER option.

Sending invoices

Sending an email invoice reminder

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

Required POST parameters

  • invoice_id: integer: ID of the invoice or credit note you want to render to PDF
  • email_to: string: email where the reminder should be sent. Use a comma separated list to send the e-mail to a maximum of 5 addresses
  • email_subject: string: email subject
  • email_text: string: email content (plain text)

Extra POST parameters

  • attachment_filename_1: string: filename for the attachment
  • attachment_base64_content_1: Base64 encoded file contents

  • attachment_filename_2: string: filename for the attachment
  • attachment_base64_content_2: Base64 encoded file contents
  • ...

Sample output

Example output: Teamleader will return as JSON string containing the status of the operation.

Fetching available invoice reminder templates

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

Required POST parameters

  • invoice_id: integer: ID of the invoice or credit note you want to view available reminders for

Sample output

Example output: JSON object containing either an error code or a list with the ID's and names of
available reminder templates.

Fetching text content for an invoice reminder based on a template

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

Required POST parameters

  • invoice_id: integer: ID of the invoice or credit note you want to generate a reminder text for
  • template_id: integer: ID of the template you want to base the text on

Sample output

Example output: JSON object containing either an error code or a generated subject and content that you can
use to send a reminder. Note: this call will not actually send the the reminder.

Invoicecloud (online payments)

Generating the Invoicecloud redirect URL

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

Required POST parameters

  • invoice_id: integer: ID of the invoice

Sample output

Example output: Teamleader will return an array containing the signed URL. You can share this URL with a client. The Invoicecloud platform allows online invoice payment.

Miscellaneous

Getting information about bookkeeping accounts

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

Required POST parameters for invoices

  • sys_department_id: integer: ID of the department

Sample output

Example output: Teamleader will return an array containing the ID, account number and name of the bookkeeping account.