Teamleader API: Getting started
The API was designed to allow read and write access to most basic objects in Teamleader.
For the following examples you will need your API group id and secret API key.
Finding your API key
If you already have a Teamleader account and you are an admin, you can find your API key under Settings > API & Webhooks. API access is available for every Teamleader account.
Teamleader Hello World example for PHP
NOTE: each individual request to the Teamleader API is authenticated by adding the api_group parameter as well as the api_secret parameter to the POST array. This will not be repeated in the rest of the documentation.
<?php // $url will contain the API endpoint $url = "https://www.teamleader.be/api/helloWorld.php"; // $fields contains all the fields that will be POSTed $fields = array( "api_group"=>("YOUR_API_GROUP"), "api_secret"=>("YOUR_API_SECRET")); // Make the POST request using Curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // Decode and display the output $api_output = curl_exec($ch); $json_output = json_decode($api_output); $output = $json_output?$json_output:$api_output; // Clean up curl_close($ch); ?>
Successful Teamleader API request.
Response Status Codes
The responses returned by the API are accompagnied by HTTP status codes indicating the outcome of the request. Here is a list of status codes you can receive:
400 Bad Request
Something went wrong with this API request because of the input parameters. A specific reason will be specified in the response body.
505 API rate limit reached
You can call the Teamleader API a maximum of 25 times every 5 seconds. If your application calls the API at a faster rate, you will get an empty response with a http status of 505. You have to manually retry the API request at a later time.