Prerequisites
- Kadoa account with API key
- SDK installed:
npm install @kadoa/node-sdk or uv add kadoa-sdk
Introduction
Data validation lets you define rules that detect anomalies or unexpected results after a workflow run.
SDK Methods
Generate Validation Rules
Auto-generate rules from your schema or use natural language to create targeted rules.
// Analyzes your schema and recent data to suggest validation rules
// Rules are created in 'preview' status for review before enabling
// Note: Requires a workflow with completed extraction data
await client.validation.rules.generateRules({
workflowId,
});
// Generate rule with natural language
// Uses columns from the seeded workflow schema
await client.validation.rules.generateRule({
workflowId,
selectedColumns: columns.slice(0, 2),
userPrompt: "Not null values",
});
Manage Validation Rules
List, approve, and update rule status. Rules start in preview status and must be approved before they run automatically.
// List rules
const rules = await client.validation.rules.listRules({
workflowId,
status: "preview",
});
console.log("Rules:", rules);
Approve Validation Rules
Approve preview rules to activate them. Rules in preview status do not run until approved. You can approve multiple rules at once using bulk approval.
// Get all preview rules for a workflow
const previewRules = await client.validation.rules.listRules({
workflowId,
status: "preview",
});
// Approve all preview rules in bulk
const ruleIds = previewRules.data.map((rule) => rule.id);
const result = await client.validation.rules.bulkApproveRules({
workflowId,
ruleIds,
});
console.log(`Approved ${result.data.approvedCount} rules`);
console.log(`Skipped ${result.data.skippedCount} rules`);
Only rules with preview status can be approved. Rules that are already enabled or disabled will be skipped.
Delete Validation Rules
Delete rules you no longer need. You can delete multiple rules at once using bulk deletion.
// Delete specific rules in bulk
const ruleIdsToDelete = ["rule-1", "rule-2", "rule-3"];
const result = await client.validation.rules.bulkDeleteRules({
workflowId,
ruleIds: ruleIdsToDelete,
reason: "Rules no longer needed after schema update", // optional
});
console.log(`Deleted ${result.data.deletedCount} rules`);
Deleting rules is permanent. Consider disabling rules instead if you may need them later.
Run Validation
// Schedule validation for a workflow job
const response = await client.validation.schedule(workflowId, jobId);
await client.validation.waitUntilCompleted(response.validationId);
const validation = await client.validation.getLatest(workflowId);
const anomalies = await client.validation.getAnomalies(
response.validationId,
);
console.log("Validation:", validation);
console.log("Anomalies:", anomalies);
API Endpoints
List Validation Rules
Retrieve all validation rules for a workflow.
View full API reference →
GET /v5/workflows/{workflowId}/validation/rules
Generate Validation Rules
Auto-generate validation rules based on your schema and sample data.
View full API reference →
POST /v5/workflows/{workflowId}/validation/rules/generate
Create Targeted Validation Rules
Generate rules for specific columns with custom hints.
View full API reference →
POST /v5/workflows/{workflowId}/validation/rules/generate-targeted
{
"columns": ["price", "email"],
"hints": "Check that prices are positive and emails are valid"
}
Bulk Approve Validation Rules
Approve multiple preview rules at once to activate them.
View full API reference →
POST /v4/data-validation/rules/actions/bulk-approve
{
"workflowId": "workflow-123",
"ruleIds": ["rule-1", "rule-2", "rule-3"]
}
Bulk Delete Validation Rules
Delete multiple rules at once.
View full API reference →
POST /v4/data-validation/rules/actions/bulk-delete
{
"workflowId": "workflow-123",
"ruleIds": ["rule-1", "rule-2", "rule-3"],
"reason": "Optional reason for audit trail"
}
Update validation configuration for a workflow.
View full API reference →
PUT /v5/workflows/{workflowId}/validation/config
{
"enabled": true,
"keyFields": ["product_id"]
}
Toggle Validation
Enable or disable validation for a workflow.
View full API reference →
PATCH /v5/workflows/{workflowId}/validation/toggle
{
"enabled": true
}
Get Latest Validation Results
Retrieve the most recent validation results.
View full API reference →
GET /v5/workflows/{workflowId}/validation/latest
Rule Structure and Key Fields
For detailed information about rule SQL structure, key fields, and validation results format, see Data Validation Concepts.
Notifications
Enable validation notifications to get alerted when issues are detected:
POST /v5/notifications/settings
{
"workflowId": "workflow-123",
"eventType": "validation_issues_detected",
"enabled": true,
"channelIds": ["channel-456"]
}
Want to configure validation through the UI?See the UI Data Validation guide to set up validation visually in the dashboard.