Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kadoa.com/llms.txt

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

Templates let you define reusable configurations — prompt, schema, data validation rules, and notification settings — that can be linked to multiple workflows and versioned over time.

Prerequisites

  • Kadoa account with API key
  • SDK installed: npm install @kadoa/node-sdk
Templates are currently available in the Node SDK. Python SDK support is coming soon.

When to Use Templates

Use templates when you:
  • Run the same extraction logic across multiple websites
  • Want to roll out prompt or schema changes to many workflows at once
  • Need versioned configurations with the ability to roll back
  • Share standardized extraction setups across your team
For one-off extractions, inline schema definitions are simpler and don’t require template management.

Create a Template

const template = await client.template.create({
  name: "Job Listing",
  description: "Extracts job postings with title, company, and location",
});

console.log("Template created:", template.id);

List Templates

const templates = await client.template.list();

for (const template of templates) {
  console.log(`${template.id}: ${template.name}`);
}

Get a Template

Retrieve a template by ID, including all published versions:
const template = await client.template.get("TEMPLATE_ID");

console.log(template.name);
console.log(template.description);
console.log(template.versions); // Array of published versions

Update a Template

Modify a template’s name or description:
const updated = await client.template.update("TEMPLATE_ID", {
  name: "Updated Job Listing",
  description: "Now includes salary range",
});

console.log("Template updated:", updated.id);

Delete a Template

Deleting a template archives it. Existing linked workflows keep their current configuration but are unlinked.
await client.template.delete("TEMPLATE_ID");

Versioning

Templates support versioning so you can iterate on configurations and roll back if needed.

Publish a New Version

Each version can include prompt, schema fields, data validation rules, and notification settings:
const version = await client.template.createVersion("TEMPLATE_ID", {
  prompt: "Extract job listings including salary information",
  schemaEntity: "JobListing",
  schemaFields: [
    {
      name: "title",
      description: "Job title",
      fieldType: "SCHEMA",
      dataType: "STRING",
    },
    {
      name: "company",
      description: "Company name",
      fieldType: "SCHEMA",
      dataType: "STRING",
    },
    {
      name: "salary",
      description: "Salary range",
      fieldType: "SCHEMA",
      dataType: "STRING",
    },
  ],
});

console.log("Published version:", version.version);

Version Parameters

ParameterDescription
promptUser prompt to copy into linked workflows
schemaFieldsInline schema fields (mutually exclusive with schemaId)
schemaIdReference an existing saved schema (mutually exclusive with schemaFields)
schemaEntityEntity name for the schema
dataValidationValidation config and rules (regex, custom_sql, or llm)
notificationsNotification event-to-channel mappings

List Linked Workflows

const workflows = await client.template.listWorkflows("TEMPLATE_ID");

for (const workflow of workflows) {
  console.log(`${workflow.id}: ${workflow.name} (version ${workflow.templateVersion})`);
}

Save from Workflow

Create a template from an existing workflow’s configuration. Pass name to create a new template, or templateId to add a new version to an existing one:
// Create a new template from a workflow
const newTemplate = await client.template.createFromWorkflow({
  workflowId: "WORKFLOW_ID",
  name: "Product Scraper",
  description: "Created from existing product extraction workflow",
});

console.log("Template created:", newTemplate.templateId);
console.log("Version:", newTemplate.version);
To add as a new version to an existing template:
Node SDK
const newVersion = await client.template.createFromWorkflow({
  workflowId: "WORKFLOW_ID",
  templateId: "EXISTING_TEMPLATE_ID",
});

console.log("New version added:", newVersion.version);

List Template Schemas

View the schemas associated with a template’s versions:
const schemas = await client.template.listSchemas("TEMPLATE_ID");

for (const schema of schemas) {
  console.log(`${schema.id}: ${schema.name} (${schema.entity})`);
}