API Keys
API keys provide programmatic access to the TridentStack Control API. Use API keys to integrate TridentStack Control with external tools, scripts, and automation workflows.
Generating a Key
- Navigate to Settings > API Keys.
- Click Generate Key.
- Enter a descriptive name for the key (e.g., "CI/CD Pipeline", "Monitoring Integration", "SIEM Export").
- If your account manages Organizations, choose the key's Organization access: All Organizations or Selected Organizations. See Limiting a key to some Organizations.
- Click Create.
The full API key is displayed once at creation. Copy it immediately and store it in a secure location.
Treat API keys like passwords. Do not commit them to version control or share them in plaintext. Use environment variables or a secrets manager.
Key Format
API keys use the format keyId.secretKey:
abc123def456.dc16834b217de9a4f3b2c1e8...
The keyId portion identifies the key in audit logs and the API Keys settings page. The secretKey portion is the secret used for authentication.
Using the Key
Include the API key in the X-API-Key header of your HTTP requests:
curl -H "X-API-Key: your-api-key-here" \
https://control.tridentstack.com/api/agents
All API responses are JSON. Successful requests return a 2xx status code. Error responses include a message describing the issue.
Working in your Organizations
If your account manages Organizations, an API key can work inside them. A key never reaches more than the person who created it can see. If that person can see only some Organizations, the key is limited to those, whatever its Organization access says.
List the Organizations the key can reach, then send the Organization's id in the X-Tenant-Id header:
curl -H "X-API-Key: your-api-key-here" \
https://control.tridentstack.com/api/clients
curl -H "X-API-Key: your-api-key-here" \
-H "X-Tenant-Id: organization-id-here" \
https://control.tridentstack.com/api/agents
The key's access follows its creator and is checked on every request:
- If the creator loses access to an Organization, requests for that Organization return
404. - If the creator is deactivated or removed, the key can no longer work inside any of your Organizations, and requests return
403with a message that begins "This API key cannot act in another Organization." Create a new key under an active administrator to restore access.
Requests without X-Tenant-Id keep working on your main account as before.
Endpoints enrolled into an Organization belong to that Organization, not to your main account. A request to /api/agents without X-Tenant-Id lists only the endpoints on your main account, so it can return none even though your license summary counts every endpoint you pay for. Each endpoint in GET /api/licensing/summary?withAgents=true carries an organizationId: send it as X-Tenant-Id to read or remove that endpoint.
Limiting a key to some Organizations
Each key has an Organization access setting, chosen when you create it:
- All Organizations: every Organization the creator can see, including ones added later.
- Selected Organizations: only the Organizations you pick. Use this for an integration that serves one customer, so the key cannot read any other customer's endpoints.
A request for an Organization outside the key's access returns 404, the same answer as an Organization that does not exist. /api/clients lists only the Organizations the key can reach.
To change a key's access, open Settings > API Keys and click the building icon on the key's row (Edit Organization access). The key keeps working with the same secret, so you do not need to rotate it. Narrowing takes effect on the key's next request. Giving a key more access asks you to sign in again. Every change is recorded in the audit log.
If you can see only some of your Organizations, you can add or remove only those on a key, and you cannot switch a key between All and Selected while it reaches Organizations you cannot see.
Rate limits
API requests are rate limited. Before you build an integration that polls the API, read API Rate Limits and Efficient Polling for how to read the rate limit headers, handle a 429 response, and get the data you need in fewer requests.
Available Endpoints
For the complete API reference with all endpoints, request/response schemas, and interactive examples, see the API Reference.
Here are a few commonly used endpoints to get started:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/agents | List all agents with pagination |
GET | /api/agents/:id | Get detailed information for a specific agent |
POST | /api/agents/:id/collect-logs | Trigger log collection from an agent |
Privileged keys
A privileged API key can install updates, reboot, remove endpoints, and finish feature upgrades in bulk. It can also advance deployment ring rollouts and deploy policy objects through the API. Other API keys cannot perform these actions.
Anyone who has a privileged key can use these capabilities. Store it in a secrets manager, set an expiry, and grant this access only to automation that needs it. When you enable privileged access, TridentStack Control asks you to verify your identity again.
Existing API keys are not privileged. You can enable privileged access when creating a key or by editing an existing key. Learn more about when TridentStack Control makes you authenticate.
Custom Scripts scopes
Full access does not include Custom Scripts. Add these scopes to give a key script access:
| Scope | What it allows |
|---|---|
script_runs:read | Read scripts and runs |
script_output:read | Read run output |
script_runs:execute | Run scripts that allow API runs. The key must also be privileged. |
script_drafts:write | Write script drafts for a signed-in person to publish. The key must also be privileged. |
Existing keys get no Custom Scripts access until you add these scopes. Keep script read and output access limited to the integrations that need it. See Using Custom Scripts from the API for script privacy and publishing behavior.
Endpoint Checks scope
Full access keys can already read Endpoint Checks policies and results. Add endpoint_checks:read to also see each policy's linked remediation script and tag names, or to give a key Endpoint Checks access without full access.
| Scope | What it allows |
|---|---|
endpoint_checks:read | Read check policies and results, including each policy's remediation script and tag names |
endpoint_checks:write | Create and edit check policies, including their tags. Privileged keys only |
endpoint_checks:write can only be added to a privileged key, and removing privileged from a key removes it. Every create or edit made with it is recorded in the audit log. Keys cannot delete check policies. To change where a check policy's remediation script runs (for example by adding a tag), the key also needs script_runs:execute, and your script approval settings still apply.
See Using Endpoint Checks from the API.
Revoking Keys
To revoke an API key:
- Navigate to Settings > API Keys.
- Find the key by name and click Revoke.
- Confirm the action.
Revocation is immediate. Any request using the revoked key will receive a 401 Unauthorized response. Revoked keys cannot be restored. If access is needed again, generate a new key.
Create separate API keys for each integration. This makes it easy to revoke access for a single integration without affecting others.
Best Practices
- Name keys descriptively. Use names that identify the integration or automation using the key (e.g., "Splunk SIEM Export" rather than "Key 1").
- Rotate keys periodically. Generate a new key, update the integration, then revoke the old key.
- Use environment variables. Store keys in environment variables or a secrets manager rather than hardcoding them in scripts.
- Audit key usage. Review the System Audit log to monitor which keys are being used and how frequently.
- Limit key count. Only maintain active keys for integrations currently in use. Revoke keys for decommissioned integrations.