Appearance
Function: createApiClient()
ts
function createApiClient(options): object;Builds a typed client for the Aletheia API. Methods throw ApiError on non-2xx responses.
Parameters
options
Returns
appCallbacks
ts
appCallbacks: object;Vendor sessions of apps awaiting or completed by webhook. See apps.ts.
appCallbacks.list
ts
list: (query) => Promise<Page<{
action: string;
appName: string;
completedAt?: Date | null;
createdAt: Date;
error?: string | null;
externalId: string;
id: string;
output?: unknown;
status: "failed" | "completed" | "pending" | "timed_out";
stepId?: string | null;
tenantId: string;
versionId: string;
workflowRunId?: string | null;
}>>;Parameters
query?
AppCallbackQuery = {}
Returns
Promise<Page<{ action: string; appName: string; completedAt?: Date | null; createdAt: Date; error?: string | null; externalId: string; id: string; output?: unknown; status: "failed" | "completed" | "pending" | "timed_out"; stepId?: string | null; tenantId: string; versionId: string; workflowRunId?: string | null; }>>
appInvocations
ts
appInvocations: object;Recorded app calls, filtered and paged. See apps.ts.
appInvocations.get
ts
get: (id) => Promise<{
action: string;
appName: string;
attempt: number;
durationMs: number;
error?: string | null;
id: string;
idempotencyKey?: string | null;
input: unknown;
invokedAt: Date;
output?: unknown;
status: "error" | "success" | "pending" | "timeout";
subjectId?: string | null;
tenantId: string;
usage?: | {
documentReads: number;
httpRequests: number;
logLines: number;
}
| null;
versionId: string;
workflowRunId?: string | null;
}>;Parameters
id
string
Returns
Promise<{ action: string; appName: string; attempt: number; durationMs: number; error?: string | null; id: string; idempotencyKey?: string | null; input: unknown; invokedAt: Date; output?: unknown; status: "error" | "success" | "pending" | "timeout"; subjectId?: string | null; tenantId: string; usage?: | { documentReads: number; httpRequests: number; logLines: number; } | null; versionId: string; workflowRunId?: string | null; }>
appInvocations.list
ts
list: (query) => Promise<object[]>;Parameters
query?
AppInvocationQuery = {}
Returns
Promise<object[]>
appInvocations.listPage
ts
listPage: (query) => Promise<Page<{
action: string;
appName: string;
attempt: number;
durationMs: number;
error?: string | null;
id: string;
idempotencyKey?: string | null;
input: unknown;
invokedAt: Date;
output?: unknown;
status: "error" | "success" | "pending" | "timeout";
subjectId?: string | null;
tenantId: string;
usage?: | {
documentReads: number;
httpRequests: number;
logLines: number;
}
| null;
versionId: string;
workflowRunId?: string | null;
}>>;One page of list with the number of matching invocations.
Parameters
query?
AppInvocationQuery = {}
Returns
Promise<Page<{ action: string; appName: string; attempt: number; durationMs: number; error?: string | null; id: string; idempotencyKey?: string | null; input: unknown; invokedAt: Date; output?: unknown; status: "error" | "success" | "pending" | "timeout"; subjectId?: string | null; tenantId: string; usage?: | { documentReads: number; httpRequests: number; logLines: number; } | null; versionId: string; workflowRunId?: string | null; }>>
apps
ts
apps: object;The app catalogue, versions and publish approvals, the tenant's installs, their secrets, test calls and health. See apps.ts.
apps.approvals
ts
approvals: (query) => Promise<Page<{
approval: {
comment: string | null;
decidedAt: Date | null;
decidedBy: string | null;
decision: "approved" | "rejected" | null;
decisionComment: string | null;
id: string;
requestedAt: Date;
requestedBy: string;
tenantId: string;
versionId: string;
};
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
}>>;Publish requests with their versions, open ones oldest first, with the total.
Parameters
query?
AppApprovalQuery = {}
Returns
Promise<Page<{ approval: { comment: string | null; decidedAt: Date | null; decidedBy: string | null; decision: "approved" | "rejected" | null; decisionComment: string | null; id: string; requestedAt: Date; requestedBy: string; tenantId: string; versionId: string; }; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; }>>
apps.approve
ts
approve: (name, versionId, body) => Promise<{
approval: | {
comment: string | null;
decidedAt: Date | null;
decidedBy: string | null;
decision: "approved" | "rejected" | null;
decisionComment: string | null;
id: string;
requestedAt: Date;
requestedBy: string;
tenantId: string;
versionId: string;
}
| null;
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
}>;Approves an open request and publishes the version; 403 four_eyes for its requester.
Parameters
name
string
versionId
string
body?
comment?
string
Returns
Promise<{ approval: | { comment: string | null; decidedAt: Date | null; decidedBy: string | null; decision: "approved" | "rejected" | null; decisionComment: string | null; id: string; requestedAt: Date; requestedBy: string; tenantId: string; versionId: string; } | null; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; }>
apps.get
ts
get: (name) => Promise<{
entry: {
install: | {
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
enabled: boolean;
hosts: string[];
id: string;
missingSecrets: string[];
name: string;
tenantId: string;
updateAvailable: boolean;
updatedAt: Date;
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: ... | ...;
webhook: boolean;
webhookExternalId?: ... | ... | ... | ...;
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
versionId: string;
}
| null;
latest: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
name: string;
publisher: "platform" | "tenant";
versions: number;
};
versions: object[];
}>;One app of the catalogue with every version the tenant sees, newest first.
Parameters
name
string
Returns
Promise<{ entry: { install: | { config: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; enabled: boolean; hosts: string[]; id: string; missingSecrets: string[]; name: string; tenantId: string; updateAvailable: boolean; updatedAt: Date; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: ... | ...; webhook: boolean; webhookExternalId?: ... | ... | ... | ...; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; versionId: string; } | null; latest: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; name: string; publisher: "platform" | "tenant"; versions: number; }; versions: object[]; }>
apps.health
ts
health: (query) => Promise<{
blocked: object[];
circuits: object[];
from: Date;
items: object[];
windowMinutes: number;
}>;Per app, its calls in the last windowMinutes; circuits the open or half-open circuits and blocked the installs running on a module the operator blocked.
Parameters
query?
AppHealthParams = {}
Returns
Promise<{ blocked: object[]; circuits: object[]; from: Date; items: object[]; windowMinutes: number; }>
apps.install
ts
install: (name, body) => Promise<{
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
enabled: boolean;
hosts: string[];
id: string;
missingSecrets: string[];
name: string;
tenantId: string;
updateAvailable: boolean;
updatedAt: Date;
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
versionId: string;
}>;Installs, configures or upgrades: one call for all three (apps:write). 409 app_not_configured (details.missingSecrets) when enabling with a secret missing.
Parameters
name
string
body
config?
Record<string, unknown>
enabled?
boolean
versionId
string
Returns
Promise<{ config: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; enabled: boolean; hosts: string[]; id: string; missingSecrets: string[]; name: string; tenantId: string; updateAvailable: boolean; updatedAt: Date; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; versionId: string; }>
apps.list
ts
list: () => Promise<object[]>;One entry per app the tenant can install, by name, with its install when it has one.
Returns
Promise<object[]>
apps.publish
ts
publish: (name, versionId) => Promise<{
approval: | {
comment: string | null;
decidedAt: Date | null;
decidedBy: string | null;
decision: "approved" | "rejected" | null;
decisionComment: string | null;
id: string;
requestedAt: Date;
requestedBy: string;
tenantId: string;
versionId: string;
}
| null;
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
}>;Publishes an uploaded version, or opens a publish request when the tenant requires approvals for apps: approval is then the open request (apps:publish).
Parameters
name
string
versionId
string
Returns
Promise<{ approval: | { comment: string | null; decidedAt: Date | null; decidedBy: string | null; decision: "approved" | "rejected" | null; decisionComment: string | null; id: string; requestedAt: Date; requestedBy: string; tenantId: string; versionId: string; } | null; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; }>
apps.reject
ts
reject: (name, versionId, body) => Promise<{
approval: | {
comment: string | null;
decidedAt: Date | null;
decidedBy: string | null;
decision: "approved" | "rejected" | null;
decisionComment: string | null;
id: string;
requestedAt: Date;
requestedBy: string;
tenantId: string;
versionId: string;
}
| null;
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
}>;Rejects an open request; the version stays uploaded and can be requested again.
Parameters
name
string
versionId
string
body?
comment?
string
Returns
Promise<{ approval: | { comment: string | null; decidedAt: Date | null; decidedBy: string | null; decision: "approved" | "rejected" | null; decisionComment: string | null; id: string; requestedAt: Date; requestedBy: string; tenantId: string; versionId: string; } | null; version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; }>
apps.revokeSecret
ts
revokeSecret: (name, secret) => Promise<void>;Deletes the stored value of secret; the install's missingSecrets names it again.
Parameters
name
string
secret
string
Returns
Promise<void>
apps.setSecret
ts
setSecret: (name, secret, value) => Promise<{
secret: string;
storedAt: Date;
}>;Seals value in the tenant's secret store for the install; the answer names the secret, never the value (apps:write).
Parameters
name
string
secret
string
value
string
Returns
Promise<{ secret: string; storedAt: Date; }>
apps.test
ts
test: (name, body) => Promise<{
durationMs: number;
error?: string;
externalId?: string;
output?: unknown;
status: "error" | "success" | "pending" | "timeout";
usage?: {
documentReads: number;
httpRequests: number;
logLines: number;
};
}>;Calls one action once with the install's configuration and secrets, enabled or not (apps:write); nothing is recorded but an app.tested audit event.
Parameters
name
string
body
action
string
input
unknown
Returns
Promise<{ durationMs: number; error?: string; externalId?: string; output?: unknown; status: "error" | "success" | "pending" | "timeout"; usage?: { documentReads: number; httpRequests: number; logLines: number; }; }>
apps.uninstall
ts
uninstall: (name, options) => Promise<void>;Removes the install and its secrets (apps:write). 409 app_in_use (details.pendingCallbacks) while runs wait on its callbacks, unless force.
Parameters
name
string
options?
UninstallAppOptions = {}
Returns
Promise<void>
apps.upload
ts
upload: (module) => Promise<{
version: {
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
};
}>;Uploads a module as a new uploaded version of one of the tenant's apps (apps:publish, 32 MiB at most); the answer carries the manifest the runner read from it.
Parameters
module
Returns
Promise<{ version: { actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }; }>
apps.usage
ts
usage: (name) => Promise<{
definitions: object[];
name: string;
}>;The published workflows and rules that call the app, with the actions they call.
Parameters
name
string
Returns
Promise<{ definitions: object[]; name: string; }>
apps.versions
ts
versions: (name) => Promise<object[]>;Parameters
name
string
Returns
Promise<object[]>
apps.withdraw
ts
withdraw: (name, versionId) => Promise<{
actions: object[];
capabilities: string[];
category?: string;
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
description?: string;
docsUrl?: string;
handles: {
handoff?: "sumsub";
webhook: boolean;
webhookExternalId?: | {
json: string;
}
| {
header: string;
}
| {
query: string;
};
};
hosts: string[];
id: string;
memoryMiB: number;
name: string;
needs: "documents"[];
pricingNote?: string;
publishedAt: Date | null;
publisher: "platform" | "tenant";
secrets: object[];
sha256: string;
sizeBytes: number;
status: "published" | "withdrawn" | "uploaded";
vendor?: string;
version: string;
}>;Withdraws one of the tenant's own versions: it keeps running where installed.
Parameters
name
string
versionId
string
Returns
Promise<{ actions: object[]; capabilities: string[]; category?: string; configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; description?: string; docsUrl?: string; handles: { handoff?: "sumsub"; webhook: boolean; webhookExternalId?: | { json: string; } | { header: string; } | { query: string; }; }; hosts: string[]; id: string; memoryMiB: number; name: string; needs: "documents"[]; pricingNote?: string; publishedAt: Date | null; publisher: "platform" | "tenant"; secrets: object[]; sha256: string; sizeBytes: number; status: "published" | "withdrawn" | "uploaded"; vendor?: string; version: string; }>
audit
ts
audit: AuditClient;Filtered audit trail (audit:read), exports (audit:export) and manifest verification. See audit.ts.
auditEvents
ts
auditEvents: object;Deprecated
Alias of audit, kept for existing callers.
auditEvents.list
ts
list: (query) => Promise<object[]>;Parameters
query?
AuditListQuery = {}
Returns
Promise<object[]>
auditExports
ts
auditExports: object;Scheduled audit exports, their runs and files. See audit-admin.ts.
auditExports.create
ts
create: (body) => Promise<{
createdAt: Date;
createdBy: string;
cron: string;
enabled: boolean;
filter: {
action?: string;
actorId?: string;
actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant";
resourceId?: string;
resourceType?: string;
};
format: "csv" | "jsonl";
id: string;
lastRun: | {
bytes: number | null;
error: string | null;
fileName: string | null;
finishedAt: Date | null;
id: string;
rows: number | null;
scheduleId: string;
sha256: string | null;
startedAt: Date;
status: "ok" | "failed" | "running";
windowFrom: Date;
windowTo: Date;
}
| null;
name: string;
nextRunAt: Date | null;
updatedAt: Date;
}>;Parameters
body
cron
string
enabled?
boolean
filter?
{ action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }
filter.action?
string
filter.actorId?
string
filter.actorType?
"app" | "workflow" | "user" | "system" | "service" | "applicant"
filter.resourceId?
string
filter.resourceType?
string
format?
"csv" | "jsonl"
name
string
Returns
Promise<{ createdAt: Date; createdBy: string; cron: string; enabled: boolean; filter: { action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }; format: "csv" | "jsonl"; id: string; lastRun: | { bytes: number | null; error: string | null; fileName: string | null; finishedAt: Date | null; id: string; rows: number | null; scheduleId: string; sha256: string | null; startedAt: Date; status: "ok" | "failed" | "running"; windowFrom: Date; windowTo: Date; } | null; name: string; nextRunAt: Date | null; updatedAt: Date; }>
auditExports.download
ts
download: (runId) => Promise<{
expiresAt: Date;
fileName: string;
url: string;
}>;A five-minute link to a run's file.
Parameters
runId
string
Returns
Promise<{ expiresAt: Date; fileName: string; url: string; }>
auditExports.get
ts
get: (id) => Promise<{
createdAt: Date;
createdBy: string;
cron: string;
enabled: boolean;
filter: {
action?: string;
actorId?: string;
actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant";
resourceId?: string;
resourceType?: string;
};
format: "csv" | "jsonl";
id: string;
lastRun: | {
bytes: number | null;
error: string | null;
fileName: string | null;
finishedAt: Date | null;
id: string;
rows: number | null;
scheduleId: string;
sha256: string | null;
startedAt: Date;
status: "ok" | "failed" | "running";
windowFrom: Date;
windowTo: Date;
}
| null;
name: string;
nextRunAt: Date | null;
updatedAt: Date;
}>;Parameters
id
string
Returns
Promise<{ createdAt: Date; createdBy: string; cron: string; enabled: boolean; filter: { action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }; format: "csv" | "jsonl"; id: string; lastRun: | { bytes: number | null; error: string | null; fileName: string | null; finishedAt: Date | null; id: string; rows: number | null; scheduleId: string; sha256: string | null; startedAt: Date; status: "ok" | "failed" | "running"; windowFrom: Date; windowTo: Date; } | null; name: string; nextRunAt: Date | null; updatedAt: Date; }>
auditExports.list
ts
list: () => Promise<Page<{
createdAt: Date;
createdBy: string;
cron: string;
enabled: boolean;
filter: {
action?: string;
actorId?: string;
actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant";
resourceId?: string;
resourceType?: string;
};
format: "csv" | "jsonl";
id: string;
lastRun: | {
bytes: number | null;
error: string | null;
fileName: string | null;
finishedAt: Date | null;
id: string;
rows: number | null;
scheduleId: string;
sha256: string | null;
startedAt: Date;
status: "ok" | "failed" | "running";
windowFrom: Date;
windowTo: Date;
}
| null;
name: string;
nextRunAt: Date | null;
updatedAt: Date;
}>>;Returns
Promise<Page<{ createdAt: Date; createdBy: string; cron: string; enabled: boolean; filter: { action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }; format: "csv" | "jsonl"; id: string; lastRun: | { bytes: number | null; error: string | null; fileName: string | null; finishedAt: Date | null; id: string; rows: number | null; scheduleId: string; sha256: string | null; startedAt: Date; status: "ok" | "failed" | "running"; windowFrom: Date; windowTo: Date; } | null; name: string; nextRunAt: Date | null; updatedAt: Date; }>>
auditExports.remove
ts
remove: (id) => Promise<void>;Parameters
id
string
Returns
Promise<void>
auditExports.runs
ts
runs: (id) => Promise<object[]>;Parameters
id
string
Returns
Promise<object[]>
auditExports.update
ts
update: (id, body) => Promise<{
createdAt: Date;
createdBy: string;
cron: string;
enabled: boolean;
filter: {
action?: string;
actorId?: string;
actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant";
resourceId?: string;
resourceType?: string;
};
format: "csv" | "jsonl";
id: string;
lastRun: | {
bytes: number | null;
error: string | null;
fileName: string | null;
finishedAt: Date | null;
id: string;
rows: number | null;
scheduleId: string;
sha256: string | null;
startedAt: Date;
status: "ok" | "failed" | "running";
windowFrom: Date;
windowTo: Date;
}
| null;
name: string;
nextRunAt: Date | null;
updatedAt: Date;
}>;Parameters
id
string
body
cron
string
enabled?
boolean
filter?
{ action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }
filter.action?
string
filter.actorId?
string
filter.actorType?
"app" | "workflow" | "user" | "system" | "service" | "applicant"
filter.resourceId?
string
filter.resourceType?
string
format?
"csv" | "jsonl"
name
string
Returns
Promise<{ createdAt: Date; createdBy: string; cron: string; enabled: boolean; filter: { action?: string; actorId?: string; actorType?: "app" | "workflow" | "user" | "system" | "service" | "applicant"; resourceId?: string; resourceType?: string; }; format: "csv" | "jsonl"; id: string; lastRun: | { bytes: number | null; error: string | null; fileName: string | null; finishedAt: Date | null; id: string; rows: number | null; scheduleId: string; sha256: string | null; startedAt: Date; status: "ok" | "failed" | "running"; windowFrom: Date; windowTo: Date; } | null; name: string; nextRunAt: Date | null; updatedAt: Date; }>
auditViews
ts
auditViews: object;The caller's saved audit-trail views. See audit-admin.ts.
auditViews.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
auditViews.remove
ts
remove: (id) => Promise<void>;Parameters
id
string
Returns
Promise<void>
auditViews.save
ts
save: (body) => Promise<{
createdAt: Date;
filters: {
action?: string;
actorId?: string;
actorType?: string;
from?: string;
resourceId?: string;
resourceType?: string;
to?: string;
};
id: string;
name: string;
}>;Saves the filters under name, replacing the caller's view of that name.
Parameters
body
filters
{ action?: string; actorId?: string; actorType?: string; from?: string; resourceId?: string; resourceType?: string; to?: string; }
filters.action?
string
filters.actorId?
string
filters.actorType?
string
filters.from?
string
filters.resourceId?
string
filters.resourceType?
string
filters.to?
string
name
string
Returns
Promise<{ createdAt: Date; filters: { action?: string; actorId?: string; actorType?: string; from?: string; resourceId?: string; resourceType?: string; to?: string; }; id: string; name: string; }>
backtests
ts
backtests: object;Replays recorded evaluations against a rule version, or through a workflow version's rule steps (backtests:run). start returns the queued job; poll get until its status is completed (with summary) or failed.
backtests.get
ts
get: (id) => Promise<{
createdAt: Date;
error?: string | null;
finishedAt?: Date | null;
id: string;
progress: {
done: number;
total: number;
};
requestedBy: string;
ruleKey?: string | null;
ruleSetKey?: string | null;
ruleVersion?: number | null;
sample: {
lastDays: number;
limit: number;
};
status: "failed" | "completed" | "running" | "queued";
summary?: | {
daily?: object[];
decisions?: Record<string, number>;
durationMs: number;
evaluated: number;
outcomes: z.ZodRecord<z.ZodEnum<{
error: "error";
fail: "fail";
pass: "pass";
skipped: "skipped";
}>, z.ZodNumber>;
overlap: z.ZodRecord<z.ZodString, z.ZodNumber>;
sampleFailures: object[];
wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>;
}
| null;
temporalWorkflowId?: string | null;
tenantId: string;
workflowKey?: string | null;
workflowVersion?: number | null;
}>;Parameters
id
string
Returns
Promise<{ createdAt: Date; error?: string | null; finishedAt?: Date | null; id: string; progress: { done: number; total: number; }; requestedBy: string; ruleKey?: string | null; ruleSetKey?: string | null; ruleVersion?: number | null; sample: { lastDays: number; limit: number; }; status: "failed" | "completed" | "running" | "queued"; summary?: | { daily?: object[]; decisions?: Record<string, number>; durationMs: number; evaluated: number; outcomes: z.ZodRecord<z.ZodEnum<{ error: "error"; fail: "fail"; pass: "pass"; skipped: "skipped"; }>, z.ZodNumber>; overlap: z.ZodRecord<z.ZodString, z.ZodNumber>; sampleFailures: object[]; wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>; } | null; temporalWorkflowId?: string | null; tenantId: string; workflowKey?: string | null; workflowVersion?: number | null; }>
backtests.list
ts
list: (query) => Promise<object[]>;Newest first.
Parameters
query?
PageQuery = {}
Returns
Promise<object[]>
backtests.start
ts
start: (body) => Promise<{
createdAt: Date;
error?: string | null;
finishedAt?: Date | null;
id: string;
progress: {
done: number;
total: number;
};
requestedBy: string;
ruleKey?: string | null;
ruleSetKey?: string | null;
ruleVersion?: number | null;
sample: {
lastDays: number;
limit: number;
};
status: "failed" | "completed" | "running" | "queued";
summary?: | {
daily?: object[];
decisions?: Record<string, number>;
durationMs: number;
evaluated: number;
outcomes: z.ZodRecord<z.ZodEnum<{
error: "error";
fail: "fail";
pass: "pass";
skipped: "skipped";
}>, z.ZodNumber>;
overlap: z.ZodRecord<z.ZodString, z.ZodNumber>;
sampleFailures: object[];
wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>;
}
| null;
temporalWorkflowId?: string | null;
tenantId: string;
workflowKey?: string | null;
workflowVersion?: number | null;
}>;Parameters
body
| { compareWithRuleSetKey?: string; ruleKey: string; sample?: { lastDays?: number; limit?: number; }; version?: number; } | { sample?: { lastDays?: number; limit?: number; }; version?: number; workflowKey: string; }
Returns
Promise<{ createdAt: Date; error?: string | null; finishedAt?: Date | null; id: string; progress: { done: number; total: number; }; requestedBy: string; ruleKey?: string | null; ruleSetKey?: string | null; ruleVersion?: number | null; sample: { lastDays: number; limit: number; }; status: "failed" | "completed" | "running" | "queued"; summary?: | { daily?: object[]; decisions?: Record<string, number>; durationMs: number; evaluated: number; outcomes: z.ZodRecord<z.ZodEnum<{ error: "error"; fail: "fail"; pass: "pass"; skipped: "skipped"; }>, z.ZodNumber>; overlap: z.ZodRecord<z.ZodString, z.ZodNumber>; sampleFailures: object[]; wouldChange: z.ZodRecord<z.ZodString, z.ZodNumber>; } | null; temporalWorkflowId?: string | null; tenantId: string; workflowKey?: string | null; workflowVersion?: number | null; }>
builder
ts
builder: BuilderClient;Step and field type schemas behind the definition editors' forms.
caseQueues
ts
caseQueues: object;Saved case filters shown in the workbench rail, with live counts.
caseQueues.counts
ts
counts: () => Promise<object[]>;Returns
Promise<object[]>
caseQueues.create
ts
create: (body) => Promise<{
claimNext: boolean;
createdAt: Date;
createdBy: string;
filter: {
assignee?: string;
country?: string;
dueBefore?: Date;
priority?: ("high" | "low" | "medium" | "critical")[];
queue?: string;
reasonCode?: string;
search?: string;
slaState?: ("ok" | "none" | "breached" | "due_soon")[];
status?: ("closed" | "open" | "decided" | "in_review")[];
subjectId?: string;
type?: string;
waiting?: boolean;
};
id: string;
name: string;
order: "asc" | "desc";
position: number;
sort: "priority" | "createdAt" | "dueAt";
systemKey?: string | null;
tenantId: string;
updatedAt: Date;
visibility: "admins" | "personal" | "everyone";
}>;Parameters
body
claimNext?
boolean
filter?
{ assignee?: string; country?: string; dueBefore?: unknown; priority?: ("high" | "low" | "medium" | "critical")[]; queue?: string; reasonCode?: string; search?: string; slaState?: ("ok" | "none" | "breached" | "due_soon")[]; status?: ("closed" | "open" | "decided" | "in_review")[]; subjectId?: string; type?: string; waiting?: boolean; }
filter.assignee?
string
filter.country?
string
filter.dueBefore?
unknown
filter.priority?
("high" | "low" | "medium" | "critical")[]
filter.queue?
string
filter.reasonCode?
string
filter.search?
string
filter.slaState?
("ok" | "none" | "breached" | "due_soon")[]
filter.status?
("closed" | "open" | "decided" | "in_review")[]
filter.subjectId?
string
filter.type?
string
filter.waiting?
boolean
name
string
order?
"asc" | "desc"
position?
number
sort?
"priority" | "createdAt" | "dueAt"
visibility?
"admins" | "personal" | "everyone"
Returns
Promise<{ claimNext: boolean; createdAt: Date; createdBy: string; filter: { assignee?: string; country?: string; dueBefore?: Date; priority?: ("high" | "low" | "medium" | "critical")[]; queue?: string; reasonCode?: string; search?: string; slaState?: ("ok" | "none" | "breached" | "due_soon")[]; status?: ("closed" | "open" | "decided" | "in_review")[]; subjectId?: string; type?: string; waiting?: boolean; }; id: string; name: string; order: "asc" | "desc"; position: number; sort: "priority" | "createdAt" | "dueAt"; systemKey?: string | null; tenantId: string; updatedAt: Date; visibility: "admins" | "personal" | "everyone"; }>
caseQueues.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
caseQueues.preview
ts
preview: (body) => Promise<{
items: object[];
total: number;
}>;How many cases a filter would hold now, and the first five in its order.
Parameters
body
filter?
{ assignee?: string; country?: string; dueBefore?: unknown; priority?: ("high" | "low" | "medium" | "critical")[]; queue?: string; reasonCode?: string; search?: string; slaState?: ("ok" | "none" | "breached" | "due_soon")[]; status?: ("closed" | "open" | "decided" | "in_review")[]; subjectId?: string; type?: string; waiting?: boolean; }
filter.assignee?
string
filter.country?
string
filter.dueBefore?
unknown
filter.priority?
("high" | "low" | "medium" | "critical")[]
filter.queue?
string
filter.reasonCode?
string
filter.search?
string
filter.slaState?
("ok" | "none" | "breached" | "due_soon")[]
filter.status?
("closed" | "open" | "decided" | "in_review")[]
filter.subjectId?
string
filter.type?
string
filter.waiting?
boolean
order?
"asc" | "desc"
sort?
"priority" | "createdAt" | "dueAt"
Returns
Promise<{ items: object[]; total: number; }>
caseQueues.remove
ts
remove: (id) => Promise<void>;Parameters
id
string
Returns
Promise<void>
caseQueues.reorder
ts
reorder: (ids) => Promise<object[]>;Puts the queues in this order; returns the caller's queues.
Parameters
ids
string[]
Returns
Promise<object[]>
caseQueues.update
ts
update: (id, body) => Promise<{
claimNext: boolean;
createdAt: Date;
createdBy: string;
filter: {
assignee?: string;
country?: string;
dueBefore?: Date;
priority?: ("high" | "low" | "medium" | "critical")[];
queue?: string;
reasonCode?: string;
search?: string;
slaState?: ("ok" | "none" | "breached" | "due_soon")[];
status?: ("closed" | "open" | "decided" | "in_review")[];
subjectId?: string;
type?: string;
waiting?: boolean;
};
id: string;
name: string;
order: "asc" | "desc";
position: number;
sort: "priority" | "createdAt" | "dueAt";
systemKey?: string | null;
tenantId: string;
updatedAt: Date;
visibility: "admins" | "personal" | "everyone";
}>;Parameters
id
string
body
claimNext?
boolean
filter?
{ assignee?: string; country?: string; dueBefore?: unknown; priority?: ("high" | "low" | "medium" | "critical")[]; queue?: string; reasonCode?: string; search?: string; slaState?: ("ok" | "none" | "breached" | "due_soon")[]; status?: ("closed" | "open" | "decided" | "in_review")[]; subjectId?: string; type?: string; waiting?: boolean; }
filter.assignee?
string
filter.country?
string
filter.dueBefore?
unknown
filter.priority?
("high" | "low" | "medium" | "critical")[]
filter.queue?
string
filter.reasonCode?
string
filter.search?
string
filter.slaState?
("ok" | "none" | "breached" | "due_soon")[]
filter.status?
("closed" | "open" | "decided" | "in_review")[]
filter.subjectId?
string
filter.type?
string
filter.waiting?
boolean
name
string
order?
"asc" | "desc"
position?
number
sort?
"priority" | "createdAt" | "dueAt"
visibility?
"admins" | "personal" | "everyone"
Returns
Promise<{ claimNext: boolean; createdAt: Date; createdBy: string; filter: { assignee?: string; country?: string; dueBefore?: Date; priority?: ("high" | "low" | "medium" | "critical")[]; queue?: string; reasonCode?: string; search?: string; slaState?: ("ok" | "none" | "breached" | "due_soon")[]; status?: ("closed" | "open" | "decided" | "in_review")[]; subjectId?: string; type?: string; waiting?: boolean; }; id: string; name: string; order: "asc" | "desc"; position: number; sort: "priority" | "createdAt" | "dueAt"; systemKey?: string | null; tenantId: string; updatedAt: Date; visibility: "admins" | "personal" | "everyone"; }>
cases
ts
cases: object;Review cases: filtered lists and pages, counts, claim-next, bulk actions, detail, decide, assign/claim/close and notes. See cases.ts.
cases.assign
ts
assign: (id, body) => Promise<{
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Sets or clears (assigneeId: null) the assignee (cases:assign).
Parameters
id
string
body
assigneeId
string | null
Returns
Promise<{ assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }>
cases.bulk
ts
bulk: (body) => Promise<{
failed: object[];
updated: string[];
}>;Assigns, claims or closes several cases (cases:assign, plus cases:claim or cases:decide); cases that could not change come back in failed.
Parameters
body
action
"assign" | "claim" | "close"
assigneeId?
string | null
ids
string[]
reason?
string
Returns
Promise<{ failed: object[]; updated: string[]; }>
cases.claim
ts
claim: (id) => Promise<{
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Assigns the case to the caller (cases:claim).
Parameters
id
string
Returns
Promise<{ assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }>
cases.claimNext
ts
claimNext: (body) => Promise<{
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Atomically assigns the caller the next free case (cases:claim). Throws ApiError with code nothing_to_claim (404) when none is free: see isNothingToClaim.
Parameters
body?
ClaimNextBody = {}
Returns
Promise<{ assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }>
cases.close
ts
close: (id, body) => Promise<{
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Closes the case (cases:decide). An undecided case gets a reject decision with reason code case_closed so its workflow run does not wait forever.
Parameters
id
string
body?
reason?
string
Returns
Promise<{ assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }>
cases.counts
ts
counts: (body) => Promise<{
counts: z.ZodRecord<z.ZodString, z.ZodNumber>;
}>;How many cases match each named filter, in one request (cases:read).
Parameters
body
Returns
Promise<{ counts: z.ZodRecord<z.ZodString, z.ZodNumber>; }>
cases.decide
ts
decide: (id, body) => Promise<{
case: {
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
};
decision: {
caseId?: string | null;
createdAt: Date;
decidedBy?: string | null;
id: string;
outcome: "approve" | "reject" | "manual_review";
reasons: object[];
riskScore?: number | null;
ruleResults: object[];
ruleSetKey?: string | null;
ruleSetVersion?: number | null;
source: "manual" | "automated";
subjectId: string;
tenantId: string;
workflowRunId?: string | null;
};
}>;Parameters
id
string
body
note?
string
outcome
"approve" | "reject" | "manual_review"
reasons?
object[]
Returns
Promise<{ case: { assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }; decision: { caseId?: string | null; createdAt: Date; decidedBy?: string | null; id: string; outcome: "approve" | "reject" | "manual_review"; reasons: object[]; riskScore?: number | null; ruleResults: object[]; ruleSetKey?: string | null; ruleSetVersion?: number | null; source: "manual" | "automated"; subjectId: string; tenantId: string; workflowRunId?: string | null; }; }>
cases.evidence
ts
evidence: (id) => Promise<{
decisions: object[];
documents: object[] | null;
events: object[] | null;
riskScore: number | null;
ruleHits: object[];
vendorChecks: object[] | null;
}>;What a reviewer weighs on the case, in one response (sections null without access).
Parameters
id
string
Returns
Promise<{ decisions: object[]; documents: object[] | null; events: object[] | null; riskScore: number | null; ruleHits: object[]; vendorChecks: object[] | null; }>
cases.get
ts
get: (id) => Promise<{
case: {
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
};
decisions: object[];
run: | {
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
correlationId?: string | null;
createdAt: Date;
currentStepId?: string | null;
decisionId?: string | null;
definitionId: string;
definitionKey: string;
definitionVersion: number;
error?: string | null;
finishedAt?: Date | null;
id: string;
replayOf?: | {
runId: string;
stepId: string;
}
| null;
startedAt: Date;
status: | "failed"
| "completed"
| "running"
| "waiting_collection"
| "waiting_manual"
| "waiting_callback"
| "cancelled";
subjectId: string;
temporalRunId?: string | null;
temporalWorkflowId: string;
tenantId: string;
traceId?: string | null;
trigger: "console" | "api" | "replay";
updatedAt: Date;
}
| null;
subject: {
createdAt: Date;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
riskScore?: number | null;
status: "active" | "blocked" | "closed";
tags: string[];
tenantId: string;
updatedAt: Date;
};
}>;Parameters
id
string
Returns
Promise<{ case: { assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }; decisions: object[]; run: | { context: z.ZodRecord<z.ZodString, z.ZodUnknown>; correlationId?: string | null; createdAt: Date; currentStepId?: string | null; decisionId?: string | null; definitionId: string; definitionKey: string; definitionVersion: number; error?: string | null; finishedAt?: Date | null; id: string; replayOf?: | { runId: string; stepId: string; } | null; startedAt: Date; status: | "failed" | "completed" | "running" | "waiting_collection" | "waiting_manual" | "waiting_callback" | "cancelled"; subjectId: string; temporalRunId?: string | null; temporalWorkflowId: string; tenantId: string; traceId?: string | null; trigger: "console" | "api" | "replay"; updatedAt: Date; } | null; subject: { createdAt: Date; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; riskScore?: number | null; status: "active" | "blocked" | "closed"; tags: string[]; tenantId: string; updatedAt: Date; }; }>
cases.list
ts
list: (query) => Promise<object[]>;Cases matching query, in the requested order (createdAt desc by default).
Parameters
query?
CaseListQuery = {}
Returns
Promise<object[]>
cases.listPage
ts
listPage: (query) => Promise<Page<{
assignee?: | {
email?: string | null;
id: string;
name: string | null;
}
| null;
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subject?: {
country?: string;
displayName: string;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
};
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
}>>;One page of list with the number of matches, and the subjects when expand asks.
Parameters
query?
CasePageQuery = {}
Returns
Promise<Page<{ assignee?: | { email?: string | null; id: string; name: string | null; } | null; assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subject?: { country?: string; displayName: string; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; }; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }>>
cases.notes
ts
notes: object;Analyst notes on a case (cases:notes); edits and deletes are limited to the author or an admin.
cases.notes.create
ts
create: (id, body) => Promise<{
authorId: string;
body: string;
caseId: string;
createdAt: Date;
editedAt?: Date | null;
id: string;
tenantId: string;
updatedAt: Date;
}>;Parameters
id
string
body
body
string
Returns
Promise<{ authorId: string; body: string; caseId: string; createdAt: Date; editedAt?: Date | null; id: string; tenantId: string; updatedAt: Date; }>
cases.notes.list
ts
list: (id) => Promise<object[]>;Parameters
id
string
Returns
Promise<object[]>
cases.notes.remove
ts
remove: (id, noteId) => Promise<void>;Parameters
id
string
noteId
string
Returns
Promise<void>
cases.notes.update
ts
update: (id, noteId, body) => Promise<{
authorId: string;
body: string;
caseId: string;
createdAt: Date;
editedAt?: Date | null;
id: string;
tenantId: string;
updatedAt: Date;
}>;Parameters
id
string
noteId
string
body
body
string
Returns
Promise<{ authorId: string; body: string; caseId: string; createdAt: Date; editedAt?: Date | null; id: string; tenantId: string; updatedAt: Date; }>
cases.reasonCodes
ts
reasonCodes: object;The tenant's reason-code catalogue; replacing it needs tenants:settings.
cases.reasonCodes.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
cases.reasonCodes.replace
ts
replace: (body) => Promise<object[]>;Parameters
body
items
object[]
Returns
Promise<object[]>
cases.requestInfo
ts
requestInfo: (id, body) => Promise<{
case: {
assigneeId?: string | null;
closedAt?: Date | null;
closedReason?: string | null;
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
createdAt: Date;
decidedAt?: Date | null;
decisionId?: string | null;
dueAt?: Date | null;
firstResponseAt?: Date | null;
id: string;
infoRequestedAt?: Date | null;
priority: "high" | "low" | "medium" | "critical";
queue?: string | null;
slaBreachedAt?: Date | null;
slaState: "ok" | "none" | "breached" | "due_soon";
slaWarnPct?: number | null;
status: "closed" | "open" | "decided" | "in_review";
subjectId: string;
tenantId: string;
type: string;
updatedAt: Date;
workflowRunId?: string | null;
};
expiresAt: Date;
link: string;
submission: {
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
};
}>;Asks the applicant for more information (cases:decide): the run's form again, pre-filled, with message; the case waits with its SLA paused. Hand link to the applicant.
Parameters
id
string
body
message
string
Returns
Promise<{ case: { assigneeId?: string | null; closedAt?: Date | null; closedReason?: string | null; context: z.ZodRecord<z.ZodString, z.ZodUnknown>; createdAt: Date; decidedAt?: Date | null; decisionId?: string | null; dueAt?: Date | null; firstResponseAt?: Date | null; id: string; infoRequestedAt?: Date | null; priority: "high" | "low" | "medium" | "critical"; queue?: string | null; slaBreachedAt?: Date | null; slaState: "ok" | "none" | "breached" | "due_soon"; slaWarnPct?: number | null; status: "closed" | "open" | "decided" | "in_review"; subjectId: string; tenantId: string; type: string; updatedAt: Date; workflowRunId?: string | null; }; expiresAt: Date; link: string; submission: { caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }; }>
cases.types
ts
types: () => Promise<object[]>;The case types of published workflows and open cases.
Returns
Promise<object[]>
collectionFlows
ts
collectionFlows: object;collectionFlows.get
ts
get: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
linkTtlSeconds?: number;
outcome?: {
approved?: {
body?: ... | ...;
title?: ... | ...;
};
rejected?: {
body?: ... | ...;
title?: ... | ...;
};
review?: {
body?: ... | ...;
title?: ... | ...;
};
visibility?: "decision" | "neutral" | "progress";
};
presentation?: {
intro?: {
body?: ... | ...;
minutes?: ... | ...;
title?: ... | ...;
};
outro?: {
body?: ... | ...;
title?: ... | ...;
};
};
steps: object[];
translations?: Record<string, {
description?: string;
name?: string;
outcome?: {
approved?: ...;
rejected?: ...;
review?: ...;
};
presentation?: {
intro?: ...;
outro?: ...;
};
steps?: Record<..., ...>;
}>;
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: ... | ...; title?: ... | ...; }; rejected?: { body?: ... | ...; title?: ... | ...; }; review?: { body?: ... | ...; title?: ... | ...; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: ... | ...; minutes?: ... | ...; title?: ... | ...; }; outro?: { body?: ... | ...; title?: ... | ...; }; }; steps: object[]; translations?: Record<string, { description?: string; name?: string; outcome?: { approved?: ...; rejected?: ...; review?: ...; }; presentation?: { intro?: ...; outro?: ...; }; steps?: Record<..., ...>; }>; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; version: number; }>
collectionFlows.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
collectionFlows.preview
ts
preview: (key, version) => Promise<{
expiresAt: Date;
url: string;
}>;A link, valid 15 minutes, that opens the version in the collection terminal as a preview: nothing is saved. It carries a credential: never log it.
Parameters
key
string
version
number
Returns
Promise<{ expiresAt: Date; url: string; }>
collectionFlows.publish
ts
publish: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
linkTtlSeconds?: number;
outcome?: {
approved?: {
body?: ... | ...;
title?: ... | ...;
};
rejected?: {
body?: ... | ...;
title?: ... | ...;
};
review?: {
body?: ... | ...;
title?: ... | ...;
};
visibility?: "decision" | "neutral" | "progress";
};
presentation?: {
intro?: {
body?: ... | ...;
minutes?: ... | ...;
title?: ... | ...;
};
outro?: {
body?: ... | ...;
title?: ... | ...;
};
};
steps: object[];
translations?: Record<string, {
description?: string;
name?: string;
outcome?: {
approved?: ...;
rejected?: ...;
review?: ...;
};
presentation?: {
intro?: ...;
outro?: ...;
};
steps?: Record<..., ...>;
}>;
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: ... | ...; title?: ... | ...; }; rejected?: { body?: ... | ...; title?: ... | ...; }; review?: { body?: ... | ...; title?: ... | ...; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: ... | ...; minutes?: ... | ...; title?: ... | ...; }; outro?: { body?: ... | ...; title?: ... | ...; }; }; steps: object[]; translations?: Record<string, { description?: string; name?: string; outcome?: { approved?: ...; rejected?: ...; review?: ...; }; presentation?: { intro?: ...; outro?: ...; }; steps?: Record<..., ...>; }>; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; version: number; }>
collectionFlows.updateDraft
ts
updateDraft: (key, version, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
linkTtlSeconds?: number;
outcome?: {
approved?: {
body?: ... | ...;
title?: ... | ...;
};
rejected?: {
body?: ... | ...;
title?: ... | ...;
};
review?: {
body?: ... | ...;
title?: ... | ...;
};
visibility?: "decision" | "neutral" | "progress";
};
presentation?: {
intro?: {
body?: ... | ...;
minutes?: ... | ...;
title?: ... | ...;
};
outro?: {
body?: ... | ...;
title?: ... | ...;
};
};
steps: object[];
translations?: Record<string, {
description?: string;
name?: string;
outcome?: {
approved?: ...;
rejected?: ...;
review?: ...;
};
presentation?: {
intro?: ...;
outro?: ...;
};
steps?: Record<..., ...>;
}>;
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Saves the draft version in place (autosave); 409 once it has left draft. Without note the stored change note stays.
Parameters
key
string
version
number
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: ... | ...; title?: ... | ...; }; rejected?: { body?: ... | ...; title?: ... | ...; }; review?: { body?: ... | ...; title?: ... | ...; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: ... | ...; minutes?: ... | ...; title?: ... | ...; }; outro?: { body?: ... | ...; title?: ... | ...; }; }; steps: object[]; translations?: Record<string, { description?: string; name?: string; outcome?: { approved?: ...; rejected?: ...; review?: ...; }; presentation?: { intro?: ...; outro?: ...; }; steps?: Record<..., ...>; }>; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; version: number; }>
collectionFlows.upsert
ts
upsert: (key, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
linkTtlSeconds?: number;
outcome?: {
approved?: {
body?: ... | ...;
title?: ... | ...;
};
rejected?: {
body?: ... | ...;
title?: ... | ...;
};
review?: {
body?: ... | ...;
title?: ... | ...;
};
visibility?: "decision" | "neutral" | "progress";
};
presentation?: {
intro?: {
body?: ... | ...;
minutes?: ... | ...;
title?: ... | ...;
};
outro?: {
body?: ... | ...;
title?: ... | ...;
};
};
steps: object[];
translations?: Record<string, {
description?: string;
name?: string;
outcome?: {
approved?: ...;
rejected?: ...;
review?: ...;
};
presentation?: {
intro?: ...;
outro?: ...;
};
steps?: Record<..., ...>;
}>;
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Creates the next version as a draft; note is its change note.
Parameters
key
string
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: ... | ...; title?: ... | ...; }; rejected?: { body?: ... | ...; title?: ... | ...; }; review?: { body?: ... | ...; title?: ... | ...; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: ... | ...; minutes?: ... | ...; title?: ... | ...; }; outro?: { body?: ... | ...; title?: ... | ...; }; }; steps: object[]; translations?: Record<string, { description?: string; name?: string; outcome?: { approved?: ...; rejected?: ...; review?: ...; }; presentation?: { intro?: ...; outro?: ...; }; steps?: Record<..., ...>; }>; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; version: number; }>
collectionFlows.validate
ts
validate: (body) => Promise<{
issues: object[];
ok: boolean;
}>;Validates a draft flow body without saving; issues carry step / field keys.
Parameters
body
definition
{ entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: string; title?: string; }; rejected?: { body?: string; title?: string; }; review?: { body?: string; title?: string; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: string; minutes?: number; title?: string; }; outro?: { body?: string; title?: string; }; }; steps: object[]; translations?: Record<string, { description?: string; name?: string; outcome?: { approved?: ... | ...; rejected?: ... | ...; review?: ... | ...; }; presentation?: { intro?: ... | ...; outro?: ... | ...; }; steps?: Record<string, { description?: ...; fields?: ...; title?: ...; }>; }>; }
definition.entryStepId
string
definition.linkTtlSeconds?
number
definition.outcome?
{ approved?: { body?: string; title?: string; }; rejected?: { body?: string; title?: string; }; review?: { body?: string; title?: string; }; visibility?: "decision" | "neutral" | "progress"; }
definition.outcome.approved?
{ body?: string; title?: string; }
definition.outcome.approved.body?
string
definition.outcome.approved.title?
string
definition.outcome.rejected?
{ body?: string; title?: string; }
definition.outcome.rejected.body?
string
definition.outcome.rejected.title?
string
definition.outcome.review?
{ body?: string; title?: string; }
definition.outcome.review.body?
string
definition.outcome.review.title?
string
definition.outcome.visibility?
"decision" | "neutral" | "progress"
definition.presentation?
{ intro?: { body?: string; minutes?: number; title?: string; }; outro?: { body?: string; title?: string; }; }
definition.presentation.intro?
{ body?: string; minutes?: number; title?: string; }
definition.presentation.intro.body?
string
definition.presentation.intro.minutes?
number
definition.presentation.intro.title?
string
definition.presentation.outro?
{ body?: string; title?: string; }
definition.presentation.outro.body?
string
definition.presentation.outro.title?
string
definition.steps
object[]
definition.translations?
Record<string, { description?: string; name?: string; outcome?: { approved?: ... | ...; rejected?: ... | ...; review?: ... | ...; }; presentation?: { intro?: ... | ...; outro?: ... | ...; }; steps?: Record<string, { description?: ...; fields?: ...; title?: ...; }>; }>
description?
string
name
string
Returns
Promise<{ issues: object[]; ok: boolean; }>
collectionSubmissions
ts
collectionSubmissions: object;collectionSubmissions.create
ts
create: (body) => Promise<{
link: string | null;
submission: {
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
};
}>;Creates the submission and returns the applicant link alongside it.
Parameters
body
flowKey
string
subjectId
string
workflowRunId?
string
Returns
Promise<{ link: string | null; submission: { caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }; }>
collectionSubmissions.embed
ts
embed: (id) => Promise<{
embedOrigins: string[];
flowName: string;
}>;Embed allow-list and flow name for the submission; readable with the applicant's token.
Parameters
id
string
Returns
Promise<{ embedOrigins: string[]; flowName: string; }>
collectionSubmissions.get
ts
get: (id) => Promise<{
flow: {
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
linkTtlSeconds?: number;
outcome?: {
approved?: {
body?: ...;
title?: ...;
};
rejected?: {
body?: ...;
title?: ...;
};
review?: {
body?: ...;
title?: ...;
};
visibility?: "decision" | "neutral" | "progress";
};
presentation?: {
intro?: {
body?: ...;
minutes?: ...;
title?: ...;
};
outro?: {
body?: ...;
title?: ...;
};
};
steps: object[];
translations?: Record<string, {
description?: ... | ...;
name?: ... | ...;
outcome?: ... | ...;
presentation?: ... | ...;
steps?: ... | ...;
}>;
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
version: number;
};
submission: {
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
};
}>;Parameters
id
string
Returns
Promise<{ flow: { createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; linkTtlSeconds?: number; outcome?: { approved?: { body?: ...; title?: ...; }; rejected?: { body?: ...; title?: ...; }; review?: { body?: ...; title?: ...; }; visibility?: "decision" | "neutral" | "progress"; }; presentation?: { intro?: { body?: ...; minutes?: ...; title?: ...; }; outro?: { body?: ...; title?: ...; }; }; steps: object[]; translations?: Record<string, { description?: ... | ...; name?: ... | ...; outcome?: ... | ...; presentation?: ... | ...; steps?: ... | ...; }>; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; version: number; }; submission: { caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }; }>
collectionSubmissions.list
ts
list: (query) => Promise<object[]>;Newest first, those started outside a workflow run included.
Parameters
query?
SubmissionListQuery = {}
Returns
Promise<object[]>
collectionSubmissions.listPage
ts
listPage: (query) => Promise<Page<{
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
}>>;One page of list with the number of matching submissions.
Parameters
query?
SubmissionListQuery = {}
Returns
Promise<Page<{ caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }>>
collectionSubmissions.reissueLink
ts
reissueLink: (id) => Promise<{
expiresAt: Date;
link: string;
}>;A new applicant link to a submission in progress (submissions:write); never log it.
Parameters
id
string
Returns
Promise<{ expiresAt: Date; link: string; }>
collectionSubmissions.save
ts
save: (id, body) => Promise<{
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Parameters
id
string
body
currentStepId?
string
data
z.ZodRecord<z.ZodString, z.ZodUnknown>
Returns
Promise<{ caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }>
collectionSubmissions.status
ts
status: (id) => Promise<{
handoff: boolean;
next: | {
link: string | null;
message: string | null;
submissionId: string;
}
| null;
run: | {
currentStepId: string | null;
decision: | {
outcome: "approve" | "reject" | "manual_review";
}
| null;
id: string;
status: | "failed"
| "completed"
| "running"
| "waiting_collection"
| "waiting_manual"
| "waiting_callback"
| "cancelled";
}
| null;
submission: {
id: string;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
submittedAt: Date | null;
};
}>;Where the submission's workflow run is; readable with the applicant's token.
Parameters
id
string
Returns
Promise<{ handoff: boolean; next: | { link: string | null; message: string | null; submissionId: string; } | null; run: | { currentStepId: string | null; decision: | { outcome: "approve" | "reject" | "manual_review"; } | null; id: string; status: | "failed" | "completed" | "running" | "waiting_collection" | "waiting_manual" | "waiting_callback" | "cancelled"; } | null; submission: { id: string; status: "withdrawn" | "submitted" | "in_progress" | "expired"; submittedAt: Date | null; }; }>
collectionSubmissions.submit
ts
submit: (id) => Promise<{
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Parameters
id
string
Returns
Promise<{ caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }>
collectionSubmissions.withdraw
ts
withdraw: (id) => Promise<{
caseId?: string | null;
createdAt: Date;
currentStepId?: string | null;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
expiresAt?: Date | null;
flowDefinitionId: string;
flowKey: string;
flowVersion: number;
id: string;
requestMessage?: string | null;
status: "withdrawn" | "submitted" | "in_progress" | "expired";
subjectId: string;
submittedAt?: Date | null;
tenantId: string;
updatedAt: Date;
workflowRunId?: string | null;
}>;Withdraws a submission the applicant no longer needs to fill (submissions:write).
Parameters
id
string
Returns
Promise<{ caseId?: string | null; createdAt: Date; currentStepId?: string | null; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; expiresAt?: Date | null; flowDefinitionId: string; flowKey: string; flowVersion: number; id: string; requestMessage?: string | null; status: "withdrawn" | "submitted" | "in_progress" | "expired"; subjectId: string; submittedAt?: Date | null; tenantId: string; updatedAt: Date; workflowRunId?: string | null; }>
decisions
ts
decisions: object;decisions.listBySubject
ts
listBySubject: (subjectId) => Promise<object[]>;The subject's newest 50 decisions (cases:read).
Parameters
subjectId
string
Returns
Promise<object[]>
decisions.listPage
ts
listPage: (query) => Promise<Page<{
caseId?: string | null;
createdAt: Date;
decidedBy?: string | null;
id: string;
outcome: "approve" | "reject" | "manual_review";
reasons: object[];
riskScore?: number | null;
ruleResults: object[];
ruleSetKey?: string | null;
ruleSetVersion?: number | null;
source: "manual" | "automated";
subjectId: string;
tenantId: string;
workflowRunId?: string | null;
}>>;One page of the subject's decisions, newest first, with the number of matches.
Parameters
query
Returns
Promise<Page<{ caseId?: string | null; createdAt: Date; decidedBy?: string | null; id: string; outcome: "approve" | "reject" | "manual_review"; reasons: object[]; riskScore?: number | null; ruleResults: object[]; ruleSetKey?: string | null; ruleSetVersion?: number | null; source: "manual" | "automated"; subjectId: string; tenantId: string; workflowRunId?: string | null; }>>
definitions
ts
definitions: DefinitionsClient;What names each definition, for "Used by". See definition-tools.ts.
documents
ts
documents: object;Uploaded files: create -> uploadToStorage (helper) -> finalize -> pollDocument (helper) until the scan settles. See documents.ts.
documents.create
ts
create: (input) => Promise<{
documentId: string;
upload: {
expiresAt: Date;
headers: z.ZodRecord<z.ZodString, z.ZodString>;
method: "PUT";
url: string;
};
}>;Registers a pending document and returns the presigned PUT to send the bytes with (uploadToStorage). Applicants pass their submissionId and the fieldKey.
Parameters
input
caseId?
string
contentType
"image/jpeg" | "image/png" | "image/webp" | "application/pdf"
fieldKey?
string
fileName
string
sizeBytes
number
subjectId?
string
submissionId?
string
Returns
Promise<{ documentId: string; upload: { expiresAt: Date; headers: z.ZodRecord<z.ZodString, z.ZodString>; method: "PUT"; url: string; }; }>
documents.download
ts
download: (id, opts) => Promise<{
contentType: string;
expiresAt: Date;
fileName: string;
url: string;
}>;A 60-second presigned GET on the storage origin; open it directly, never via the API.
Parameters
id
string
opts?
DocumentScope = {}
Returns
Promise<{ contentType: string; expiresAt: Date; fileName: string; url: string; }>
documents.finalize
ts
finalize: (id, opts) => Promise<{
caseId?: string | null;
contentType: string;
createdAt: Date;
fieldKey?: string | null;
fileName: string;
id: string;
rejectionCode?: | "empty"
| "too_large"
| "size_mismatch"
| "type_mismatch"
| "unsupported_type"
| "undecodable_image"
| "pdf_active_content"
| "object_missing"
| null;
rejectionReason?: string | null;
scan?: | {
engine: string;
scannedAt: Date;
signature?: string;
}
| null;
sha256?: string | null;
sizeBytes: number;
status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected";
storageKey: string;
subjectId: string;
submissionId?: string | null;
tenantId: string;
thumbnailKey?: string | null;
updatedAt: Date;
uploadedBy: string;
}>;Verifies the uploaded object and starts the scan. Resolves with status uploaded or rejected (see rejectionReason); throws a 409 ApiError when nothing was uploaded.
Parameters
id
string
opts?
DocumentScope = {}
Returns
Promise<{ caseId?: string | null; contentType: string; createdAt: Date; fieldKey?: string | null; fileName: string; id: string; rejectionCode?: | "empty" | "too_large" | "size_mismatch" | "type_mismatch" | "unsupported_type" | "undecodable_image" | "pdf_active_content" | "object_missing" | null; rejectionReason?: string | null; scan?: | { engine: string; scannedAt: Date; signature?: string; } | null; sha256?: string | null; sizeBytes: number; status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected"; storageKey: string; subjectId: string; submissionId?: string | null; tenantId: string; thumbnailKey?: string | null; updatedAt: Date; uploadedBy: string; }>
documents.get
ts
get: (id, opts) => Promise<{
caseId?: string | null;
contentType: string;
createdAt: Date;
fieldKey?: string | null;
fileName: string;
id: string;
rejectionCode?: | "empty"
| "too_large"
| "size_mismatch"
| "type_mismatch"
| "unsupported_type"
| "undecodable_image"
| "pdf_active_content"
| "object_missing"
| null;
rejectionReason?: string | null;
scan?: | {
engine: string;
scannedAt: Date;
signature?: string;
}
| null;
sha256?: string | null;
sizeBytes: number;
status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected";
storageKey: string;
subjectId: string;
submissionId?: string | null;
tenantId: string;
thumbnailKey?: string | null;
updatedAt: Date;
uploadedBy: string;
}>;Parameters
id
string
opts?
DocumentScope = {}
Returns
Promise<{ caseId?: string | null; contentType: string; createdAt: Date; fieldKey?: string | null; fileName: string; id: string; rejectionCode?: | "empty" | "too_large" | "size_mismatch" | "type_mismatch" | "unsupported_type" | "undecodable_image" | "pdf_active_content" | "object_missing" | null; rejectionReason?: string | null; scan?: | { engine: string; scannedAt: Date; signature?: string; } | null; sha256?: string | null; sizeBytes: number; status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected"; storageKey: string; subjectId: string; submissionId?: string | null; tenantId: string; thumbnailKey?: string | null; updatedAt: Date; uploadedBy: string; }>
documents.list
ts
list: (filters) => Promise<{
items: object[];
}>;Parameters
filters?
DocumentListQuery = {}
Returns
Promise<{ items: object[]; }>
documents.thumbnail
ts
thumbnail: (id, opts) => Promise<{
expiresAt: Date;
url: string;
}>;A 60-second presigned GET of the grayscale thumbnail the scan rendered (thumbnailKey set); 404 for a document without one.
Parameters
id
string
opts?
DocumentScope = {}
Returns
Promise<{ expiresAt: Date; url: string; }>
events
ts
events: object;Subject events: the facts velocity rules aggregate over.
events.ingest
ts
ingest: (body) => Promise<{
accepted: number;
duplicates: number;
}>;Inserts events; re-sent idempotency keys are counted as duplicates, not errors.
Parameters
body
events
object[]
Returns
Promise<{ accepted: number; duplicates: number; }>
events.list
ts
list: (query) => Promise<object[]>;Newest first.
Parameters
query?
EventListQuery = {}
Returns
Promise<object[]>
governance
ts
governance: GovernanceClient;Version history, diffs and the approval workflow of definitions. See governance.ts.
health
ts
health: object;Liveness, readiness and the health summary. See home.ts.
health.check
ts
check: () => Promise<{
status: "ok";
}>;Returns
Promise<{ status: "ok"; }>
health.ready
ts
ready: () => Promise<{
checks: {
db: "error" | "ok";
temporal: "error" | "ok";
};
status: "ok" | "degraded";
}>;Returns
Promise<{ checks: { db: "error" | "ok"; temporal: "error" | "ok"; }; status: "ok" | "degraded"; }>
health.summary
ts
summary: () => Promise<{
apps: | {
circuits: object[];
failing: object[];
status: "error" | "ok" | "off";
windowMinutes: number;
}
| null;
checkedAt: Date;
dependencies: {
db: "error" | "ok" | "off";
storage: "error" | "ok" | "off";
temporal: "error" | "ok" | "off";
};
message: string;
state: "ok" | "degraded" | "down";
webhooks: | {
endpoints: number;
exhausted: number;
windowHours: number;
}
| null;
}>;Dependencies, failing apps and given-up webhooks, as far as the caller may read.
Returns
Promise<{ apps: | { circuits: object[]; failing: object[]; status: "error" | "ok" | "off"; windowMinutes: number; } | null; checkedAt: Date; dependencies: { db: "error" | "ok" | "off"; storage: "error" | "ok" | "off"; temporal: "error" | "ok" | "off"; }; message: string; state: "ok" | "degraded" | "down"; webhooks: | { endpoints: number; exhausted: number; windowHours: number; } | null; }>
home
ts
home: object;Search, Home's setup checklist and recent activity. See home.ts.
home.activity
ts
activity: (limit?) => Promise<object[]>;Recent decisions, breaches, publishes and approvals as sentences (cases:read).
Parameters
limit?
number
Returns
Promise<object[]>
home.search
ts
search: (q, options) => Promise<{
groups: object[];
partial: boolean;
tookMs: number;
}>;Subjects, cases, runs and definitions matching a name, key or full id.
Parameters
q
string
options?
SearchOptions = {}
Returns
Promise<{ groups: object[]; partial: boolean; tookMs: number; }>
home.setupChecklist
ts
setupChecklist: () => Promise<{
complete: boolean;
done: number;
items: object[];
total: number;
}>;The tenant's setup steps (tenants:settings).
Returns
Promise<{ complete: boolean; done: number; items: object[]; total: number; }>
lists
ts
lists: object;Tenant lists (blocklists / allowlists) and their entries. Lists are keyed, not versioned.
lists.addEntries
ts
addEntries: (key, body) => Promise<{
added: number;
invalid: object[];
skipped: number;
}>;Parameters
key
string
body
entries
object[]
Returns
Promise<{ added: number; invalid: object[]; skipped: number; }>
lists.entries
ts
entries: (key, query) => Promise<object[]>;Parameters
key
string
query?
ListEntryQuery = {}
Returns
Promise<object[]>
lists.get
ts
get: (key) => Promise<{
caseInsensitive: boolean;
createdAt: Date;
description?: string | null;
entryCount: number;
id: string;
key: string;
kind: "string" | "number" | "country" | "email" | "ip_cidr";
name: string;
tenantId: string;
updatedAt: Date;
}>;Parameters
key
string
Returns
Promise<{ caseInsensitive: boolean; createdAt: Date; description?: string | null; entryCount: number; id: string; key: string; kind: "string" | "number" | "country" | "email" | "ip_cidr"; name: string; tenantId: string; updatedAt: Date; }>
lists.importCsv
ts
importCsv: (key, csv) => Promise<{
added: number;
invalid: object[];
skipped: number;
}>;Uploads a CSV (one value per line, optional value,reason,expires_at header).
Parameters
key
string
csv
string
Returns
Promise<{ added: number; invalid: object[]; skipped: number; }>
lists.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
lists.remove
ts
remove: (key) => Promise<void>;Parameters
key
string
Returns
Promise<void>
lists.removeEntries
ts
removeEntries: (key, body) => Promise<{
removed: number;
}>;Parameters
key
string
body
ids
string[]
Returns
Promise<{ removed: number; }>
lists.upsert
ts
upsert: (key, body) => Promise<{
caseInsensitive: boolean;
createdAt: Date;
description?: string | null;
entryCount: number;
id: string;
key: string;
kind: "string" | "number" | "country" | "email" | "ip_cidr";
name: string;
tenantId: string;
updatedAt: Date;
}>;Creates the list or updates its metadata; entries are untouched.
Parameters
key
string
body
caseInsensitive?
boolean
description?
string
kind
"string" | "number" | "country" | "email" | "ip_cidr"
name
string
Returns
Promise<{ caseInsensitive: boolean; createdAt: Date; description?: string | null; entryCount: number; id: string; key: string; kind: "string" | "number" | "country" | "email" | "ip_cidr"; name: string; tenantId: string; updatedAt: Date; }>
me
ts
me: () => Promise<{
orgId?: string;
permissions: string[];
principal: {
email?: string;
kind: "applicant" | "human" | "machine";
name?: string;
subject: string;
};
tenantId: string;
}>;The caller's principal, tenant and permissions as the API sees the bearer token.
Returns
Promise<{ orgId?: string; permissions: string[]; principal: { email?: string; kind: "applicant" | "human" | "machine"; name?: string; subject: string; }; tenantId: string; }>
notifications
ts
notifications: object;The caller's notifications, for the console's bell. See webhooks.ts.
notifications.list
ts
list: (query) => Promise<{
items: object[];
unread: number;
}>;Parameters
query?
limit?
number
unread?
boolean
Returns
Promise<{ items: object[]; unread: number; }>
notifications.markRead
ts
markRead: (ids) => Promise<number>;Marks ids, or every unread one with 'all'; answers how many were unread until now.
Parameters
ids
readonly string[] | "all"
Returns
Promise<number>
policyPacks
ts
policyPacks: PolicyPacksClient;Import and export sets of definitions as policy packs. See definitions-packs.ts.
ruleDefinitions
ts
ruleDefinitions: object;ruleDefinitions.dryRun
ts
dryRun: (key, body) => Promise<{
dataPaths: string[];
key: string;
results: object[];
}>;Evaluates rule versions against a subject or inline data, each with a sentence explaining its result; only the audit trail records it.
Parameters
key
string
body
Returns
Promise<{ dataPaths: string[]; key: string; results: object[]; }>
ruleDefinitions.get
ts
get: (key) => Promise<{
config: unknown;
createdAt: Date;
createdBy?: string | null;
description?: string | null;
enabled: boolean;
id: string;
key: string;
name: string;
note?: string | null;
severity: "info" | "warn" | "block";
status: "published" | "draft" | "pending_approval" | "archived";
tags: string[];
tenantId: string;
type: | "app"
| "comparison"
| "list_lookup"
| "score_threshold"
| "expression"
| "velocity";
updatedAt: Date;
updatedBy?: string | null;
version: number;
weight?: number | null;
}>;Parameters
key
string
Returns
Promise<{ config: unknown; createdAt: Date; createdBy?: string | null; description?: string | null; enabled: boolean; id: string; key: string; name: string; note?: string | null; severity: "info" | "warn" | "block"; status: "published" | "draft" | "pending_approval" | "archived"; tags: string[]; tenantId: string; type: | "app" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity"; updatedAt: Date; updatedBy?: string | null; version: number; weight?: number | null; }>
ruleDefinitions.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
ruleDefinitions.publish
ts
publish: (key) => Promise<{
config: unknown;
createdAt: Date;
createdBy?: string | null;
description?: string | null;
enabled: boolean;
id: string;
key: string;
name: string;
note?: string | null;
severity: "info" | "warn" | "block";
status: "published" | "draft" | "pending_approval" | "archived";
tags: string[];
tenantId: string;
type: | "app"
| "comparison"
| "list_lookup"
| "score_threshold"
| "expression"
| "velocity";
updatedAt: Date;
updatedBy?: string | null;
version: number;
weight?: number | null;
}>;Parameters
key
string
Returns
Promise<{ config: unknown; createdAt: Date; createdBy?: string | null; description?: string | null; enabled: boolean; id: string; key: string; name: string; note?: string | null; severity: "info" | "warn" | "block"; status: "published" | "draft" | "pending_approval" | "archived"; tags: string[]; tenantId: string; type: | "app" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity"; updatedAt: Date; updatedBy?: string | null; version: number; weight?: number | null; }>
ruleDefinitions.updateDraft
ts
updateDraft: (key, version, body) => Promise<{
config: unknown;
createdAt: Date;
createdBy?: string | null;
description?: string | null;
enabled: boolean;
id: string;
key: string;
name: string;
note?: string | null;
severity: "info" | "warn" | "block";
status: "published" | "draft" | "pending_approval" | "archived";
tags: string[];
tenantId: string;
type: | "app"
| "comparison"
| "list_lookup"
| "score_threshold"
| "expression"
| "velocity";
updatedAt: Date;
updatedBy?: string | null;
version: number;
weight?: number | null;
}>;Saves the draft version in place (autosave); 409 once it has left draft. Without note the stored change note stays.
Parameters
key
string
version
number
body
object & VersionNoteBody
Returns
Promise<{ config: unknown; createdAt: Date; createdBy?: string | null; description?: string | null; enabled: boolean; id: string; key: string; name: string; note?: string | null; severity: "info" | "warn" | "block"; status: "published" | "draft" | "pending_approval" | "archived"; tags: string[]; tenantId: string; type: | "app" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity"; updatedAt: Date; updatedBy?: string | null; version: number; weight?: number | null; }>
ruleDefinitions.upsert
ts
upsert: (key, body) => Promise<{
config: unknown;
createdAt: Date;
createdBy?: string | null;
description?: string | null;
enabled: boolean;
id: string;
key: string;
name: string;
note?: string | null;
severity: "info" | "warn" | "block";
status: "published" | "draft" | "pending_approval" | "archived";
tags: string[];
tenantId: string;
type: | "app"
| "comparison"
| "list_lookup"
| "score_threshold"
| "expression"
| "velocity";
updatedAt: Date;
updatedBy?: string | null;
version: number;
weight?: number | null;
}>;Creates the next version as a draft; note is its change note.
Parameters
key
string
body
object & VersionNoteBody
Returns
Promise<{ config: unknown; createdAt: Date; createdBy?: string | null; description?: string | null; enabled: boolean; id: string; key: string; name: string; note?: string | null; severity: "info" | "warn" | "block"; status: "published" | "draft" | "pending_approval" | "archived"; tags: string[]; tenantId: string; type: | "app" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity"; updatedAt: Date; updatedBy?: string | null; version: number; weight?: number | null; }>
ruleDefinitions.validate
ts
validate: (body) => Promise<{
issues: object[];
ok: boolean;
}>;Validates a draft body without saving: errors block a save, warnings (a stale list, a disabled rule) do not.
Parameters
body
config
unknown
description?
string
enabled?
boolean
name
string
severity?
"info" | "warn" | "block"
tags?
string[]
type
| "app" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity"
weight?
number
Returns
Promise<{ issues: object[]; ok: boolean; }>
ruleSets
ts
ruleSets: object;Versioned, ordered groups of rules with an aggregation policy (/rule-sets).
ruleSets.get
ts
get: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
policy: | {
mode: "max_severity";
}
| {
bands: object[];
clamp: {
max: number;
min: number;
};
mode: "sum_weights";
}
| {
default: "approve" | "reject" | "manual_review";
mode: "first_match";
};
rules: object[];
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { policy: | { mode: "max_severity"; } | { bands: object[]; clamp: { max: number; min: number; }; mode: "sum_weights"; } | { default: "approve" | "reject" | "manual_review"; mode: "first_match"; }; rules: object[]; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; useCase: "custom" | "onboarding" | "underwriting" | "monitoring"; version: number; }>
ruleSets.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
ruleSets.publish
ts
publish: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
policy: | {
mode: "max_severity";
}
| {
bands: object[];
clamp: {
max: number;
min: number;
};
mode: "sum_weights";
}
| {
default: "approve" | "reject" | "manual_review";
mode: "first_match";
};
rules: object[];
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { policy: | { mode: "max_severity"; } | { bands: object[]; clamp: { max: number; min: number; }; mode: "sum_weights"; } | { default: "approve" | "reject" | "manual_review"; mode: "first_match"; }; rules: object[]; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; useCase: "custom" | "onboarding" | "underwriting" | "monitoring"; version: number; }>
ruleSets.updateDraft
ts
updateDraft: (key, version, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
policy: | {
mode: "max_severity";
}
| {
bands: object[];
clamp: {
max: number;
min: number;
};
mode: "sum_weights";
}
| {
default: "approve" | "reject" | "manual_review";
mode: "first_match";
};
rules: object[];
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
version: number;
}>;Saves the draft version in place (autosave); 409 once it has left draft. Without note the stored change note stays.
Parameters
key
string
version
number
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { policy: | { mode: "max_severity"; } | { bands: object[]; clamp: { max: number; min: number; }; mode: "sum_weights"; } | { default: "approve" | "reject" | "manual_review"; mode: "first_match"; }; rules: object[]; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; useCase: "custom" | "onboarding" | "underwriting" | "monitoring"; version: number; }>
ruleSets.upsert
ts
upsert: (key, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
policy: | {
mode: "max_severity";
}
| {
bands: object[];
clamp: {
max: number;
min: number;
};
mode: "sum_weights";
}
| {
default: "approve" | "reject" | "manual_review";
mode: "first_match";
};
rules: object[];
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
updatedAt: Date;
updatedBy?: string | null;
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
version: number;
}>;Creates the next version as a draft; note is its change note.
Parameters
key
string
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { policy: | { mode: "max_severity"; } | { bands: object[]; clamp: { max: number; min: number; }; mode: "sum_weights"; } | { default: "approve" | "reject" | "manual_review"; mode: "first_match"; }; rules: object[]; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; updatedAt: Date; updatedBy?: string | null; useCase: "custom" | "onboarding" | "underwriting" | "monitoring"; version: number; }>
ruleSets.validate
ts
validate: (body) => Promise<{
issues: object[];
ok: boolean;
}>;Validates a draft set without saving: unknown rules are errors, unpublished ones warnings.
Parameters
body
definition
{ policy: | { mode: "max_severity"; } | { bands: object[]; clamp?: { max?: number; min?: number; }; mode: "sum_weights"; } | { default?: "approve" | "reject" | "manual_review"; mode: "first_match"; }; rules: object[]; }
definition.policy
| { mode: "max_severity"; } | { bands: object[]; clamp?: { max?: number; min?: number; }; mode: "sum_weights"; } | { default?: "approve" | "reject" | "manual_review"; mode: "first_match"; }
definition.rules
object[]
description?
string
name
string
useCase?
"custom" | "onboarding" | "underwriting" | "monitoring"
Returns
Promise<{ issues: object[]; ok: boolean; }>
ruleTypes
ts
ruleTypes: object;ruleTypes.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
serviceUsers
ts
serviceUsers: object;Service users and their keys in the identity provider. See service-users.ts.
serviceUsers.create
ts
create: (body) => Promise<{
createdAt: Date | null;
enabled: boolean;
id: string;
keys: object[];
lastCallAt: Date | null;
name: string;
purpose: string | null;
role: "admin" | "analyst" | "integration" | null;
}>;Parameters
body
name
string
purpose?
string
role?
"admin" | "analyst" | "integration"
Returns
Promise<{ createdAt: Date | null; enabled: boolean; id: string; keys: object[]; lastCallAt: Date | null; name: string; purpose: string | null; role: "admin" | "analyst" | "integration" | null; }>
serviceUsers.issueKey
ts
issueKey: (id, expiresAt) => Promise<{
expiresAt: Date;
id: string;
token: string;
}>;Parameters
id
string
expiresAt
Date
Returns
Promise<{ expiresAt: Date; id: string; token: string; }>
serviceUsers.list
ts
list: () => Promise<Page<{
createdAt: Date | null;
enabled: boolean;
id: string;
keys: object[];
lastCallAt: Date | null;
name: string;
purpose: string | null;
role: "admin" | "analyst" | "integration" | null;
}>>;Returns
Promise<Page<{ createdAt: Date | null; enabled: boolean; id: string; keys: object[]; lastCallAt: Date | null; name: string; purpose: string | null; role: "admin" | "analyst" | "integration" | null; }>>
serviceUsers.revokeKey
ts
revokeKey: (id, keyId) => Promise<void>;Parameters
id
string
keyId
string
Returns
Promise<void>
serviceUsers.update
ts
update: (id, body) => Promise<{
createdAt: Date | null;
enabled: boolean;
id: string;
keys: object[];
lastCallAt: Date | null;
name: string;
purpose: string | null;
role: "admin" | "analyst" | "integration" | null;
}>;Parameters
id
string
body
enabled?
boolean
purpose?
string
Returns
Promise<{ createdAt: Date | null; enabled: boolean; id: string; keys: object[]; lastCallAt: Date | null; name: string; purpose: string | null; role: "admin" | "analyst" | "integration" | null; }>
stats
ts
stats: object;Aggregates: Home's overview, per-definition activity, SLA figures, rule hits per day.
stats.definitions
ts
definitions: <K>(kind, query) => Promise<DefinitionStatsOf<K>>;Activity per key of one kind over the window; idle keys are absent (definitions:read).
Type Parameters
K
K extends "workflow" | "rule" | "collection_flow"
Parameters
kind
K
query?
StatsWindowParams = {}
Returns
Promise<DefinitionStatsOf<K>>
stats.flowFunnel
ts
flowFunnel: (key, query) => Promise<{
days: number;
key: string;
opened: number;
steps: object[];
submitted: number;
uploadFailures: object[];
}>;Where a flow's applicants got to over the window: per step, who was shown it and where the unsent stopped, and the uploads that failed (definitions:read).
Parameters
key
string
query?
StatsWindowParams = {}
Returns
Promise<{ days: number; key: string; opened: number; steps: object[]; submitted: number; uploadFailures: object[]; }>
stats.overview
ts
overview: (query) => Promise<{
attention: (
| {
count: number;
kind: "approvals";
oldest: object[];
}
| {
app: string;
kind: "app_disabled";
}
| {
app: string;
kind: "app_unconfigured";
missingSecrets: string[];
}
| {
app: string;
calls: number;
circuit?: "open" | "half_open";
failures: number;
kind: "app_failing";
timeouts: number;
}
| {
at: Date;
error: string | null;
kind: "export_failed";
name: string;
scheduleId: string;
}
| {
count: number;
endpointId: string;
event: string;
kind: "webhook_exhausted";
url: string;
})[];
cases: {
breached: number;
dueToday: number;
dueTodayMine: number;
oldestBreachMs: number | null;
open: number;
unassigned: number;
};
runs24h?: {
autoDecidedPct: number | null;
completed: number;
failed: number;
p95Ms: number | null;
total: number;
waiting: number;
};
}>;Open cases (unassigned, breached, due today, mine), the last 24 hours of runs (with runs:read) and what the caller may act on (cases:read).
Parameters
query?
StatsOverviewParams = {}
Returns
Promise<{ attention: ( | { count: number; kind: "approvals"; oldest: object[]; } | { app: string; kind: "app_disabled"; } | { app: string; kind: "app_unconfigured"; missingSecrets: string[]; } | { app: string; calls: number; circuit?: "open" | "half_open"; failures: number; kind: "app_failing"; timeouts: number; } | { at: Date; error: string | null; kind: "export_failed"; name: string; scheduleId: string; } | { count: number; endpointId: string; event: string; kind: "webhook_exhausted"; url: string; })[]; cases: { breached: number; dueToday: number; dueTodayMine: number; oldestBreachMs: number | null; open: number; unassigned: number; }; runs24h?: { autoDecidedPct: number | null; completed: number; failed: number; p95Ms: number | null; total: number; waiting: number; }; }>
stats.ruleHits
ts
ruleHits: (key, query) => Promise<{
backtest: | {
daily: object[];
finishedAt?: Date | null;
id: string;
version: number;
}
| null;
days: number;
key: string;
recorded: object[];
timeZone: string;
}>;A rule's recorded hits per UTC day, and a backtested version's (definitions:read).
Parameters
key
string
query?
RuleHitsParams = {}
Returns
Promise<{ backtest: | { daily: object[]; finishedAt?: Date | null; id: string; version: number; } | null; days: number; key: string; recorded: object[]; timeZone: string; }>
stats.sla
ts
sla: (query) => Promise<{
breached: number;
byWorkflow: object[];
days: number;
decided: number;
medianDecideMs: number | null;
openPastDue: number;
withinPct: number | null;
}>;SLA attainment, breaches and time to decide over the window, per workflow (cases:read).
Parameters
query?
StatsWindowParams = {}
Returns
Promise<{ breached: number; byWorkflow: object[]; days: number; decided: number; medianDecideMs: number | null; openPastDue: number; withinPct: number | null; }>
subjects
ts
subjects: object;Subjects: create, list or page with filters and expansions, get, timeline.
subjects.create
ts
create: (body) => Promise<{
createdAt: Date;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
riskScore?: number | null;
status: "active" | "blocked" | "closed";
tags: string[];
tenantId: string;
updatedAt: Date;
}>;Parameters
body
data?
Record<string, unknown>
externalId?
string
kind
"user" | "merchant" | "seller"
tags?
string[]
Returns
Promise<{ createdAt: Date; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; riskScore?: number | null; status: "active" | "blocked" | "closed"; tags: string[]; tenantId: string; updatedAt: Date; }>
subjects.exportCsv
ts
exportCsv: (query) => Promise<string>;Every subject matching the list filters as CSV, up to 10,000 rows.
Parameters
query?
Omit<SubjectListQuery, "limit" | "offset"> = {}
Returns
Promise<string>
subjects.flags
ts
flags: (id) => Promise<object[]>;Signals derived for it (rule hits and a waiting request need cases:read).
Parameters
id
string
Returns
Promise<object[]>
subjects.get
ts
get: (id) => Promise<{
createdAt: Date;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
lastSeenAt: Date | null;
riskScore?: number | null;
status: "active" | "blocked" | "closed";
tags: string[];
tenantId: string;
updatedAt: Date;
}>;The subject with lastSeenAt, its newest event's time.
Parameters
id
string
Returns
Promise<{ createdAt: Date; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; lastSeenAt: Date | null; riskScore?: number | null; status: "active" | "blocked" | "closed"; tags: string[]; tenantId: string; updatedAt: Date; }>
subjects.links
ts
links: (id) => Promise<object[]>;Subjects sharing a device, card, IP address, email, address or referral with it.
Parameters
id
string
Returns
Promise<object[]>
subjects.list
ts
list: (query) => Promise<object[]>;Subjects matching query: search matches the external id and data.name / data.legalName; riskScoreMin/riskScoreMax bound the risk score (subjects:read).
Parameters
query?
country?
string
kind?
"user" | "merchant" | "seller"
lastDecision?
"approve" | "reject" | "manual_review" | "none"
limit?
number
offset?
number
riskScoreMax?
number
riskScoreMin?
number
search?
string
status?
"active" | "blocked" | "closed"
Returns
Promise<object[]>
subjects.listPage
ts
listPage: (query) => Promise<Page<{
createdAt: Date;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
lastDecision?: | {
createdAt: Date;
outcome: "approve" | "reject" | "manual_review";
}
| null;
openCases?: number;
riskScore?: number | null;
status: "active" | "blocked" | "closed";
tags: string[];
tenantId: string;
updatedAt: Date;
}>>;One page of list with the number of matches. expand adds openCases and lastDecision per subject (both need cases:read).
Parameters
query?
SubjectPageQuery = {}
Returns
Promise<Page<{ createdAt: Date; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; lastDecision?: | { createdAt: Date; outcome: "approve" | "reject" | "manual_review"; } | null; openCases?: number; riskScore?: number | null; status: "active" | "blocked" | "closed"; tags: string[]; tenantId: string; updatedAt: Date; }>>
subjects.timeline
ts
timeline: (id, query) => Promise<{
items: object[];
nextCursor: string | null;
}>;One page of the subject's history, newest first (subjects:read); entries of kinds the caller may not read are omitted by the API. Pass the page's nextCursor as cursor for the next one, until it is null.
Parameters
id
string
query?
cursor?
string
from?
Date
kinds?
( | "event" | "decision" | "note" | "document" | "submission" | "case" | "run" | "audit")[]
limit?
number
to?
Date
Returns
Promise<{ items: object[]; nextCursor: string | null; }>
subjects.update
ts
update: (id, body) => Promise<{
createdAt: Date;
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
externalId?: string | null;
id: string;
kind: "user" | "merchant" | "seller";
riskScore?: number | null;
status: "active" | "blocked" | "closed";
tags: string[];
tenantId: string;
updatedAt: Date;
}>;Changes data (a JSON merge patch: send only what changes, null removes a key), tags or status (subjects:write).
Parameters
id
string
body
data?
Record<string, unknown>
status?
"active" | "blocked" | "closed"
tags?
string[]
Returns
Promise<{ createdAt: Date; data: z.ZodRecord<z.ZodString, z.ZodUnknown>; externalId?: string | null; id: string; kind: "user" | "merchant" | "seller"; riskScore?: number | null; status: "active" | "blocked" | "closed"; tags: string[]; tenantId: string; updatedAt: Date; }>
tenants
ts
tenants: TenantsClient;Tenant settings such as the embed origin allow-list (tenants:settings).
users
ts
users: object;The reviewer directory, for assignment and resolving assignee names.
users.list
ts
list: (query) => Promise<object[]>;Parameters
query?
UserListQuery = {}
Returns
Promise<object[]>
webhooks
ts
webhooks: object;Outbound webhook endpoints, their deliveries and the event catalogue. See webhooks.ts.
webhooks.create
ts
create: (body) => Promise<{
createdAt: Date;
description: string | null;
enabled: boolean;
events: (
| "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested")[];
failing: boolean;
id: string;
lastDeliveryAt: Date | null;
previousSecretExpiresAt: Date | null;
secret: string;
updatedAt: Date;
url: string;
}>;Parameters
body
description?
string
enabled?
boolean
events
( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]
url
string
Returns
Promise<{ createdAt: Date; description: string | null; enabled: boolean; events: ( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]; failing: boolean; id: string; lastDeliveryAt: Date | null; previousSecretExpiresAt: Date | null; secret: string; updatedAt: Date; url: string; }>
webhooks.deliveries
ts
deliveries: (query) => Promise<Page<{
attempts: number;
createdAt: Date;
deliveredAt: Date | null;
endpointId: string;
event: | "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested";
eventId: string;
id: string;
lastError: string | null;
lastResponseCode: number | null;
nextAttemptAt: Date | null;
payload: {
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
id: string;
occurredAt: Date;
resource: {
id: string;
type: string;
};
tenantId: string;
type: | "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested"
| "ping";
};
resource: {
id: string;
type: string;
};
status: "failed" | "exhausted" | "pending" | "delivered";
workflowRunId: string | null;
}>>;Parameters
query?
WebhookDeliveryQuery = {}
Returns
Promise<Page<{ attempts: number; createdAt: Date; deliveredAt: Date | null; endpointId: string; event: | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested"; eventId: string; id: string; lastError: string | null; lastResponseCode: number | null; nextAttemptAt: Date | null; payload: { data: z.ZodRecord<z.ZodString, z.ZodUnknown>; id: string; occurredAt: Date; resource: { id: string; type: string; }; tenantId: string; type: | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested" | "ping"; }; resource: { id: string; type: string; }; status: "failed" | "exhausted" | "pending" | "delivered"; workflowRunId: string | null; }>>
webhooks.events
ts
events: () => Promise<object[]>;Returns
Promise<object[]>
webhooks.get
ts
get: (id) => Promise<{
createdAt: Date;
description: string | null;
enabled: boolean;
events: (
| "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested")[];
failing: boolean;
id: string;
lastDeliveryAt: Date | null;
previousSecretExpiresAt: Date | null;
updatedAt: Date;
url: string;
}>;Parameters
id
string
Returns
Promise<{ createdAt: Date; description: string | null; enabled: boolean; events: ( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]; failing: boolean; id: string; lastDeliveryAt: Date | null; previousSecretExpiresAt: Date | null; updatedAt: Date; url: string; }>
webhooks.list
ts
list: () => Promise<Page<{
createdAt: Date;
description: string | null;
enabled: boolean;
events: (
| "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested")[];
failing: boolean;
id: string;
lastDeliveryAt: Date | null;
previousSecretExpiresAt: Date | null;
updatedAt: Date;
url: string;
}>>;Returns
Promise<Page<{ createdAt: Date; description: string | null; enabled: boolean; events: ( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]; failing: boolean; id: string; lastDeliveryAt: Date | null; previousSecretExpiresAt: Date | null; updatedAt: Date; url: string; }>>
webhooks.remove
ts
remove: (id) => Promise<void>;Parameters
id
string
Returns
Promise<void>
webhooks.retryDelivery
ts
retryDelivery: (id) => Promise<{
attempts: number;
createdAt: Date;
deliveredAt: Date | null;
endpointId: string;
event: | "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested";
eventId: string;
id: string;
lastError: string | null;
lastResponseCode: number | null;
nextAttemptAt: Date | null;
payload: {
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
id: string;
occurredAt: Date;
resource: {
id: string;
type: string;
};
tenantId: string;
type: | "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested"
| "ping";
};
resource: {
id: string;
type: string;
};
status: "failed" | "exhausted" | "pending" | "delivered";
workflowRunId: string | null;
}>;Parameters
id
string
Returns
Promise<{ attempts: number; createdAt: Date; deliveredAt: Date | null; endpointId: string; event: | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested"; eventId: string; id: string; lastError: string | null; lastResponseCode: number | null; nextAttemptAt: Date | null; payload: { data: z.ZodRecord<z.ZodString, z.ZodUnknown>; id: string; occurredAt: Date; resource: { id: string; type: string; }; tenantId: string; type: | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested" | "ping"; }; resource: { id: string; type: string; }; status: "failed" | "exhausted" | "pending" | "delivered"; workflowRunId: string | null; }>
webhooks.rotateSecret
ts
rotateSecret: (id) => Promise<{
previousSecretExpiresAt: Date;
secret: string;
}>;Parameters
id
string
Returns
Promise<{ previousSecretExpiresAt: Date; secret: string; }>
webhooks.test
ts
test: (id) => Promise<{
delivered: boolean;
error?: string;
latencyMs: number;
responseCode: number | null;
}>;Parameters
id
string
Returns
Promise<{ delivered: boolean; error?: string; latencyMs: number; responseCode: number | null; }>
webhooks.update
ts
update: (id, body) => Promise<{
createdAt: Date;
description: string | null;
enabled: boolean;
events: (
| "decision.created"
| "case.created"
| "case.assigned"
| "case.decided"
| "case.closed"
| "case.sla.breached"
| "run.completed"
| "run.failed"
| "approval.requested"
| "approval.decided"
| "app.circuit.opened"
| "submission.link_requested")[];
failing: boolean;
id: string;
lastDeliveryAt: Date | null;
previousSecretExpiresAt: Date | null;
updatedAt: Date;
url: string;
}>;Parameters
id
string
body
description?
string
enabled?
boolean
events
( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]
url
string
Returns
Promise<{ createdAt: Date; description: string | null; enabled: boolean; events: ( | "decision.created" | "case.created" | "case.assigned" | "case.decided" | "case.closed" | "case.sla.breached" | "run.completed" | "run.failed" | "approval.requested" | "approval.decided" | "app.circuit.opened" | "submission.link_requested")[]; failing: boolean; id: string; lastDeliveryAt: Date | null; previousSecretExpiresAt: Date | null; updatedAt: Date; url: string; }>
workflowDefinitions
ts
workflowDefinitions: object;workflowDefinitions.contextPaths
ts
contextPaths: (body) => Promise<object[]>;The run-context paths stepId can read in a workflow definition (saved or not), with their type and the step that writes them; every step's writes without stepId.
Parameters
body
definition
unknown
stepId?
string
Returns
Promise<object[]>
workflowDefinitions.get
ts
get: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
steps: (
| {
id: string;
name?: string;
next?: string;
outputKey: string;
ruleKeys?: ...[];
ruleSetKey?: string;
type: "evaluate_rules";
}
| {
action: string;
app: string;
id: string;
input: z.ZodDefault<z.ZodRecord<..., ...>>;
inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>;
name?: string;
next?: string;
outputKey: string;
retry?: {
initialIntervalSeconds?: ...;
maximumAttempts?: ...;
};
type: "call_app";
}
| {
flowKey: string;
id: string;
name?: string;
next?: string;
outputKey: string;
timeoutSeconds?: number;
type: "wait_for_collection";
}
| {
caseType: string;
id: string;
name?: string;
next?: string;
outputKey: string;
priority: "high" | "low" | "medium" | "critical";
priorityFrom?: string;
queueFrom?: string;
slaHours?: number;
type: "create_case";
}
| {
id: string;
manualDecisionKey: string;
mode: "fixed" | "from_rules";
name?: string;
next?: string;
outcome?: "approve" | "reject" | "manual_review";
rulesKey: string;
type: "emit_decision";
}
| {
conditions: object[];
default: string;
id: string;
name?: string;
next?: string;
type: "branch";
})[];
ui?: {
positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>;
};
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
trigger: "manual" | "event" | "subject.created";
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; steps: ( | { id: string; name?: string; next?: string; outputKey: string; ruleKeys?: ...[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input: z.ZodDefault<z.ZodRecord<..., ...>>; inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ...; maximumAttempts?: ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey: string; priority: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey: string; mode: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]; ui?: { positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>; }; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; trigger: "manual" | "event" | "subject.created"; updatedAt: Date; updatedBy?: string | null; version: number; }>
workflowDefinitions.list
ts
list: () => Promise<object[]>;Returns
Promise<object[]>
workflowDefinitions.publish
ts
publish: (key) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
steps: (
| {
id: string;
name?: string;
next?: string;
outputKey: string;
ruleKeys?: ...[];
ruleSetKey?: string;
type: "evaluate_rules";
}
| {
action: string;
app: string;
id: string;
input: z.ZodDefault<z.ZodRecord<..., ...>>;
inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>;
name?: string;
next?: string;
outputKey: string;
retry?: {
initialIntervalSeconds?: ...;
maximumAttempts?: ...;
};
type: "call_app";
}
| {
flowKey: string;
id: string;
name?: string;
next?: string;
outputKey: string;
timeoutSeconds?: number;
type: "wait_for_collection";
}
| {
caseType: string;
id: string;
name?: string;
next?: string;
outputKey: string;
priority: "high" | "low" | "medium" | "critical";
priorityFrom?: string;
queueFrom?: string;
slaHours?: number;
type: "create_case";
}
| {
id: string;
manualDecisionKey: string;
mode: "fixed" | "from_rules";
name?: string;
next?: string;
outcome?: "approve" | "reject" | "manual_review";
rulesKey: string;
type: "emit_decision";
}
| {
conditions: object[];
default: string;
id: string;
name?: string;
next?: string;
type: "branch";
})[];
ui?: {
positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>;
};
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
trigger: "manual" | "event" | "subject.created";
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Parameters
key
string
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; steps: ( | { id: string; name?: string; next?: string; outputKey: string; ruleKeys?: ...[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input: z.ZodDefault<z.ZodRecord<..., ...>>; inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ...; maximumAttempts?: ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey: string; priority: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey: string; mode: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]; ui?: { positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>; }; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; trigger: "manual" | "event" | "subject.created"; updatedAt: Date; updatedBy?: string | null; version: number; }>
workflowDefinitions.updateDraft
ts
updateDraft: (key, version, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
steps: (
| {
id: string;
name?: string;
next?: string;
outputKey: string;
ruleKeys?: ...[];
ruleSetKey?: string;
type: "evaluate_rules";
}
| {
action: string;
app: string;
id: string;
input: z.ZodDefault<z.ZodRecord<..., ...>>;
inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>;
name?: string;
next?: string;
outputKey: string;
retry?: {
initialIntervalSeconds?: ...;
maximumAttempts?: ...;
};
type: "call_app";
}
| {
flowKey: string;
id: string;
name?: string;
next?: string;
outputKey: string;
timeoutSeconds?: number;
type: "wait_for_collection";
}
| {
caseType: string;
id: string;
name?: string;
next?: string;
outputKey: string;
priority: "high" | "low" | "medium" | "critical";
priorityFrom?: string;
queueFrom?: string;
slaHours?: number;
type: "create_case";
}
| {
id: string;
manualDecisionKey: string;
mode: "fixed" | "from_rules";
name?: string;
next?: string;
outcome?: "approve" | "reject" | "manual_review";
rulesKey: string;
type: "emit_decision";
}
| {
conditions: object[];
default: string;
id: string;
name?: string;
next?: string;
type: "branch";
})[];
ui?: {
positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>;
};
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
trigger: "manual" | "event" | "subject.created";
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Saves the draft version in place (autosave); 409 once it has left draft. Without note the stored change note stays.
Parameters
key
string
version
number
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; steps: ( | { id: string; name?: string; next?: string; outputKey: string; ruleKeys?: ...[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input: z.ZodDefault<z.ZodRecord<..., ...>>; inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ...; maximumAttempts?: ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey: string; priority: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey: string; mode: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]; ui?: { positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>; }; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; trigger: "manual" | "event" | "subject.created"; updatedAt: Date; updatedBy?: string | null; version: number; }>
workflowDefinitions.upsert
ts
upsert: (key, body) => Promise<{
createdAt: Date;
createdBy?: string | null;
definition: {
entryStepId: string;
steps: (
| {
id: string;
name?: string;
next?: string;
outputKey: string;
ruleKeys?: ...[];
ruleSetKey?: string;
type: "evaluate_rules";
}
| {
action: string;
app: string;
id: string;
input: z.ZodDefault<z.ZodRecord<..., ...>>;
inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>;
name?: string;
next?: string;
outputKey: string;
retry?: {
initialIntervalSeconds?: ...;
maximumAttempts?: ...;
};
type: "call_app";
}
| {
flowKey: string;
id: string;
name?: string;
next?: string;
outputKey: string;
timeoutSeconds?: number;
type: "wait_for_collection";
}
| {
caseType: string;
id: string;
name?: string;
next?: string;
outputKey: string;
priority: "high" | "low" | "medium" | "critical";
priorityFrom?: string;
queueFrom?: string;
slaHours?: number;
type: "create_case";
}
| {
id: string;
manualDecisionKey: string;
mode: "fixed" | "from_rules";
name?: string;
next?: string;
outcome?: "approve" | "reject" | "manual_review";
rulesKey: string;
type: "emit_decision";
}
| {
conditions: object[];
default: string;
id: string;
name?: string;
next?: string;
type: "branch";
})[];
ui?: {
positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>;
};
};
description?: string | null;
id: string;
key: string;
name: string;
note?: string | null;
status: "published" | "draft" | "pending_approval" | "archived";
tenantId: string;
trigger: "manual" | "event" | "subject.created";
updatedAt: Date;
updatedBy?: string | null;
version: number;
}>;Creates the next version as a draft; note is its change note.
Parameters
key
string
body
object & VersionNoteBody
Returns
Promise<{ createdAt: Date; createdBy?: string | null; definition: { entryStepId: string; steps: ( | { id: string; name?: string; next?: string; outputKey: string; ruleKeys?: ...[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input: z.ZodDefault<z.ZodRecord<..., ...>>; inputMapping: z.ZodDefault<z.ZodRecord<..., ...>>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ...; maximumAttempts?: ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey: string; priority: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey: string; mode: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]; ui?: { positions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<..., ...>>>; }; }; description?: string | null; id: string; key: string; name: string; note?: string | null; status: "published" | "draft" | "pending_approval" | "archived"; tenantId: string; trigger: "manual" | "event" | "subject.created"; updatedAt: Date; updatedBy?: string | null; version: number; }>
workflowDefinitions.validate
ts
validate: (body) => Promise<{
issues: object[];
ok: boolean;
}>;Validates a draft body without saving; issues carry step ids.
Parameters
body
definition
{ entryStepId: string; steps: ( | { id: string; name?: string; next?: string; outputKey?: string; ruleKeys?: string[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input?: Record<string, unknown>; inputMapping?: Record<string, string>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ... | ...; maximumAttempts?: ... | ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey?: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey?: string; priority?: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey?: string; mode?: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey?: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]; ui?: { positions?: Record<string, { x: number; y: number; }>; }; }
definition.entryStepId
string
definition.steps
( | { id: string; name?: string; next?: string; outputKey?: string; ruleKeys?: string[]; ruleSetKey?: string; type: "evaluate_rules"; } | { action: string; app: string; id: string; input?: Record<string, unknown>; inputMapping?: Record<string, string>; name?: string; next?: string; outputKey: string; retry?: { initialIntervalSeconds?: ... | ...; maximumAttempts?: ... | ...; }; type: "call_app"; } | { flowKey: string; id: string; name?: string; next?: string; outputKey?: string; timeoutSeconds?: number; type: "wait_for_collection"; } | { caseType: string; id: string; name?: string; next?: string; outputKey?: string; priority?: "high" | "low" | "medium" | "critical"; priorityFrom?: string; queueFrom?: string; slaHours?: number; type: "create_case"; } | { id: string; manualDecisionKey?: string; mode?: "fixed" | "from_rules"; name?: string; next?: string; outcome?: "approve" | "reject" | "manual_review"; rulesKey?: string; type: "emit_decision"; } | { conditions: object[]; default: string; id: string; name?: string; next?: string; type: "branch"; })[]
definition.ui?
{ positions?: Record<string, { x: number; y: number; }>; }
definition.ui.positions?
Record<string, { x: number; y: number; }>
description?
string
name
string
trigger?
"manual" | "event" | "subject.created"
Returns
Promise<{ issues: object[]; ok: boolean; }>
workflowRuns
ts
workflowRuns: WorkflowRunsClient;Runs: start, read, list or page across the tenant with filters, summary, history.