Code samples

Call the Tilenza APIs from curl, JavaScript, Python and PHP.

There are no official SDK packages yet. The APIs are plain REST and JSON, so any HTTP client works — and you can generate a typed client from the OpenAPI file.

curl

curl "https://app.tilenza.com/api/crm/v1/leads?q=halden" \ -H "Authorization: Bearer $API_KEY"

JavaScript

const res = await fetch('https://app.tilenza.com/api/crm/v1/leads?q=halden', { headers: { Authorization: `Bearer ${process.env.API_KEY}` }, }); const { data } = await res.json();

Python

import os, requests r = requests.get( "https://app.tilenza.com/api/crm/v1/leads", params={"q": "halden"}, headers={"Authorization": f"Bearer {os.environ['API_KEY']}"}, ) leads = r.json()["data"]

PHP

$ch = curl_init('https://app.tilenza.com/api/crm/v1/leads?q=halden'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('API_KEY')], CURLOPT_RETURNTRANSFER => true, ]); $leads = json_decode(curl_exec($ch), true)['data'];

OpenAPI

npx @openapitools/openapi-generator-cli generate \ -i https://app.tilenza.com/api/crm/v1/openapi.json \ -g typescript-fetch -o ./tilenza-crm