API: automation
Enrol new servers automatically, announce deploys from your CI/CD pipeline and trigger the compromise check after a release.
POST /enroll-tokens
Enrolment token for new servers · Write
Creates a token for installing new servers and returns the ready-made commands – for rollout scripts, cloud-init or Ansible.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
expires_in_hours | JSON body | integer 1–720 | no | validity in hours, default 24 |
max_uses | JSON body | integer 1–100 | no | number of servers, default 1 |
customer | JSON body | string | no | client new servers are assigned to |
Example request
cURL
curl -sSf -X POST "https://app.tyrosec.com/api/v1/enroll-tokens" \
-H "Authorization: Bearer $TYROSEC_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"expires_in_hours": 24, "max_uses": 5, "customer": "Beispiel-Shop GmbH"}'Python
import os
import requests
resp = requests.request(
"POST",
"https://app.tyrosec.com/api/v1/enroll-tokens",
headers={"Authorization": f"Bearer {os.environ['TYROSEC_TOKEN']}", "Accept": "application/json"},
json={"expires_in_hours": 24, "max_uses": 5, "customer": "Beispiel-Shop GmbH"},
timeout=30,
)
resp.raise_for_status()
print(resp.json())PHP
<?php
$ch = curl_init('https://app.tyrosec.com/api/v1/enroll-tokens');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FAILONERROR => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(['expires_in_hours' => 24, 'max_uses' => 5, 'customer' => 'Beispiel-Shop GmbH']),
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('TYROSEC_TOKEN'), 'Accept: application/json', 'Content-Type: application/json'],
]);
$out = curl_exec($ch);
if ($out === false) { throw new RuntimeException(curl_error($ch)); }
print_r(json_decode($out, true));JavaScript
const res = await fetch("https://app.tyrosec.com/api/v1/enroll-tokens", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TYROSEC_TOKEN}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({"expires_in_hours": 24, "max_uses": 5, "customer": "Beispiel-Shop GmbH"}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());Example response HTTP 201
{
"data": {
"token": "ENR_Xq7pL2vN9tR4mK8sW1cY5bH3jD6fG0aE",
"customer": "Beispiel-Shop GmbH",
"expires_at": "2026-11-25T00:05:00+00:00",
"uses_left": 5,
"install_command": "printf '%s\\n' 'ENR_Xq7pL2vN9tR4mK8sW1cY5bH3jD6fG0aE' | sudo install -m 600 /dev/stdin /root/tyrosec.token && curl -fsSL https://get.tyrosec.com/install.sh | sudo sh -s -- --token-file=/root/tyrosec.token --server=https://ingest.tyrosec.com; sudo rm -f /root/tyrosec.token",
"enroll_command": "printf '%s\\n' 'ENR_Xq7pL2vN9tR4mK8sW1cY5bH3jD6fG0aE' | sudo install -m 600 /dev/stdin /root/tyrosec.token && sudo tyrosecd enroll --server https://ingest.tyrosec.com --token-file /root/tyrosec.token; sudo rm -f /root/tyrosec.token; sudo systemctl enable --now tyrosecd"
}
}POST /hosts/{id}/deploy
Open a deploy window · Write
Opens a deploy window: changes during this time count as planned. Web shells, malware hits and PHP in media folders are still reported. With path for one folder only.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | uuid | yes | server ID (UUID) |
minutes | JSON body | integer 5–240 | no | duration, default 30 |
path | JSON body | string | no | this folder only (absolute path) |
note | JSON body | string | no | note, e.g. release |
Example request
cURL
curl -sSf -X POST "https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy" \
-H "Authorization: Bearer $TYROSEC_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"minutes": 30, "path": "/var/www/shop", "note": "Release 2.4.1"}'Python
import os
import requests
resp = requests.request(
"POST",
"https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy",
headers={"Authorization": f"Bearer {os.environ['TYROSEC_TOKEN']}", "Accept": "application/json"},
json={"minutes": 30, "path": "/var/www/shop", "note": "Release 2.4.1"},
timeout=30,
)
resp.raise_for_status()
print(resp.json())PHP
<?php
$ch = curl_init('https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FAILONERROR => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(['minutes' => 30, 'path' => '/var/www/shop', 'note' => 'Release 2.4.1']),
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('TYROSEC_TOKEN'), 'Accept: application/json', 'Content-Type: application/json'],
]);
$out = curl_exec($ch);
if ($out === false) { throw new RuntimeException(curl_error($ch)); }
print_r(json_decode($out, true));JavaScript
const res = await fetch("https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TYROSEC_TOKEN}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({"minutes": 30, "path": "/var/www/shop", "note": "Release 2.4.1"}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());Example response HTTP 200
{
"ok": true,
"until": "2026-11-24T00:35:03+00:00"
}DELETE /hosts/{id}/deploy
Close a deploy window · Write
Immediately closes deploy windows of the server opened via the API; closed is the number.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | uuid | yes | server ID (UUID) |
Example request
cURL
curl -sSf -X DELETE "https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy" \
-H "Authorization: Bearer $TYROSEC_TOKEN" \
-H "Accept: application/json"Python
import os
import requests
resp = requests.request(
"DELETE",
"https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy",
headers={"Authorization": f"Bearer {os.environ['TYROSEC_TOKEN']}", "Accept": "application/json"},
timeout=30,
)
resp.raise_for_status()
print(resp.json())PHP
<?php
$ch = curl_init('https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FAILONERROR => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('TYROSEC_TOKEN'), 'Accept: application/json'],
]);
$out = curl_exec($ch);
if ($out === false) { throw new RuntimeException(curl_error($ch)); }
print_r(json_decode($out, true));JavaScript
const res = await fetch("https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/deploy", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.TYROSEC_TOKEN}`,
Accept: "application/json",
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());Example response HTTP 200
{
"ok": true,
"closed": 1
}POST /hosts/{id}/check
Trigger a compromise check · Write
Requests the compromise check right away instead of waiting for the daily run – for example after a deploy.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | uuid | yes | server ID (UUID) |
Example request
cURL
curl -sSf -X POST "https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/check" \
-H "Authorization: Bearer $TYROSEC_TOKEN" \
-H "Accept: application/json"Python
import os
import requests
resp = requests.request(
"POST",
"https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/check",
headers={"Authorization": f"Bearer {os.environ['TYROSEC_TOKEN']}", "Accept": "application/json"},
timeout=30,
)
resp.raise_for_status()
print(resp.json())PHP
<?php
$ch = curl_init('https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/check');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FAILONERROR => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('TYROSEC_TOKEN'), 'Accept: application/json'],
]);
$out = curl_exec($ch);
if ($out === false) { throw new RuntimeException(curl_error($ch)); }
print_r(json_decode($out, true));JavaScript
const res = await fetch("https://app.tyrosec.com/api/v1/hosts/7c1b6092-482b-48d9-b40f-fb476bd98176/check", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TYROSEC_TOKEN}`,
Accept: "application/json",
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());Example response HTTP 200
{
"ok": true,
"message": "Check angefordert"
}See what’s happening on your server in two minutes.
Install the agent with a one-liner, wait for the initial scan, done. 14 days free, up to 3 servers, no credit card required.