AI Assistant (1.0.0)

Download OpenAPI specification:

Inference

Stateless, single-shot inference (redaction, Q&A, change analysis, chat completions).

Server info

Returns version and feature-flag information about the AIAv2 API server.

Authorizations:
ApiAuthToken

Responses

Response samples

Content type
application/json
{
  • "version": "string",
  • "langgraph_js_version": "string",
  • "context": "string",
  • "flags": {
    }
}

Analyze documents for redaction

Analyzes the given documents and suggests redaction annotations based on the redaction criteria. Works with or without a database. Accepts JSON or, for the database-less configuration, multipart/form-data (a file blob plus a data field).

Authorizations:
ApiAuthToken
Request Body schema:
required
model
string

Optional model id (e.g. "gpt4").

required
Array of objects (DocumentInput) non-empty
criteria
required
string

The redaction criteria, e.g. "PII" or "the word SECRET".

object

Responses

Request samples

Content type
{
  • "model": "string",
  • "documents": [
    ],
  • "criteria": "string",
  • "options": {
    }
}

Response samples

Content type
application/json
{
  • "stagedActions": [
    ]
}

Question-answering over documents

Performs single-shot question-answering across one or more documents, retrieving relevant context to generate an answer. Works with or without a database. Accepts JSON or, for the database-less configuration, multipart/form-data.

Authorizations:
ApiAuthToken
Request Body schema:
required
required
Array of objects (DocumentInput) non-empty
input
required
string

The question to ask about the document(s).

model
string

Optional model id (e.g. "gpt4").

Responses

Request samples

Content type
{
  • "documents": [
    ],
  • "input": "string",
  • "model": "string"
}

Response samples

Content type
application/json
{
  • "content": "string",
  • "references": [
    ]
}

Summarize and categorize document changes

Provides an LLM-based summary of what changed plus up to five suggested categories, intended for use as user preferences in a follow-up tagging request. Stateless; no changes are stored.

Authorizations:
ApiAuthToken
Request Body schema: application/json
required
required
Array of objects (DocumentChange)
model
string

Optional LLM model id (e.g. "gpt4o").

Responses

Request samples

Content type
application/json
{
  • "changes": [
    ],
  • "model": "string"
}

Response samples

Content type
application/json
{
  • "summary": "string",
  • "categories": [
    ]
}

Tag document changes

Categorizes document changes against a list of user-defined labels and returns each change with its matching categories. Stateless; no changes are stored.

Authorizations:
ApiAuthToken
Request Body schema: application/json
required
required
Array of objects (DocumentChange)
tags
required
Array of strings

Categories to tag the changes with.

model
string

Responses

Request samples

Content type
application/json
{
  • "changes": [
    ],
  • "tags": [
    ],
  • "model": "string"
}

Response samples

Content type
application/json
{
  • "references": [
    ]
}

Chat completions

OpenAI-compatible chat completions. Supports both simple chat and document-grounded responses. Provide documents to ground the answer on ingested document content.

Authorizations:
ApiAuthToken
Request Body schema: application/json
required
model
string

Optional model id (e.g. "gpt4").

required
Array of objects
Array of objects
temperature
number

Controls randomness (0-1, default 0.7).

nutrient_dont_send_defaults
boolean

Skip sending default parameters to the model (some deployments hang otherwise).

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "messages": [
    ],
  • "documents": [
    ],
  • "temperature": 0,
  • "nutrient_dont_send_defaults": true
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "chat.completion",
  • "created": 0,
  • "model": "string",
  • "choices": [
    ],
  • "usage": {
    }
}

Runs

Agent execution (stateless and threaded) on the AIAv2 API.

Stream a run within a thread (SSE)

Stream a run within an existing thread context via Server-Sent Events. State is persisted to the thread, and the run supports interrupts. See the stateless /runs/stream endpoint for the event format.

Authorizations:
ApiAuthToken
path Parameters
thread_id
required
string
Request Body schema: application/json
required
assistant_id
required
string

ID of the agent to execute. Must match a registered assistant.

input
any

Input for the agent. For the default agent this is { messages: [...] } (each message { role, content }), optionally with documents.

object (RecordStringUnknown)
object (RecordStringUnknown)
object

Per-run context fields, e.g. modelServices (gated by JWT claims).

object (RecordStringUnknown)
StreamMode (string) or Array of StreamMode (strings)

Which events to emit. A single mode or an array of modes.

string or Array of strings
string or Array of strings
feedback_keys
Array of strings
stream_subgraphs
boolean
checkpoint_id
string
object (RecordStringUnknown)

Responses

Request samples

Content type
application/json
{
  • "assistant_id": "chat",
  • "input": {
    },
  • "command": { },
  • "config": { },
  • "context": { },
  • "metadata": { },
  • "stream_mode": [
    ],
  • "interrupt_before": "*",
  • "interrupt_after": "*",
  • "feedback_keys": [
    ],
  • "stream_subgraphs": true,
  • "checkpoint_id": "string",
  • "checkpoint": { }
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "message": "string",
  • "details": [
    ]
}

Execute a stateless run and stream results (SSE)

Execute an agent and stream results via Server-Sent Events. Stateless: no conversation state is persisted. The first event is metadata ({ run_id, attempt }); subsequent events depend on stream_mode (values, messages/partial, messages/complete, updates, debug), ending on completion or an error event. Maximum stream duration is 5 minutes.

Note: JWTs with session_ids claims are not compatible with this endpoint.

Authorizations:
ApiAuthToken
Request Body schema: application/json
required
assistant_id
required
string

ID of the agent to execute. Must match a registered assistant.

input
any

Input for the agent. For the default agent this is { messages: [...] } (each message { role, content }), optionally with documents.

object (RecordStringUnknown)
object (RecordStringUnknown)
object

Per-run context fields, e.g. modelServices (gated by JWT claims).

object (RecordStringUnknown)
StreamMode (string) or Array of StreamMode (strings)

Which events to emit. A single mode or an array of modes.

string or Array of strings
string or Array of strings
feedback_keys
Array of strings
stream_subgraphs
boolean
checkpoint_id
string
object (RecordStringUnknown)

Responses

Request samples

Content type
application/json
{
  • "assistant_id": "chat",
  • "input": {
    },
  • "command": { },
  • "config": { },
  • "context": { },
  • "metadata": { },
  • "stream_mode": [
    ],
  • "interrupt_before": "*",
  • "interrupt_after": "*",
  • "feedback_keys": [
    ],
  • "stream_subgraphs": true,
  • "checkpoint_id": "string",
  • "checkpoint": { }
}

Response samples

Content type
application/json
{
  • "error": "string",
  • "message": "string",
  • "details": [
    ]
}

Execute a stateless run and wait for result

Execute an agent to completion and return the final graph state as JSON.

This endpoint runs in stateless mode: an ephemeral thread is created for the execution and deleted after completion. No conversation state is persisted.

Response modes:

  • Keep-alive (default): Uses chunked transfer encoding. Newline characters (\n) are sent every second to prevent proxy/load balancer timeouts. The final JSON result is appended after execution completes. The response is transparent to JSON.parse() since leading whitespace is ignored.

  • Pure JSON: Send Accept: application/json header. Returns a standard JSON response with no newline padding. Simpler but may timeout on long-running agents behind proxies.

Error handling:

  • Pre-execution errors (validation, auth, not found) return standard JSON error responses (400/401/404).
  • Execution errors in keep-alive mode return { "__error__": { "error": "...", "message": "..." } } in the response body.
  • Execution errors in pure JSON mode return standard JSON error responses.

Headers:

  • Content-Location: /runs/{run_id} is set before execution begins.

Maximum execution time is 5 minutes.

Note: JWTs with session_ids claims are not compatible with this endpoint.

Authorizations:
ApiAuthToken
Request Body schema: application/json
required

Request body for creating a stateless run.

assistant_id
required
string

ID of the agent to execute. Must match a registered assistant.

input
any

Input data for the agent. Structure depends on the agent's input schema.

For the default Nutrient assistant agent, the input object supports:

  • messages — Array of chat messages. Each message has role ("user" or "assistant") and content (string).
  • documents — Optional array of document context objects that scope which documents the agent can access. Each entry has a fingerprint (document ID string or "*" for all JWT-permitted documents) and a role ("active" for primary documents or "available" for secondary reference).
object

Runtime configuration overrides merged into the agent's default configuration.

object

Arbitrary metadata attached to the run. Not processed by the server.

Responses

Request samples

Content type
application/json
{
  • "assistant_id": "nutrient-assistant",
  • "input": {
    },
  • "config": { },
  • "metadata": { }
}

Response samples

Content type
application/json
Example
{
  • "__error__": {
    }
}

Threads

Conversation threads and their persisted state (AIAv2 API).

Create a thread

Create a new conversation thread.

Authorizations:
ApiAuthToken
Request Body schema: application/json
optional
thread_id
string

Optional client-supplied thread id. Generated if omitted.

object (RecordStringUnknown)
if_exists
string
Enum: "raise" "do_nothing"

Behaviour when a thread with the given id already exists.

Responses

Request samples

Content type
application/json
{
  • "thread_id": "string",
  • "metadata": { },
  • "if_exists": "raise"
}

Response samples

Content type
application/json
{
  • "thread_id": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "metadata": { },
  • "status": "idle"
}

Search threads

Search threads with filtering and pagination.

Authorizations:
ApiAuthToken
Request Body schema: application/json
optional
object (RecordStringUnknown)
ids
Array of strings
status
string
Enum: "idle" "busy" "interrupted" "error"
object (RecordStringUnknown)
limit
integer [ 1 .. 1000 ]
offset
integer >= 0
sort_by
string
Enum: "thread_id" "status" "created_at" "updated_at"
sort_order
string
Enum: "asc" "desc"

Responses

Request samples

Content type
application/json
{
  • "metadata": { },
  • "ids": [
    ],
  • "status": "idle",
  • "values": { },
  • "limit": 1,
  • "offset": 0,
  • "sort_by": "thread_id",
  • "sort_order": "asc"
}

Response samples

Content type
application/json
[
  • {
    }
]

Get a thread

Get thread details.

Authorizations:
ApiAuthToken
path Parameters
thread_id
required
string

Responses

Response samples

Content type
application/json
{
  • "thread_id": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "metadata": { },
  • "status": "idle"
}

Delete a thread

Delete a thread and its persisted state.

Authorizations:
ApiAuthToken
path Parameters
thread_id
required
string

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "message": "string",
  • "details": [
    ]
}

Get thread state

Get the current state of a thread.

Authorizations:
ApiAuthToken
path Parameters
thread_id
required
string
query Parameters
subgraphs
boolean

Include subgraph states.

Responses

Response samples

Content type
application/json
{
  • "values": { },
  • "next": [
    ],
  • "checkpoint": { },
  • "metadata": { },
  • "created_at": "2019-08-24T14:15:22Z",
  • "parent_checkpoint": { },
  • "tasks": [
    ]
}

Get thread state history

Get thread state history with filtering.

Authorizations:
ApiAuthToken
path Parameters
thread_id
required
string
Request Body schema: application/json
optional
limit
integer [ 1 .. 100 ]
string or RecordStringUnknown (object)

Return states before this checkpoint id (string) or checkpoint object.

object (RecordStringUnknown)
object (RecordStringUnknown)

Responses

Request samples

Content type
application/json
{
  • "limit": 1,
  • "before": "string",
  • "metadata": { },
  • "checkpoint": { }
}

Response samples

Content type
application/json
[
  • {
    }
]

Assistants

Available agents (assistants) on the AIAv2 API.

List assistants

List all available assistants with pagination.

Authorizations:
ApiAuthToken
query Parameters
limit
integer [ 1 .. 100 ]
Default: 10

Maximum number of results (1-100).

offset
integer >= 0
Default: 0

Pagination offset.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Search assistants

Search assistants with advanced filtering.

Authorizations:
ApiAuthToken
Request Body schema: application/json
optional
object (RecordStringUnknown)
graphId
string
limit
integer [ 1 .. 100 ]
Default: 10
offset
integer >= 0
Default: 0
sortBy
string
sortOrder
string
Enum: "asc" "desc"

Responses

Request samples

Content type
application/json
{
  • "metadata": { },
  • "graphId": "string",
  • "limit": 10,
  • "offset": 0,
  • "sortBy": "string",
  • "sortOrder": "asc"
}

Response samples

Content type
application/json
[
  • {
    }
]

Get assistant schemas

Get the input, output, state, and context schemas for a specific assistant.

Authorizations:
ApiAuthToken
path Parameters
assistant_id
required
string
Example: chat

ID of the assistant.

Responses

Response samples

Content type
application/json
{
  • "graph_id": "string",
  • "input_schema": { },
  • "output_schema": { },
  • "state_schema": { },
  • "context_schema": { },
  • "config_schema": { }
}

Documents

Document ingestion and management (server API).

Get Documents

Returns the identifiers of all the documents ingested into the Nutrient AI Assistant database.

If the identifier is listed in the response, the database contains contextual information such document metadata, and document contents, as well as AI synthesized information such as classifications, and summaries.

Authorizations:
ApiAuthToken

Responses

Response samples

Content type
application/json
{
  • "documents": [
    ]
}

Delete Document

Deletes the data associated with each layer of the given document, as well as the document default layer (no layer name) itself.

All data including contextual data such as document metadata, and document contents, as well as AI synthesized information such as classifications, and summaries will be deleted.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc

The ID of the document to delete. This ID is given when creating the document on the Document Engine.

Responses

Response samples

Content type
application/json
{ }

Delete Document Layer

Deletes the data associated with the given document layer.

All data including contextual data such as document metadata, and document contents, as well as AI synthesized information such as classifications, and summaries will be deleted.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc

The ID of the document to delete the layer from. This ID is given when creating the document on the Document Engine.

layerName
required
string
Example: 123456789abc

The name of the layer to delete. This layer name is given when creating a layer on the Document Engine.

Responses

Response samples

Content type
application/json
{ }

Check Document Ingestion Status

Checks if a document with the given ID and file hash has already been ingested into the Nutrient AI Assistant database.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string

The permanent ID of the document to check if it is ingested. This ID uniquely identifies a document and won't change if the document is modified.

fileHash
required
string

The hash of the file in its current state.

Responses

Response samples

Content type
application/json
{ }

Ingest PDF Document

Ingests a PDF document directly into the Nutrient AI Assistant database. The document will be processed, analyzed, and stored for future retrieval and analysis.

The endpoint expects a raw PDF file in the request body with content-type application/pdf.

Returns permanent and changing IDs for the document.

Authorizations:
ApiAuthToken
Request Body schema: application/pdf
required
string <binary>

Responses

Response samples

Content type
application/json
{
  • "permanentId": "string",
  • "changingId": "string",
  • "token": "string"
}

Ingest PDF Document originating from Nutrient Document Engine

Ingests a PDF document stored in Nutrient Document Engine into the Nutrient AI Assistant database. The document will be processed, analyzed, and stored for future retrieval and analysis.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc

The ID of the document to ingest. This ID is given when creating the document on the Document Engine.

fileHash
required
string
Example: 123456789abc

The hash of the file in its current state. This will be used to check if the file has changed since the last ingest and whether to trigger a new ingest.

Responses

Response samples

Content type
application/json
{ }

Ingest PDF Document of the given layer name originating from Nutrient Document Engine

Ingests a PDF document stored in Nutrient Document Engine into the Nutrient AI Assistant database. The document will be processed, analyzed, and stored for future retrieval and analysis.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc

The ID of the document to ingest. This ID is given when creating the document on the Document Engine.

layerName
required
string
Example: myLayer

The name of the layer to ingest. This layer name is given when creating a layer on the Document Engine.

fileHash
required
string
Example: 123456789abc

The hash of the file in its current state. This will be used to check if the file has changed since the last ingest and whether to trigger a new ingest.

Responses

Response samples

Content type
application/json
{ }

Sessions

Chat session management (server API).

Get Sessions

Returns all the session information held in the AI Assistant database.

This includes the session ID, the user ID (if present), and the timestamp of the last message sent.

Authorizations:
ApiAuthToken

Responses

Response samples

Content type
application/json
{
  • "sessions": [
    ]
}

Delete Session

Deletes all session data for the given Session ID.

This includes all messages and metadata associated with the session. Meaning the chat history will no longer be available.

Authorizations:
ApiAuthToken
path Parameters
sessionId
required
string
Example: 123456789abc

The unique identifier for the session. This value is given as part of the AI Assistant configuration when initializing the Nutrient Web SDK.

Responses

Response samples

Content type
application/json
{ }

Get User Sessions

Returns all the session information for all sessions tagged with a given user ID.

Sessions are tagged with a user ID when the AI Assistant configuration in the Nutrient Web SDK is initialized with a user ID.

Authorizations:
ApiAuthToken
path Parameters
userId
required
string
Example: 123456789abc

The unique identifier for the user. This value is optionally given in the AI Assistant configuration when initializing the Nutrient Web SDK.

Responses

Response samples

Content type
application/json
{
  • "sessions": [
    ]
}

Client

Endpoints consumed by the Web / iOS / Android SDKs.

Ingest a PDF document (standalone)

Ingests a PDF document without relying on Document Engine. The request body is the raw PDF (application/pdf). Returns the permanent and changing ids and, for client requests, a new JWT scoped to the ingested document.

Authorizations:
ApiAuthToken
Request Body schema: application/pdf
required
string <binary>

Responses

Response samples

Content type
application/json
{
  • "permanentId": "string",
  • "changingId": "string",
  • "token": "string"
}

Ingest a Document Engine document

Ingests a document stored in Nutrient Document Engine. Requires Document Engine.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc
fileHash
required
string

A hash of the file content to detect changes.

Responses

Response samples

Content type
application/json
{
  • "error": {
    }
}

Ingest a Document Engine document layer

Ingests a specific layer of a document stored in Nutrient Document Engine. Requires Document Engine.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
Example: 123456789abc
layerName
required
string
Example: myLayer
fileHash
required
string

Responses

Response samples

Content type
application/json
{
  • "error": {
    }
}

Check whether a document is ingested

Checks if a document with the given file hash has already been ingested.

Authorizations:
ApiAuthToken
path Parameters
documentId
required
string
fileHash
required
string

Responses

Response samples

Content type
application/json
{
  • "error": {
    }
}

Get chat history for a session

Retrieves the chat history for a specific session.

Authorizations:
ApiAuthToken
path Parameters
sessionId
required
string
Example: 123456789abc

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Health

Service health.

Health check

Responds with the health status of the server.

Responses

Response samples

Content type
application/json
{
  • "uptime": 123,
  • "message": "OK",
  • "timestamp": 1620000000000
}