Authentication
Generate a Bearer token
/api/archive/share/generate-tokenExchange your client application ID and API key for a one-hour access token.
Authentication: client-id + api-key headers
curl --fail --silent --show-error -X POST \
-H "client-id: $TES_CLIENT_ID" \
-H "api-key: $TES_API_KEY" \
-H "Accept: application/json" \
"https://technicalengineeringsolutions.com/api/archive/share/generate-token"curl.exe --fail --silent --show-error -X POST ^
-H "client-id: %TES_CLIENT_ID%" ^
-H "api-key: %TES_API_KEY%" ^
-H "Accept: application/json" ^
"https://technicalengineeringsolutions.com/api/archive/share/generate-token"const url = "https://technicalengineeringsolutions.com/api/archive/share/generate-token";
const response = await fetch(url, {
method: "POST",
headers: {
"client-id": process.env.TES_CLIENT_ID,
"api-key": process.env.TES_API_KEY,
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
const data = await response.json();
console.log(data);<?php
$url = 'https://technicalengineeringsolutions.com/api/archive/share/generate-token';
$curl = curl_init($url);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'client-id: ' . getenv('TES_CLIENT_ID'),
'api-key: ' . getenv('TES_API_KEY'),
'Accept: application/json',
],
]);
$body = curl_exec($curl);
$error = curl_error($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if ($body === false) throw new RuntimeException($error);
if ($status < 200 || $status >= 300) {
throw new RuntimeException("HTTP $status: $body");
}
$data = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($data);client-id is the application ID displayed in the client portal. api-key is the client-specific credential issued by TES.
The returned token already includes the Bearer prefix. Store the complete value in TES_BEARER_TOKEN and use it unchanged. Generate a replacement after 60 minutes.
Response examples
200 / Token issued
{
"token": "Bearer <token>",
"expiry": 60
}Errors and access
400: client-id missing. 401: API key invalid or revoked. 403: client-id belongs to another credential. 503: token service unavailable.