GebSecure Docs v0.1.0

Reference · SDKs

TypeScript SDK

@gebsecure01/sdk — installation, configuration, authentication, every client method, errors, retries and tracing.

@gebsecure01/sdk runs on Node.js ≥ 20, Deno, Bun, Cloudflare Workers and other runtimes with fetch and WebCrypto. It has no runtime dependencies and ships ESM and CommonJS builds with type declarations.

bash
npm install @gebsecure01/sdk

Configuration#

new GebSecure(options?):

Option Default Notes
gatewayUrl GEBSECURE_GATEWAY_URL or https://gateway.gebsecure.com data plane
apiUrl GEBSECURE_API_URL or https://api.gebsecure.com control plane and token endpoint
tokenUrl {apiUrl}/v1/auth/token
auth / apiKey GEBSECURE_API_KEY, then GEBSECURE_CLIENT_SECRET a token provider (below); without credentials the constructor throws ConfigurationError
maxRetries 3 0 disables retries and automatic idempotency keys
timeoutMs 30000 per attempt
baseDelayMs / maxDelayMs 500 / 8000 equal-jitter exponential backoff
maxRetryAfterMs 60000 a longer Retry-After is raised immediately
fetch, clock, random globals injection points for tests and custom transports
userAgent, headers extra request headers

Every method takes RequestOptions as its last argument: { signal, traceparent, timeoutMs, maxRetries, headers, idempotencyKey }.

Authentication#

Token providers exported by the SDK (extracted from sdks/typescript/src/auth.ts):

Function Description
unauthenticated(): TokenProvider No credentials (conformance §2): for login() / refreshSession() before a token exists. Every other call fails with ConfigurationError before sending a request.
apiKey(key: string): TokenProvider API key (gsk_…), sent directly as the Bearer token.
staticToken(token: string): TokenProvider A pre-obtained access token (not refreshed).
clientSecret(options: ClientSecretOptions): TokenProvider OAuth 2.0 client credentials with a client secret (gsa_…).
base64url(data: Uint8Array | string): string
inferAlgorithm(key: string | JsonWebKey): JwtAlgorithm Infers the JWS algorithm of a private key.
importSigningKey(key: string | JsonWebKey, alg: JwtAlgorithm): Promise<CryptoKey> Imports a PKCS#8 PEM or private JWK as a WebCrypto signing key.
createClientAssertion(args: { credentialId: string; audience: string; algorithm: JwtAlgorithm; sign: AssertionSigner; nowMs: number; lifetimeSeconds?: number; }): Promise<string> Creates a signed client assertion JWT (RFC 7523). Exposed for custom integrations and tests.
privateKeyJwt(options: PrivateKeyJwtOptions): TokenProvider OAuth 2.0 client credentials with private_key_jwt (Ed25519 / ES256 / RS256).
delegation(options: DelegationOptions): TokenProvider Exchanges a delegation token for an access token acting on behalf of the delegator.
  • OAuth tokens are cached and refreshed min(60 s, expires_in/2) before expiry; concurrent calls share one token request. A 401 with a cached token triggers one transparent re-authentication.
  • privateKeyJwt signs RFC 7523 assertions with WebCrypto: iss = sub = kid = credentialId, aud = {apiUrl}/v1/auth/token (override with audience), 60 s lifetime (at most 300), a unique jti per attempt. Keys: PKCS#8 PEM, a private JWK, a CryptoKey, or a custom signer (KMS/HSM).
  • gs.withDelegation(gsdToken) returns a client that exchanges the delegation token with the current client's credentials as the actor.
sdks/typescript/examples/private-key-jwt.ts
/**
 * Agent authentication with private_key_jwt: GebSecure stores only the public key.
 *   GEBSECURE_CREDENTIAL_ID=cred_… GEBSECURE_PRIVATE_KEY_FILE=agent.pem npx tsx sdks/typescript/examples/private-key-jwt.ts
 *
 * Create a key:   openssl genpkey -algorithm ed25519 -out agent.pem
 * Public JWK:     node -e "console.log(JSON.stringify(require('crypto').createPublicKey(require('fs').readFileSync('agent.pem')).export({format:'jwk'})))"
 * Register it:    POST /v1/agents/{id}/credentials {"type":"public_key","publicJwk":{…}}
 */
import { readFileSync } from 'node:fs';
import { GebSecure, privateKeyJwt } from '@gebsecure01/sdk';

const gs = new GebSecure({
  auth: privateKeyJwt({
    credentialId: process.env.GEBSECURE_CREDENTIAL_ID!,
    privateKey: readFileSync(process.env.GEBSECURE_PRIVATE_KEY_FILE ?? 'agent.pem', 'utf8'), // Ed25519, P-256 or RSA (PKCS#8)
    scope: 'authorize execute',
  }),
});

// Tokens are fetched lazily, cached, and refreshed before expiry; concurrent calls share one request.
const decision = await gs.authorize({ action: 'tickets:read', resource: 'zendesk:ticket/42', dryRun: true });
console.log(decision.decision, decision.reason);

Usage#

Authorize, then act — and handle an approval by re-authorizing with its id:

sdks/typescript/examples/authorize-then-act.ts
/**
 * Authorize-then-act: the agent performs the action itself, but only after GebSecure allows it.
 *   GEBSECURE_API_KEY=gsk_… npx tsx sdks/typescript/examples/authorize-then-act.ts
 */
import { GebSecure, PolicyDeniedError } from '@gebsecure01/sdk';

const gs = new GebSecure(); // reads GEBSECURE_API_KEY / GEBSECURE_GATEWAY_URL / GEBSECURE_API_URL

async function refund(chargeId: string, amount: number) {
  const { allowed, decision } = await gs.guard('refunds:create', `stripe:charge/${chargeId}`, { amount, currency: 'USD' });

  if (decision.decision === 'APPROVAL_REQUIRED') {
    console.log(`Needs human approval: ${decision.approval?.url}`);
    const approval = await gs.waitForApproval(decision.approval!.id, { timeoutMs: 15 * 60_000 });
    if (approval.status !== 'approved') throw new PolicyDeniedError({ status: 403, code: 'policy_denied', detail: `Approval ${approval.status}` });
    // Re-authorize with the approval id: consumes the approval (it is bound to this exact action).
    const retry = await gs.authorize({ action: 'refunds:create', resource: `stripe:charge/${chargeId}`, context: { amount, currency: 'USD' }, approvalId: approval.id });
    if (retry.decision !== 'ALLOW') throw new Error(`Still not allowed: ${retry.reason}`);
  } else if (!allowed) {
    console.log(`Denied (risk ${decision.risk.score}/${decision.risk.level}): ${decision.reason}`);
    return;
  }

  console.log(`Allowed by ${decision.explanation?.grantingPolicyId}; performing refund…`);
  // … call your payment provider here …
}

await refund('ch_123', 250);

Inspect untrusted content and report the agent's own spans:

sdks/typescript/examples/inspect-and-trace.ts
/**
 * Inspect untrusted content before the model reads it, and report the agent's own spans (planning,
 * LLM calls) into the GebSecure trace so they show up next to the platform's authorization spans.
 *   GEBSECURE_CLIENT_SECRET=gsa_… npx tsx sdks/typescript/examples/inspect-and-trace.ts
 */
import { randomBytes } from 'node:crypto';
import { buildSpan, GebSecure, traceparentOf } from '@gebsecure01/sdk';

const gs = new GebSecure(); // agent credentials from GEBSECURE_CLIENT_SECRET (or GEBSECURE_API_KEY)

// One trace for this task; every SDK call made with it lands in the same trace.
const traceparent = `00-${randomBytes(16).toString('hex')}-${randomBytes(8).toString('hex')}-01`;

const page = await fetch('https://example.com/').then((r) => r.text());
const started = Date.now();
const inspected = await gs.inspect({ content: page, source: 'web', origin: 'https://example.com/' }, { traceparent });
if (inspected.action === 'BLOCK' || inspected.content === null) throw new Error(`Content blocked: injection ${inspected.injection.level} (${inspected.injection.score})`);
console.log(`injection ${inspected.injection.level} (${inspected.injection.score}), action ${inspected.action}`);

// … hand `inspected.content` (sanitized/masked) to the model instead of `page` …
const plan = buildSpan('llm.plan', started, Date.now(), { traceparent, attributes: { model: 'planner', inputChars: page.length }, status: 'ok' });

// Calls made "inside" the planning span become its children.
const decision = await gs.authorize({ action: 'web:summaries.publish', resource: 'web:page/example.com', dryRun: true }, { traceparent: traceparentOf(plan) });
console.log(`decision ${decision.decision}`);

const { accepted, rejected } = await gs.reportSpans([plan]);
console.log(`spans accepted=${accepted} rejected=${rejected}; trace ${plan.traceId}`);

A complete agent, including brokered execution and approvals, is the TypeScript example application; policy-as-code with login, tests, simulation and deploy is in Policy lifecycle.

Errors#

All errors extend GebSecureError and expose status (0 for client-side errors), code, detail, requestId, traceId, details and type. The classes, extracted from sdks/typescript/src/errors.ts:

Error Description
GebSecureError Base class of every error raised by the SDK.
ApiError An error returned by the GebSecure API (RFC 9457 problem+json). Unknown codes use this class.
AuthenticationError 401 unauthenticated: missing, invalid, expired or revoked credentials.
PermissionDeniedError 403 forbidden: the principal lacks a permission or scope.
PolicyDeniedError 403 policy_denied: a policy denied the action.
ApprovalRequiredError 403 approval_required: the action requires human approval.
ValidationError 400 bad_request / 422 validation_failed.
NotFoundError 404 not_found.
ConflictError 409 conflict / 412 precondition_failed.
UpstreamError 502 upstream_error.
TimeoutError 504 timeout, or a client-side per-attempt timeout (status 0).
UnavailableError 503 unavailable.
InternalError 500 internal and unknown 5xx.
RateLimitError 429 rate_limited / quota_exceeded.
ConnectionError The request could not be delivered (DNS, connection refused/reset, TLS).
ApprovalTimeoutError waitForApproval deadline passed while the approval was still pending.
ApprovalNotGrantedError executeWithApproval: the approval ended rejected, expired or cancelled (not approved/consumed).
SimulationFailedError runSimulation({ failOnMismatch: true }): the run failed or errored and the server answered 422 with the full run, available as run (conformance §4).
ConfigurationError Invalid SDK configuration (e.g. an unsupported key or an assertion lifetime above 300 s).

Codes map to classes as in the error reference; unknown codes become ApiError (or InternalError for 5xx).

Retries and idempotency#

  • 429 is retried for every request, honouring Retry-After; 502/503/504, network errors and timeouts only for idempotent requests: GETs, PUTs and DELETEs (except updatePolicy, which appends a version), token requests, dryRun authorizations and DLP scans, span reports, cancellations, evaluation-only calls (validate, simulate, test runs, audit verify, health checks) and execute with an idempotencyKey.
  • PATCH and other POSTs are retried on 5xx/network errors only with { idempotencyKey } (sent as Idempotency-Key) — you assert the call is safe to repeat.
  • With retries enabled, execute() adds an idempotencyKey (sdk-<uuid>) when you don't pass one, so a retried execution never runs twice. A 502/504 whose body is an ExecuteResult is returned, not retried.
  • Cancel any call with an AbortSignal; in-flight requests and backoff sleeps stop immediately.

Tracing#

Each call sends a W3C traceparent; pass { traceparent } to join your trace (retries keep the trace id). Errors carry the server's requestId and traceId. buildSpan(name, start, end, { traceparent }) creates a child span of the current one, traceparentOf(span) propagates it, and reportSpans() sends the spans to the gateway.

Methods#

80 public methods of GebSecure, extracted from the SDK source at build time.

Client#

constructor#

typescript
new GebSecure(options: GebSecureOptions = {})

GebSecure client. Data-plane calls go to the gateway, control-plane calls and token requests to the API. All methods accept RequestOptions (AbortSignal, traceparent, timeout, retries).

Source: sdks/typescript/src/client.ts:199

withDelegation#

typescript
withDelegation(subjectToken: string, opts: { scope?: string } = {}): GebSecure

A client with the same configuration acting under a delegation token (RFC 8693 exchange).

Source: sdks/typescript/src/client.ts:231

getAccessToken#

typescript
getAccessToken(opts: RequestOptions = {}): Promise<string>

Returns a valid access token (cached/refreshed), e.g. to call GebSecure APIs not wrapped by the SDK.

Source: sdks/typescript/src/client.ts:236

Decisions#

authorize#

typescript
authorize(request: AuthorizeRequest, opts?: RequestOptions): Promise<AuthorizeResult>

Decides whether the principal may perform an action. DENY / APPROVAL_REQUIRED are results, not errors. — POST {gateway}/v1/authorize

Source: sdks/typescript/src/client.ts:256

authorizeBatch#

typescript
authorizeBatch(request: AuthorizeBatchRequest, opts?: RequestOptions): Promise<AuthorizeBatchResult>

Evaluates up to 100 requests in one call. — POST {gateway}/v1/authorize/batch

Source: sdks/typescript/src/client.ts:261

guard#

typescript
async guard(action: string, resource: string, context?: Record<string, unknown>, opts?: RequestOptions & Partial<AuthorizeRequest>): Promise<GuardResult>

Convenience around authorize: allowed is true only for ALLOW. Never throws on DENY.

Source: sdks/typescript/src/client.ts:267

Execution#

execute#

typescript
execute(request: ExecuteRequest, opts: RequestOptions = {}): Promise<ExecuteResult>

Authorizes and executes a connector action. Returns an ExecuteResult for succeeded, simulated, awaiting_approval, running, denied (HTTP 403) and failed (HTTP 502/504) outcomes; problem+json errors throw. With retries enabled, an idempotency key is generated when none is given. — POST {gateway}/v1/execute

Source: sdks/typescript/src/client.ts:279

getExecution#

typescript
getExecution(id: string, opts?: RequestOptions): Promise<Execution>

Execution status, result and step logs. — GET {gateway}/v1/executions/{id}

Source: sdks/typescript/src/client.ts:286

listExecutions#

typescript
listExecutions(params: ListExecutionsParams = {}, opts?: RequestOptions): Promise<ExecutionPage>

Lists executions visible to the caller. — GET {gateway}/v1/executions

Source: sdks/typescript/src/client.ts:291

cancelExecution#

typescript
cancelExecution(id: string, opts?: RequestOptions): Promise<CancelExecutionResult>

Cancels a pending, awaiting-approval or running execution. — POST {gateway}/v1/executions/{id}/cancel

Source: sdks/typescript/src/client.ts:296

Approvals#

getApproval#

typescript
getApproval(id: string, opts?: RequestOptions): Promise<Approval>

Status of an approval request (agent-facing, via the gateway). — GET {gateway}/v1/approvals/{id}

Source: sdks/typescript/src/client.ts:302

waitForApproval#

typescript
async waitForApproval(id: string, opts: WaitOptions = {}): Promise<Approval>

Polls an approval until it leaves pending; returns it in its terminal state.

Source: sdks/typescript/src/client.ts:307

executeWithApproval#

typescript
async executeWithApproval(request: ExecuteRequest, opts: WaitOptions = {}): Promise<ExecuteResult>

Executes; if human approval is required, waits for it and then follows the execution until it is terminal. Once the approval is granted the platform resumes the stored execution itself (and consumes the single-use approval), so this helper never re-executes (conformance §5). Throws ApprovalNotGrantedError when the approval is rejected/expired/cancelled, ApprovalTimeoutError when it stays pending past timeoutMs, and TimeoutError when the approved execution has not finished by then. A resumed execution that fails is returned with status: 'failed'.

Source: sdks/typescript/src/client.ts:327

Control plane#

listAgents#

typescript
listAgents(params: ListAgentsParams = {}, opts?: RequestOptions): Promise<AgentPage>

Agent directory. — GET {api}/v1/agents

Source: sdks/typescript/src/client.ts:362

getAgent#

typescript
getAgent(id: string, opts?: RequestOptions): Promise<Agent>

One agent, including credential metadata. — GET {api}/v1/agents/{id}

Source: sdks/typescript/src/client.ts:367

listPolicies#

typescript
listPolicies(params: ListPoliciesParams = {}, opts?: RequestOptions): Promise<PolicyList>

Policies. — GET {api}/v1/policies

Source: sdks/typescript/src/client.ts:372

listApprovals#

typescript
listApprovals(params: ListApprovalsParams = {}, opts?: RequestOptions): Promise<ApprovalPage>

Approval requests (inbox: true = those the caller can act on). — GET {api}/v1/approvals

Source: sdks/typescript/src/client.ts:377

createDelegation#

typescript
createDelegation(request: CreateDelegationRequest, opts?: RequestOptions): Promise<Delegation>

Delegates a subset of authority to another agent. The returned token (gsd_…) is shown once. — POST {api}/v1/delegations

Source: sdks/typescript/src/client.ts:382

Runtime: inspection, DLP, agent spans, simulation#

inspect#

typescript
inspect(request: InspectRequest, opts?: RequestOptions): Promise<InspectResult>

Inspects untrusted content (web page, email, RAG chunk, tool output) before the agent reads it: prompt-injection score/level/action, a sanitized form, and inbound DLP. Hand result.content (null when blocked) to the model instead of the original. — POST {gateway}/v1/inspect

Source: sdks/typescript/src/client.ts:392

dlpScan#

typescript
dlpScan(request: DlpScanRequest, opts?: RequestOptions): Promise<DlpScanResult>

Scans a payload for sensitive data and applies DLP rules. Retried like a read only when dryRun is true. — POST {gateway}/v1/dlp/scan

Source: sdks/typescript/src/client.ts:397

reportSpans#

typescript
reportSpans(spans: AgentSpan[] | ReportSpansRequest, opts?: RequestOptions): Promise<ReportSpansResult>

Reports agent-side spans (see buildSpan) into the shared trace. Safe to retry: duplicates are ignored. — POST {gateway}/v1/traces/spans

Source: sdks/typescript/src/client.ts:402

runSimulation#

typescript
runSimulation(request: SimulationRunRequest, opts?: RequestOptions): Promise<SimulationRun>

Runs simulation scenarios (nothing is executed). With failOnMismatch: true, a failed or errored run throws SimulationFailedError whose run is the full typed result. — POST {api}/v1/simulations/run

Source: sdks/typescript/src/client.ts:411

Session auth (users)#

login#

typescript
login(request: LoginRequest, opts?: RequestOptions): Promise<LoginResult>

Logs a user in (works on an unauthenticated() client). The refresh token is returned in the body. — POST {api}/v1/auth/login

Source: sdks/typescript/src/client.ts:417

refreshSession#

typescript
refreshSession(refreshToken: string, opts?: RequestOptions): Promise<SessionTokens>

Exchanges a refresh token for new tokens. The refresh token rotates: persist the returned one. Never retried (except 429). — POST {api}/v1/auth/refresh

Source: sdks/typescript/src/client.ts:422

logout#

typescript
logout(opts?: RequestOptions): Promise<void>

Revokes the current user session. — POST {api}/v1/auth/logout

Source: sdks/typescript/src/client.ts:427

me#

typescript
me(opts?: RequestOptions): Promise<Me>

The authenticated principal, its organizations and effective permissions. — GET {api}/v1/auth/me

Source: sdks/typescript/src/client.ts:432

Policies#

getPolicy#

typescript
getPolicy(id: string, opts?: RequestOptions): Promise<PolicyDetail>

A policy with its versions, latest version and tests. — GET {api}/v1/policies/{id}

Source: sdks/typescript/src/client.ts:438

createPolicy#

typescript
createPolicy(request: CreatePolicyRequest, opts?: RequestOptions): Promise<PolicyVersionResult>

Creates a policy (draft version 1) from GSL source or a template. — POST {api}/v1/policies

Source: sdks/typescript/src/client.ts:443

updatePolicy#

typescript
updatePolicy(id: string, request: UpdatePolicyRequest, opts?: RequestOptions): Promise<PolicyVersionResult>

Saves a new version. Not retried on 5xx/network errors: every call appends a version. — PUT {api}/v1/policies/{id}

Source: sdks/typescript/src/client.ts:448

deletePolicy#

typescript
deletePolicy(id: string, opts?: RequestOptions): Promise<void>

Archives a policy (stops enforcing it). — DELETE {api}/v1/policies/{id}

Source: sdks/typescript/src/client.ts:453

validatePolicy#

typescript
validatePolicy(source: string, opts?: RequestOptions): Promise<PolicyValidation>

Validates, lints and formats GSL source. — POST {api}/v1/policies/validate

Source: sdks/typescript/src/client.ts:458

getPolicyVersion#

typescript
getPolicyVersion(id: string, versionId: string, opts?: RequestOptions): Promise<PolicyVersion>

One immutable policy version. — GET {api}/v1/policies/{id}/versions/{versionId}

Source: sdks/typescript/src/client.ts:463

diffPolicyVersions#

typescript
diffPolicyVersions(id: string, from: string, to: string, opts?: RequestOptions): Promise<PolicyDiff>

Semantic and unified diff between two versions. — GET {api}/v1/policies/{id}/diff

Source: sdks/typescript/src/client.ts:468

listPolicyDeployments#

typescript
listPolicyDeployments(id: string, opts?: RequestOptions): Promise<PolicyDeploymentList>

Deploy and rollback history. — GET {api}/v1/policies/{id}/deployments

Source: sdks/typescript/src/client.ts:473

deployPolicy#

typescript
deployPolicy(id: string, request: DeployPolicyRequest = {}, opts?: RequestOptions): Promise<PolicyDeployResult>

Deploys a version (default: latest). When tests fail or blocking conflicts exist the server answers 412 with the deploy report; it is returned as a result with deployed: false. — POST {api}/v1/policies/{id}/deploy

Source: sdks/typescript/src/client.ts:481

rollbackPolicy#

typescript
rollbackPolicy(id: string, request: RollbackPolicyRequest = {}, opts?: RequestOptions): Promise<PolicyRollbackResult>

Rolls back to a version (default: the previously deployed one). — POST {api}/v1/policies/{id}/rollback

Source: sdks/typescript/src/client.ts:486

addPolicyTest#

typescript
addPolicyTest(id: string, test: PolicyTestCase, opts?: RequestOptions): Promise<PolicyTest>

Adds one test case. — POST {api}/v1/policies/{id}/tests

Source: sdks/typescript/src/client.ts:491

replacePolicyTests#

typescript
replacePolicyTests(id: string, tests: PolicyTestCase[], opts?: RequestOptions): Promise<PolicyTestList>

Replaces the whole test suite atomically (policy-as-code sync). — PUT {api}/v1/policies/{id}/tests

Source: sdks/typescript/src/client.ts:496

deletePolicyTest#

typescript
deletePolicyTest(id: string, testId: string, opts?: RequestOptions): Promise<void>

Deletes one test case. — DELETE {api}/v1/policies/{id}/tests/{testId}

Source: sdks/typescript/src/client.ts:501

runPolicyTests#

typescript
runPolicyTests(id: string, versionId?: string, opts?: RequestOptions): Promise<PolicyTestRun>

Runs the policy's tests against a version (default: latest). — POST {api}/v1/policies/{id}/tests/run

Source: sdks/typescript/src/client.ts:506

simulatePolicies#

typescript
simulatePolicies(request: PolicySimulateRequest, opts?: RequestOptions): Promise<PolicySimulation>

Evaluates requests against deployed vs candidate policies. — POST {api}/v1/policies/simulate

Source: sdks/typescript/src/client.ts:511

Agents & credentials#

createAgent#

typescript
createAgent(request: RegisterAgentRequest, opts?: RequestOptions): Promise<RegisteredAgent>

Registers an agent; with credential, its client secret is returned once in credential.clientSecret. — POST {api}/v1/agents

Source: sdks/typescript/src/client.ts:517

updateAgent#

typescript
updateAgent(id: string, request: UpdateAgentRequest, opts?: RequestOptions): Promise<Agent>

Updates agent metadata. — PATCH {api}/v1/agents/{id}

Source: sdks/typescript/src/client.ts:522

setAgentStatus#

typescript
setAgentStatus(id: string, request: AgentStatusRequest, opts?: RequestOptions): Promise<Agent>

Activates, suspends, disables or quarantines an agent. — POST {api}/v1/agents/{id}/status

Source: sdks/typescript/src/client.ts:527

deleteAgent#

typescript
deleteAgent(id: string, opts?: RequestOptions): Promise<void>

Deletes an agent. — DELETE {api}/v1/agents/{id}

Source: sdks/typescript/src/client.ts:532

listAgentCredentials#

typescript
listAgentCredentials(id: string, opts?: RequestOptions): Promise<AgentCredentialList>

Credential metadata of an agent (never secrets). — GET {api}/v1/agents/{id}/credentials

Source: sdks/typescript/src/client.ts:537

createAgentCredential#

typescript
createAgentCredential(id: string, request: CreateCredentialRequest = {}, opts?: RequestOptions): Promise<IssuedCredential>

Issues an agent credential; the client secret is returned once. — POST {api}/v1/agents/{id}/credentials

Source: sdks/typescript/src/client.ts:542

rotateCredential#

typescript
rotateCredential(credentialId: string, request: RotateCredentialRequest = {}, opts?: RequestOptions): Promise<RotatedCredential>

Rotates a credential; the previous one keeps working until previous.graceUntil. — POST {api}/v1/credentials/{id}/rotate

Source: sdks/typescript/src/client.ts:547

revokeCredential#

typescript
revokeCredential(credentialId: string, reason?: string, opts?: RequestOptions): Promise<AgentCredential>

Revokes a credential immediately (idempotent). — POST {api}/v1/credentials/{id}/revoke

Source: sdks/typescript/src/client.ts:552

Secrets (values are write-only)#

createSecret#

typescript
createSecret(request: CreateSecretRequest, opts?: RequestOptions): Promise<CreatedSecret>

Stores a secret. The value is never returned by the API and never logged by the SDK. — POST {api}/v1/secrets

Source: sdks/typescript/src/client.ts:558

listSecrets#

typescript
listSecrets(params: ListSecretsParams = {}, opts?: RequestOptions): Promise<SecretList>

Secret metadata and masks. — GET {api}/v1/secrets

Source: sdks/typescript/src/client.ts:563

getSecret#

typescript
getSecret(id: string, opts?: RequestOptions): Promise<Secret>

One secret's metadata and version history (never the value). — GET {api}/v1/secrets/{id}

Source: sdks/typescript/src/client.ts:568

updateSecret#

typescript
updateSecret(id: string, request: UpdateSecretRequest, opts?: RequestOptions): Promise<Secret>

Updates secret metadata, access policy, expiry, rotation policy or status. — PATCH {api}/v1/secrets/{id}

Source: sdks/typescript/src/client.ts:573

rotateSecret#

typescript
rotateSecret(id: string, request: RotateSecretRequest, opts?: RequestOptions): Promise<RotatedSecret>

Writes a new version (a value, or generate). — POST {api}/v1/secrets/{id}/rotate

Source: sdks/typescript/src/client.ts:578

revokeSecret#

typescript
revokeSecret(id: string, request: RevokeSecretRequest = {}, opts?: RequestOptions): Promise<RevokeSecretResult>

Revokes one version or the whole secret. — POST {api}/v1/secrets/{id}/revoke

Source: sdks/typescript/src/client.ts:583

deleteSecret#

typescript
deleteSecret(id: string, opts?: RequestOptions): Promise<void>

Deletes a secret. — DELETE {api}/v1/secrets/{id}

Source: sdks/typescript/src/client.ts:588

Connectors & connections#

listConnectors#

typescript
listConnectors(opts?: RequestOptions): Promise<ConnectorList>

The connector catalog (actions, schemas, risk metadata, auth methods). — GET {api}/v1/connectors

Source: sdks/typescript/src/client.ts:594

getConnector#

typescript
getConnector(key: string, opts?: RequestOptions): Promise<Connector>

One connector of the catalog. — GET {api}/v1/connectors/{key}

Source: sdks/typescript/src/client.ts:599

listConnections#

typescript
listConnections(params: ListConnectionsParams = {}, opts?: RequestOptions): Promise<ConnectionList>

Installed connections. — GET {api}/v1/connections

Source: sdks/typescript/src/client.ts:604

getConnection#

typescript
getConnection(id: string, opts?: RequestOptions): Promise<Connection>

One connection with its connector description and effective allowed hosts. — GET {api}/v1/connections/{id}

Source: sdks/typescript/src/client.ts:609

createConnection#

typescript
createConnection(request: CreateConnectionRequest, opts?: RequestOptions): Promise<Connection>

Installs a connector into a project. — POST {api}/v1/connections

Source: sdks/typescript/src/client.ts:614

updateConnection#

typescript
updateConnection(id: string, request: UpdateConnectionRequest, opts?: RequestOptions): Promise<Connection>

Updates a connection. — PATCH {api}/v1/connections/{id}

Source: sdks/typescript/src/client.ts:619

deleteConnection#

typescript
deleteConnection(id: string, opts?: RequestOptions): Promise<void>

Deletes a connection. — DELETE {api}/v1/connections/{id}

Source: sdks/typescript/src/client.ts:624

checkConnectionHealth#

typescript
checkConnectionHealth(id: string, opts?: RequestOptions): Promise<ConnectionHealth>

Runs the connection health check. — POST {api}/v1/connections/{id}/health

Source: sdks/typescript/src/client.ts:629

startConnectionOAuth#

typescript
startConnectionOAuth(id: string, request: OAuthStartRequest, opts?: RequestOptions): Promise<OAuthStartResult>

Begins an OAuth installation (authorization code + PKCE); redirect the user to authorizationUrl. — POST {api}/v1/connections/{id}/oauth/start

Source: sdks/typescript/src/client.ts:634

completeConnectionOAuth#

typescript
completeConnectionOAuth(request: OAuthCallbackRequest, opts?: RequestOptions): Promise<OAuthInstallResult>

Completes an OAuth installation with the state and code from the redirect. — POST {api}/v1/connections/oauth/callback

Source: sdks/typescript/src/client.ts:639

installClientCredentials#

typescript
installClientCredentials(id: string, request: ClientCredentialsInstallRequest, opts?: RequestOptions): Promise<OAuthInstallResult>

Installs with the OAuth client-credentials grant (machine-to-machine). — POST {api}/v1/connections/{id}/oauth/client-credentials

Source: sdks/typescript/src/client.ts:644

installJwtBearer#

typescript
installJwtBearer(id: string, request: JwtBearerInstallRequest, opts?: RequestOptions): Promise<OAuthInstallResult>

Installs with the RFC 7523 JWT-bearer grant (e.g. a Google service account). — POST {api}/v1/connections/{id}/oauth/jwt-bearer

Source: sdks/typescript/src/client.ts:649

Audit#

searchAudit#

typescript
searchAudit(params: AuditSearchParams = {}, opts?: RequestOptions): Promise<AuditPage>

Searches audit events (newest first); with afterSeq, tails the events after that sequence number (oldest first). — GET {api}/v1/audit/events

Source: sdks/typescript/src/client.ts:655

getAuditEvent#

typescript
getAuditEvent(id: string, opts?: RequestOptions): Promise<AuditEvent>

One audit event. — GET {api}/v1/audit/events/{id}

Source: sdks/typescript/src/client.ts:660

exportAudit#

typescript
exportAudit(params: AuditExportParams = {}, opts?: RequestOptions): Promise<string>

Exports audit events; resolves to the raw body (ndjson by default, csv or json). — GET {api}/v1/audit/export

Source: sdks/typescript/src/client.ts:665

verifyAudit#

typescript
verifyAudit(request: VerifyAuditRequest = {}, opts?: RequestOptions): Promise<AuditVerification>

Verifies the integrity of the audit hash chain. — POST {api}/v1/audit/verify

Source: sdks/typescript/src/client.ts:670

Approvals (reviewers)#

getApprovalDetails#

typescript
getApprovalDetails(id: string, opts?: RequestOptions): Promise<Approval>

Full approval record (control plane): steps, decisions, comments, history and canDecide. — GET {api}/v1/approvals/{id}

Source: sdks/typescript/src/client.ts:676

decideApproval#

typescript
decideApproval(id: string, request: DecideApprovalRequest, opts?: RequestOptions): Promise<ApprovalDecisionResult>

Approves or rejects; snapshotHash must be the hash of the request snapshot the reviewer saw. — POST {api}/v1/approvals/{id}/decision

Source: sdks/typescript/src/client.ts:681

Alerts#

listAlerts#

typescript
listAlerts(params: ListAlertsParams = {}, opts?: RequestOptions): Promise<AlertPage>

Security alerts. — GET {api}/v1/alerts

Source: sdks/typescript/src/client.ts:687

getAlert#

typescript
getAlert(id: string, opts?: RequestOptions): Promise<Alert>

One alert with its investigation context. — GET {api}/v1/alerts/{id}

Source: sdks/typescript/src/client.ts:692

updateAlert#

typescript
updateAlert(id: string, request: UpdateAlertRequest, opts?: RequestOptions): Promise<Alert>

Acknowledges, assigns, annotates, resolves or dismisses an alert. — PATCH {api}/v1/alerts/{id}

Source: sdks/typescript/src/client.ts:697

Traces & session replay#

searchTraces#

typescript
searchTraces(params: TraceSearchParams = {}, opts?: RequestOptions): Promise<TraceSearchResult>

Searches traces. — GET {api}/v1/traces

Source: sdks/typescript/src/client.ts:703

getTrace#

typescript
getTrace(traceId: string, opts?: RequestOptions): Promise<Trace>

One trace: platform and agent spans, correlated records, timeline and performance breakdown. — GET {api}/v1/traces/{traceId}

Source: sdks/typescript/src/client.ts:708

replaySession#

typescript
replaySession(principalId: string, params: ReplayParams = {}, opts?: RequestOptions): Promise<SessionReplay>

Everything a principal (agent or user) did in a window, step by step. — GET {api}/v1/replay/{principalId}

Source: sdks/typescript/src/client.ts:713