- Adopt starter templates: import ready-made trees for common verticals and customize them
- Build from scratch: create your own trees, nodes, and attributes entirely
Option A: Adopt starter templates
LightOn ships with starter templates for legal, finance, healthcare, tech, and manufacturing. Browse what’s available, adopt the ones you need, then customize.browse_templates.py
adopt_templates.py
Adoption behavior:
- Trees are adopted wholesale: you cannot pick individual branches from a template.
- Adoption is idempotent: re-adopting the same tree updates existing nodes based on their path. It does not auto-delete nodes you’ve removed or added since the last adoption.
- After adoption, all content types are fully yours. The link to the original template is gone.
Option B: Build from scratch
Here’s what we’re going to build: All writes go to a single endpoint with anaction field. Every action is idempotent and safe to replay. You can send a single action object or a JSON array to batch multiple actions in one call.
Step 1: Create your first Content Type
Start from zero and create a root content type calledcontract.
define_root_content_type.py
201 Created on first call, 200 OK if the node already exists (idempotent update). This makes scripts safe to run in CI pipelines or onboarding automations.
path is the unique identifier you’ll use everywhere: to classify files, define attributes, and filter searches. For a root node, path equals code.
inherit_attributes defaults to true, which means any attributes you define on contract are automatically available to all child types (contract:nda, contract:service-agreement, etc.). You define shared fields once on the parent.
Step 2: Build a tree of Content Types
Add child nodes. The path separator is:. LightOn builds the full path for you from parent_path + code.
define_child_content_types.py
Read your classification tree at any time
read_tree.py
Step 3: Define attributes
Attributes are the typed fields you want to store per document. Define them on a node, and ifinherit_attributes: true, all children get them too.
See Rules & constraints for naming restrictions, type immutability, and other validation rules.
Shared attributes on contract (inherited by all subtypes)
define_shared_attributes.py
contract has inherit_attributes: true, every child type (contract:nda, contract:service-agreement, etc.) automatically exposes these four attributes. You don’t need to redefine them.
NDA-specific attributes (only on contract:nda)
define_nda_attributes.py
Service agreement-specific attributes
define_sa_attributes.py
How inheritance works
Attribute inheritance is resolved at query time: when you read a file’s facets, LightOn walks up the tree and collects attributes from each ancestor withinherit_attributes: true. Adding an attribute to a parent immediately makes it available on all descendants, no migration needed.
For details on breaking the chain or shadowing inherited attributes, see Rules & constraints.
Full script: build the contract classification tree in one batch call
All schema operations can be batched in a single request by sending a JSON array. LightOn processes them in order and fails fast on the first error. This is the recommended approach for onboarding automations.batch_tree.py
status (201 created, 200 updated) and a data object.
If any action fails, the batch stops at that point. Actions before the failure are committed; actions after are not.
Verify: read your complete classification tree
verify_tree.py
Action reference
| Action | What it does |
|---|---|
define_content_type | Create or update a content type node (idempotent) |
undefine_content_type | Delete a node, its subtree, and all file classifications + values under it |
define_attribute | Create or update an attribute on a content type (idempotent) |
undefine_attribute | Delete an attribute and all its stored values across all files |