API-Controlled Output Schemas
Register a JSON Schema once, then reference it on any transform. Lucidry generates against the schema and validates the result before it is stored, so an autonomous consumer never has to parse prose.
How it works
Define a JSON Schema
Register a Draft 2020-12 schema once. It is meta-validated on creation, so a malformed or oversized schema is refused with 400 before any transform uses it.
Reference it in a transform request
Pass custom_schema_id on a transform. The schema is injected into the model's structured output mode, so generation targets your exact field layout.
Output is validated, not trusted
Every generated payload is validated against the schema after generation. Only a conformant payload is stored as the deliverable.
Three attempts, with error feedback
A failing payload is sent back to the model together with its validation errors, up to three attempts. After that the request fails with 422 and the errors.
Manage schemas
Full CRUD over your organization's schemas.
curl -X POST https://lucidry.io/api/v1/schemas \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support Digest",
"content_type": "support_summary",
"schema_definition": {
"type": "object",
"properties": {
"ticket_id": { "type": "string" },
"summary": { "type": "string" },
"action_items": { "type": "array", "items": { "type": "string" } }
},
"required": ["ticket_id", "summary", "action_items"]
}
}'curl -X GET https://lucidry.io/api/v1/schemas \
-H "Authorization: Bearer YOUR_API_KEY"curl -X PUT https://lucidry.io/api/v1/schemas/sch_100 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Support Digest v2", "schema_definition": { "type": "object", "properties": { "summary": { "type": "string" } }, "required": ["summary"] } }'curl -X DELETE https://lucidry.io/api/v1/schemas/sch_100 \
-H "Authorization: Bearer YOUR_API_KEY"- JSON Schema Draft 2020-12: type, properties, required, items, enum, $defs, length, range and item-count constraints, and internal $ref.
- Complexity limits: maximum nesting depth 10 and maximum 100 properties across all levels.
- External $ref URIs are refused: only internal refs starting with # are accepted.
- Validators are compiled once and cached in memory, so repeated transforms against the same schema version skip the compile step.
- Schema API calls are limited to 60 per minute per API key.
Transform against a schema
Pass custom_schema_id to enforce the shape.
curl -X POST https://lucidry.io/api/v1/transform \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_artifact_id": "art_01",
"content_type": "custom",
"custom_schema_id": "sch_100"
}'- Generated output is parsed as JSON and validated against your schema before it is stored.
- Attempt 1 sends the schema. Attempt 2 adds the previous output and its validation errors. Attempt 3 repeats every error with a stricter instruction.
- After three failed attempts the request returns 422 with validation_errors, and no deliverable is stored.
- A stored deliverable always carries content_json, schema_id, schema_version and schema_validation_passed: true.
- An archived schema can never be used for a new transform: the request fails with 422.
{
"error": "Schema validation failed after 3 attempts",
"validation_errors": [
"#: missing required property \"ticket_id\"",
"action_items[0]: expected string, received number"
]
}Example schemas
Starting points you can paste straight into the console.
Support digest
One support thread reduced to an owner-ready digest.
{
"type": "object",
"properties": {
"ticket_id": { "type": "string" },
"summary": { "type": "string", "maxLength": 600 },
"sentiment": { "type": "string", "enum": ["positive", "neutral", "negative"] },
"action_items": { "type": "array", "items": { "type": "string" }, "minItems": 1 }
},
"required": ["ticket_id", "summary", "action_items"]
}Executive summary
A board-ready summary with decisions and risks separated.
{
"type": "object",
"properties": {
"headline": { "type": "string" },
"decisions": { "type": "array", "items": { "type": "string" } },
"risks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"risk": { "type": "string" },
"severity": { "type": "string", "enum": ["low", "medium", "high"] }
},
"required": ["risk", "severity"]
}
}
},
"required": ["headline", "decisions"]
}Product description
Catalog-ready copy with hard length limits per field.
{
"type": "object",
"properties": {
"product_name": { "type": "string", "maxLength": 80 },
"tagline": { "type": "string", "maxLength": 120 },
"benefits": { "type": "array", "items": { "type": "string" }, "minItems": 3, "maxItems": 5 },
"price_usd": { "type": "number", "minimum": 0 }
},
"required": ["product_name", "tagline", "benefits"]
}Changelog entry
A release note that always carries a version and a category.
{
"type": "object",
"properties": {
"version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
"category": { "type": "string", "enum": ["new_feature", "improvement", "bug_fix", "security"] },
"title": { "type": "string" },
"notes": { "type": "array", "items": { "type": "string" } }
},
"required": ["version", "category", "title"]
}