Rulebooks
Preview a rulebook CSV import
POST
/api/v1alpha1/rulebooks/csv-imports/previewReads a CSV of rules and returns what would be imported. Nothing is created by this call.
- Access: an alpha-enabled API key with the
MANAGE_RULEBOOKSpermission. - Returns: a
sessionId, the column mapping that was detected, per-column statistics, any warnings, and the rulebooks that would be created. - Deadline: the preview stops being usable at
expiresAt.
Check the mapping and the warnings, then pass the sessionId to POST /api/v1alpha1/rulebooks/csv-imports to create the rulebooks.
Authorization
apiKey AuthorizationBearer <token>
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://example.com/api/v1alpha1/rulebooks/csv-imports/preview" \ -H "Authorization: Bearer $DEEPFRAME_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "csv_text": "Rule ID,Requirement\\nR1,Exit is clear", "default_rulebook_name": "Imported Safety Rules", "filename": "warehouse-rules.csv", "mapping": { "additional_description_columns": [ "Notes" ], "rule_description": "Details", "rule_id": "Rule ID", "rule_title": "Requirement", "rulebook_name": "Section" } }'{ "column_stats": [ { "name": "Requirement", "non_empty_count": 10, "samples": [ "Exit is clear." ], "unique_count": 8 } ], "expires_at": "2026-08-10T11:05:00.000Z", "filename": "warehouse-rules.csv", "mapping": { "additional_description_columns": [], "rule_description": "Details", "rule_id": "Rule ID", "rule_title": "Requirement", "rulebook_name": "Section" }, "mapping_confidence": 0.95, "mapping_source": "heuristic", "row_count": 10, "rulebook_count": 2, "rulebooks": [ { "name": "Warehouse Safety", "rule_count": 10, "rules": [ { "description": "The exit remains unobstructed.", "id": "R1", "source_row_number": 2, "title": "Emergency exit is clear." } ] } ], "session_id": "rbi_0190b5d4-7e1f-7a2b-9c3d-1234567890ab", "skipped_row_count": 1, "total_rule_count": 10, "warnings": []}