Parse an uploaded narrative document into proposed incidents (preview only).
const url = 'https://api.adversarial.com/api/v1/incidents/import/ai/parse';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST'};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.adversarial.com/api/v1/incidents/import/ai/parse \ --header 'Content-Type: multipart/form-data' \ --form file=@fileNo incident is created yet: the reviewer edits the returned proposals and
posts the accepted set to /v1/incidents/import/ai/commit. The document
itself is kept, unattached, so the commit can attach it to the incidents it
creates.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The narrative document to parse: plain text, Markdown, PDF, or Word (.docx).
Responses
Section titled “Responses”Proposed incidents parsed from the document
Response from the incident AI parse (preview) step. No incident is created yet: the client renders these for review/editing and posts the final set to commit.
object
The document text extracted server-side (from PDF/DOCX/plain text). The
client renders this in the review pane and locates each proposal’s
source_excerpt within it. May be truncated for very large documents.
The proposed incidents for the reviewer to accept, edit, or drop.
A single incident the AI extracted from an uploaded narrative document.
The same shape is returned by the preview call and accepted back on commit, so it carries every field a reviewer may edit before import.
object
Full narrative description of the incident, grounded in the source document.
When the incident was detected, as a plain YYYY-MM-DD calendar date
taken from the document. null (or anything unparseable) means the
document carried no usable date, and the incident falls back to the
import time.
When the incident began, as a plain YYYY-MM-DD calendar date, when the
document says. null when it does not.
One- or two-sentence justification tying the proposal back to the source document.
Suggested intake source (how the incident was reported), chosen from the organization’s configured incident sources — usually the same for every incident in a document.
Reduced server-side to a configured name, or to "" when the model
returned something that is not one. Empty means “the AI did not pick a
source”, which the reviewer resolves in the preview; on import an empty
source takes the organization’s default.
A short span copied verbatim from the source document that this
incident was drawn from. The client substring-matches it against
document_text to scroll to and highlight the originating passage.
Concise incident title.
The uploaded document, kept so it can be attached to every incident the
batch creates. Send it back as source_file_id on commit.
Not attached to anything until then. Kept for at least 24 hours and
discarded once no commit has claimed it by then; a later commit still
imports, without it. One commit can claim it. null when the document
could not be kept, including when it is not a type the attachment
upload accepts (such as HTML).
Example
{ "incidents": [ { "severity": "SEV-5" } ]}Empty, oversized, or unsupported/unreadable document
AI parsing is unconfigured, timed out, or the provider failed