Cases

Draft case document (E2)

Drafts a legal document from the case context. Jurisdiction is INHERITED from the case (NOT a parameter). The internal route's SSE is aggregated to JSON server-side. Loopback: the internal route is the only one that debits (3 cr × tier multiplier).

post/api/v1/cases/{caseId}/draft

Request

  • Base URL: https://legal.nexusquantum.legal
  • URL: https://legal.nexusquantum.legal/api/v1/cases/{caseId}/draft
  • Auth: HTTP bearer

Path parameters

caseIdstring uuid required

Request body

docTypestring

Document type (e.g. complaint, appeal).

customTypestring

Free-text type description when docType does not fit.

instructionsstring
language'es' | 'en' | 'fr' | 'de'
modelTierIdstring

Response

{ draft, citationChecks?, truncated?, chunksUsed?, chunksTotal?, corpusPartial?, piiResiduals?, citationsOrigenC[], killSwitch?, processingMs, requestId }. draft is the FINISHED text: personal data rehydrated and, when the document was cut short, the notice written INSIDE the body — not the raw model stream. ⚠️ truncated: false means the provider reported a clean stop. It does NOT mean completeness was verified: a provider that omits finish_reason — which the API permits, and under BYO the provider is the one your firm chose — produces text that stops mid-sentence and still arrives as truncated: false. chunksTotal is the denominator: without it, chunksUsed: 48 reads as the whole case file and may be 48 of 1,200. null there means the count could not be taken, which is NOT «there are no more». piiResiduals are anonymisation markers that could not be restored: the draft ships with placeholders where personal data belongs. piiResidualsFromCorpus vs piiResidualsInvented split the same markers by ORIGIN, because the actions are opposite: FROM-CORPUS means the marker was already in the case-file document and the map that would undo it is never stored (Zero Retention) — unrecoverable BY DESIGN, the privacy guarantee working, and only the firm can fill it in from its own source. INVENTED means the marker appears nowhere in the case file: the engine produced it and there is NO underlying value — delete or replace it, never read it as masked case data. Both are also written INTO draft, because a .docx that leaves the firm does not carry these fields. citationsOrigenC are citations absent from the case corpus — possible invention. killSwitch is null when the output watchdog ran and did not fire; absent means it was not run. It reports; it does not block.

draftstring
truncatedboolean

The model stopped mid-output (finish_reason length/max_tokens): what is missing was NOT written. draft carries the same notice inside its body, because exports (.docx/.pdf/clipboard) do not carry this JSON. Do not use or file it without completing it. false asserts the text is complete.

chunksUsedinteger

Case fragments that entered the prompt.

chunksTotalinteger nullable

Fragments the case holds. null = could not be counted.

corpusPartialboolean

chunksUsed < chunksTotal: the draft saw only part of the case.

piiResidualsstring[]

All unrestored anonymisation markers (flat list).

piiResidualsFromCorpusstring[]

Markers that came from the case-file document: unrecoverable BY DESIGN (Zero Retention discards the map). Not a drafting failure — the firm fills them in from its own source.

piiResidualsInventedstring[]

Markers absent from the case file: the engine produced them and there is no data behind them. Delete or replace — do NOT read as masked case data.

citationsOrigenCstring[]
killSwitchobject nullable

Output watchdog. A lexical scan of the generated text for high-risk language (irrevocable waivers, apparent forgery, undisclosed conflicts, ouster of jurisdiction…). Codes are W-OUT-1…W-OUT-9, plus S-LEG-STOP when the model itself raised a halt. It does NOT block delivery — it reports. null = ran and did not fire; absent = not run. Lexicon covers ES/EN only.

Changes

No recorded changes to this operation across all 1 revision of this API.