SpoolisDocs

Spoolis docs

Policy compiler

Propose grounded policy fields, then confirm them into supported policy fields.

What it does

The compiler proposes inspectable fields from one to four supplied sources, with source text attached to each proposed value. A second route maps caller-confirmed fields into the supported Spool policy shape.

The proposal step uses a model. The confirmation step does not call a model.

When to use it

Use it when policy terms start as contract, pricing schedule, vendor definition, or instruction text and a caller can review every field before mapping it.

Authentication and scope

Both routes require a full-scope API key. Missing keys return 401, keys without full scope return 403, and each route allows 20 requests per minute per key.

Request

First, propose with POST /api/v1/policy-compiler.

JSON
{
  "sources": [
    {
      "kind": "contract",
      "text": "Each accepted case is billed at $22.50."
    }
  ]
}

Then send the returned proposal to POST /api/v1/policy-compiler/confirm with confirmations. Resolve each ambiguous field with a grounded candidate index or a schema-valid caller value before confirming it.

Response

The propose response contains proposal. Each field has a status, value, source quotes, flags, and optional candidates. uncertainty.dropped_ungrounded_count counts model claims discarded because they lacked source support.

The confirm response contains mapped policy fields plus unmapped and unsupported_for_mapping.

Limits

  • Sources per proposal: 1 through 4.
  • Quotes per field or candidate: 2.
  • Characters per quote: 240.
  • Candidates per field: 4.
  • Requests: 20 per minute per route and key.

The propose route also has a configured account daily cap. The code does not export a fixed value, so this guide does not state one.

Errors

  • unauthenticated or forbidden: Use an authorized full-scope key.
  • rate_limited: Wait and retry. For daily_cap_reached, retry after the daily window resets.
  • validation_failed: Correct the indicated field and retry. On confirmation, resolve each ambiguous field and confirm every listed field.
  • configuration_unavailable: Retry later.
  • internal_error: Retry, then contact support if the error continues.

Privacy

These routes do not save the proposal or source text. They emit source kinds, character-count buckets, field-status counts, and flags for operational telemetry.

Links

API reference · OpenAPI

Policy compiler · Spoolis