Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trustware.io/llms.txt

Use this file to discover all available pages before exploring further.

GET https://api.trustware.io/api/v1/sdk/validate Verifies that an API key is active and returns metadata about the key. Use this at application startup to confirm your key is valid before making route requests, or as a lightweight connectivity check.

Request

No request body. Pass your API key in the X-API-Key header.
const response = await fetch("https://api.trustware.io/api/v1/sdk/validate", {
  headers: { "X-API-Key": process.env.TW_KEY },
});
const { valid, status, message } = (await response.json());

Response

{
  "valid": true,
  "status": "active",
  "message": "API key is valid and active",
  "key_id": "80fe6ff0-5320-4330-ad40-bb034a474e55",
  "label": "Trustware Swap",
  "project_id": "b7a4c5d1-9f3e-4b8a-a210-d2c44d3e6f80",
  "created_at": "2026-04-07T01:45:02.397093Z",
  "last_used_at": "2026-04-15T15:38:28.94439Z",
  "quote": {
    "id": "99",
    "text": "What about elevenses?"
  }
}
FieldDescription
validtrue if the key is active and authorized.
statusKey status: active or inactive.
messageHuman-readable validation message.
key_idUnique identifier for this key.
labelLabel assigned to this key when it was created.
project_idIdentifier of the project this key belongs to.
created_atWhen the key was created (ISO 8601).
last_used_atWhen the key was last used (ISO 8601). Useful for auditing.
quoteHeartbeat payload — a lightweight response included on every validate call.

Startup validation

Call this endpoint once at application startup to fail fast if the key is misconfigured:
async function validateKey() {
  const res = await fetch("https://api.trustware.io/api/v1/sdk/validate", {
    headers: { "X-API-Key": process.env.TW_KEY },
  });
  if (!res.ok) throw new Error("Trustware API key validation failed");
  const { valid, message } = await res.json();
  if (!valid) throw new Error(`Trustware key invalid: ${message}`);
}