Reference
REST API
Read and change your workspace from a script or a dashboard with the REST API: the token, the base URL, examples with curl and jq, and the answers when the portal refuses a request.
Before you start #
An admin turns the API on, and you make a token with a preset for the API: see Turn the API or MCP on.
The REST API #
The base URL is https://name.sc.tuxcare.cloud/api/v1. Send the token in the Authorization header. The API does not accept a token in the URL.
curl -fsS \
-H "Authorization: Bearer $SECURECHAIN_API_TOKEN" \
"https://name.sc.tuxcare.cloud/api/v1/repos?limit=20"
- A
GETrequest needs the read permission. Any other method needs the write permission. - The OpenAPI document at
/api/v1/openapi.jsonlists each route, its permission, and the role that it needs. It needs no token. - The role and the scope of the token apply, the same as in the browser. The rate limit of each token also applies.
- The examples list hosts and vulnerabilities.
- Useful routes: the exports (
/api/v1/export/findings), the compliance report (/api/v1/repos/{id}/report), and the VEX file of a release (/api/v1/releases/{id}/vex).
Examples #
The examples use jq to read the JSON. Put the token in a variable first:
export SECURECHAIN_API_TOKEN='<token>'
B=https://name.sc.tuxcare.cloud/api/v1
H="Authorization: Bearer $SECURECHAIN_API_TOKEN"
The hosts, as the Hosts page lists them. Each id is the key of the host in the other routes:
curl -fsS -H "$H" "$B/hosts" | jq
Each host has its id, name, os (almalinux-9.6), support (els, esu, essential, or empty when the host has no TuxCare release file: the pages then show Community
, or No TuxCare licence
on RHEL), the booted kernel, live_patched_to (the kernel build that KernelCare's patches bring it to), addresses (the addresses of its network interfaces), submitted_from (the address that its last scan came from), last_scan, agent (tuxcare-radar/3.0.2), tags, and the open vulnerabilities by severity. The route takes filters: ?os=almalinux-9.6 (the hosts of one release; the Hosts page has no such list, and sorts by the OS column instead), ?tag=prod, ?q=web. ?q= also finds a host by an address: ?q=192.168.0.53.
# one line per host: name, operating system, kernel, last scan, critical and total
curl -fsS -H "$H" "$B/hosts" \
| jq -r '.[] | [.name, .os, .kernel, .last_scan, .vulnerabilities.critical, .vulnerabilities.total] | @tsv'
The vulnerabilities of one host, as its page lists them. Use the id from the list of hosts. The answer is the latest scan of the host:
curl -fsS -H "$H" "$B/repos/6/vulnerabilities" | jq
Each row has the advisory (a CVE id), its summary, the packages it is on, its severity, and the fix: the version that fixes it, or no fix yet
, TuxCare will not fix
, live-patched by KernelCare
, kernel not running
, TuxCare is investigating
, not evaluated: TuxCare has not assessed this build
. Add ?kernels=all to include the installed kernels that the host does not run.
# the critical CVEs of host 6 that have a fix, as CSV
curl -fsS -H "$H" "$B/repos/6/vulnerabilities" \
| jq -r '.vulnerabilities[] | select(.severity == "critical" and (.fix | test("^[0-9]")))
| [.advisory, (.packages | join(" ")), .fix] | @csv'
Every vulnerability of the workspace, with the hosts and other assets that have it, as the Vulnerabilities page lists them:
curl -fsS -H "$H" "$B/vulnerabilities?severity=critical&kind=host" | jq
Each row has the advisory, summary, severity, and the assets (id, name, kind). severity takes a comma list in any case: CRITICAL,HIGH. Other filters: exploited=1 (known exploited), fixable=1, tuxcare=1 (TuxCare has a fix), untriaged=1, reboot=1 (a reboot would close at least one of its findings, on a host that KernelCare does not patch), kind=host, q=openssl.
Files: add format=xlsx or format=csv to /repos/{id}/vulnerabilities or /vulnerabilities for the report as a file, with the filters of the request. /repos/{id}/vulnerabilities also takes the filters of the host's table: q, severity, fix (for example tuxcare, none), and triage.
curl -fsS -H "$H" -OJ "$B/repos/6/vulnerabilities?format=xlsx&severity=critical,high"
# one line per CVE with the names of its hosts
curl -fsS -H "$H" "$B/vulnerabilities?severity=critical&kind=host" \
| jq -r '.[] | [.advisory, .severity, ([.assets[].name] | join(","))] | @tsv'
When the portal refuses a request #
| Answer | Cause | What to do |
|---|---|---|
403 this token cannot use the api channel(or cli, mcp) | The token does not have that channel in its rights. | Make a token with a preset for that channel. |
403 API access is off for this workspace(or MCP) | The switch of the channel is off. | Ask an admin to turn it on. |
403 this token cannot read(or submit, write) | The token does not have the permission, or the role of its user does not have it. | Make a token with the permission. A viewer can only read. |
403 this token does not allow requests froman address | The token has a list of allowed addresses, and the request came from another address. | Send the request from an allowed network, or change the list of the token. |
403 this workspace does not allow requests froman address | The workspace has a list of allowed addresses for the API and MCP, and the request came from another address. | Ask an admin to add the network under API and MCP access. |
404 no such route | The path is wrong, or the channel is not available for your workspace. | Check the path in the OpenAPI document. Contact TuxCare if the channel is not available. |
An AI assistant shows a 401, 403, or 404 as a connection error.
Next: Troubleshooting