Skip to main content
POST
/
v4
/
data-validation
/
rules
/
actions
/
generate
cURL
curl --request POST \
  --url https://api.kadoa.com/v4/data-validation/rules/actions/generate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "userPrompt": "<string>",
  "workflowId": "<string>",
  "jobId": "<string>",
  "selectedColumns": [
    "<string>"
  ],
  "isPreviewRun": true
}
'
import requests

url = "https://api.kadoa.com/v4/data-validation/rules/actions/generate"

payload = {
"userPrompt": "<string>",
"workflowId": "<string>",
"jobId": "<string>",
"selectedColumns": ["<string>"],
"isPreviewRun": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
userPrompt: '<string>',
workflowId: '<string>',
jobId: '<string>',
selectedColumns: ['<string>'],
isPreviewRun: true
})
};

fetch('https://api.kadoa.com/v4/data-validation/rules/actions/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kadoa.com/v4/data-validation/rules/actions/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'userPrompt' => '<string>',
'workflowId' => '<string>',
'jobId' => '<string>',
'selectedColumns' => [
'<string>'
],
'isPreviewRun' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.kadoa.com/v4/data-validation/rules/actions/generate"

payload := strings.NewReader("{\n \"userPrompt\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"jobId\": \"<string>\",\n \"selectedColumns\": [\n \"<string>\"\n ],\n \"isPreviewRun\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.kadoa.com/v4/data-validation/rules/actions/generate")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"userPrompt\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"jobId\": \"<string>\",\n \"selectedColumns\": [\n \"<string>\"\n ],\n \"isPreviewRun\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.kadoa.com/v4/data-validation/rules/actions/generate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userPrompt\": \"<string>\",\n \"workflowId\": \"<string>\",\n \"jobId\": \"<string>\",\n \"selectedColumns\": [\n \"<string>\"\n ],\n \"isPreviewRun\": true\n}"

response = http.request(request)
puts response.read_body
{
  "error": false,
  "message": "<string>",
  "data": {
    "id": "abc123",
    "name": "Email Validation Rule",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z",
    "description": "<string>",
    "ruleType": "custom_sql",
    "workflowId": "<string>",
    "groupId": "<string>",
    "userId": "<string>",
    "teamId": "<string>",
    "targetColumns": [
      "<string>"
    ],
    "parameters": {
      "sql": "<string>",
      "params": [
        null
      ],
      "prompt": "<string>"
    },
    "disabledReason": "<string>",
    "metadata": {},
    "deletedAt": "2024-01-15T10:30:00.000Z",
    "deletedReason": "<string>"
  },
  "metadata": {
    "sampleDataCount": 123,
    "schemaFieldsCount": 123
  }
}
{
"error": true,
"message": "Authentication required"
}
{
"error": true,
"message": "Internal server error",
"details": {}
}

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json

Body

Rule generation request with user description

userPrompt
string
required
Minimum string length: 1
workflowId
string
required
jobId
string
selectedColumns
string[]
isPreviewRun
boolean

Response

200

AI-generated rule with creation metadata

error
enum<boolean>
required
Available options:
false
message
string
required
data
Rule · object
required

Complete validation rule with metadata and lifecycle information

metadata
object