Skip to main content
POST
Import rules text into a scenario's rules, or preview it with dry_run

Authorizations

x-api-key
string
header
required

Raw API key shown once when created in the Allocait app (Settings > API keys). Send it verbatim in this header; the server stores and compares only its SHA-256 hash. Allocait generates every key: alc_ followed by 64 lowercase hex characters. Keys issued before 2026-10-10 are 64 hex characters with no prefix and keep working. A key may carry an expiry (90 days or 1 year, or never). A malformed, unknown, revoked or expired key gets 401 with no further detail, and a malformed one is refused before any lookup. Keys cannot be created through this API.

Path Parameters

id
string<uuid>
required

scenario_id

Body

application/json
rules_text
string
required

Full rules text. Frontmatter and, optionally, a prose body Allocait ignores. Capped at 102,400 bytes (100 KiB) and 500 classes (see the Bulk write limits note above).

dry_run
boolean
default:false

Preview only. True returns the diff and writes nothing.

Response

The rules text was applied (or, under dry_run, previewed)

The result of an import (POST /scenarios/{id}/rules) or an undo (POST /rules/restore-points/{id}/restore); both reconcile a scenario's rules to an absolute desired state, the same shape POST /scenarios/{id}/position-rules/apply uses, and both save a restore point of what the scenario's rules were immediately before, so either one can itself be undone.

success
boolean
dry_run
boolean

Import only. True when nothing was written. changes and counts are still the full preview.

scenario_id
string<uuid>
scenario_name
string
restore_point_id
string<uuid> | null

Null under dry_run: true. Otherwise the restore point saved immediately before this write. Pass it to POST /rules/restore-points/{id}/restore to undo it.

classes_to_create
string[]

Import only. Class names in the file that matched no existing class and will be (or, under dry_run, would be) created.

changes
object[]

Ordered by file (or saved-snapshot) order for added/changed/unchanged, then by class display order for removed.

counts
object
issues
object[]

Import only. Warnings from reading the file; POST /scenarios/{id}/rules never reaches the RPC, and never returns this field, when the file has an error-level issue.

skipped
string[]

Restore only. Class names the saved rule pointed at that no longer exist or are no longer this key's to use. Restoring wrote nothing for these.

removed_classes
string[]

Restore only. Custom classes the original import created that nothing references any more, deleted as part of the undo.