Skip to content

Base API

Use this endpoint to analyze user messages before they are sent to an LLM using validation rules configured in the Web UI.

When enabled, HiveTrace performs:

  • sensitive data detection, deletion, masking and pseudonymization (dataclean)
  • built-in policy validation (guardrails)
  • custom policy validation
  • language check
  • token usage calculation
  • session/user association
  • monitoring persistence

Use this endpoint to analyze LLM responses before they are returned to the end user using Web UI validation settings.

When enabled, HiveTrace performs:

  • sensitive data detection, deletion, masking and pseudonymization (dataclean)
  • built-in policy validation (guardrails)
  • language check
  • token usage calculation
  • session/user association
  • monitoring persistence

Note: Model-based custom policies (prompts) apply only to incoming requests. Message and filename blacklists can check both directions, according to their settings.


FieldTypeDescription
application_idstring (UUID)Application identifier. Must exist in HiveTrace.

FieldTypeDescription
additional_parametersobjectMetadata for session and user tracking.

Note: pseudonymization and depseudonymization require additional_parameters.session_id.


FieldTypeDescription
user_idstringExternal user identifier.
session_idstringExternal session identifier.

This page describes HiveTrace 4.4.0. These analysis endpoints return results without top-level decision, message, block_reasons, or user_block fields. Use the separate /check endpoints below when your integration needs an allow/deny verdict.

Both endpoints return a JSON object.

FieldTypeDescription
request_idstringAnalysis record UUID.
schema_versionstringResponse schema version.
statusstringsuccess | partial_success | error | accepted
errorsstring[]List of processing errors (may be empty).
warningsobject[]List of warnings (may be empty).
tokens.countintegerNumber of tokens processed.
tokens.usage_severitystring | nulllow | high | critical | null
guardrails.flaggedbooleanIndicates built-in Guardrail violations.
guardrails.truncatedbooleanIndicates whether Guardrail processing was truncated.
custom_policy.message.model.flaggedbooleanIndicates custom policy violations.
custom_policy.message.blacklist.flaggedbooleanIndicates message blacklist violations.
custom_policy.file.blacklist.flaggedbooleanIndicates file blacklist violations.
dataclean.flaggedbooleanIndicates sensitive data was detected in the message or in an attached file.
dataclean.message.flaggedbooleanIndicates sensitive data was detected in the message.
dataclean.message.text_modifiedbooleanIndicates text was modified during processing.
dataclean.message.cleaned_textstring | nullSanitized version of the message after processing. With the Detection processing type, the text remains unchanged.
dataclean.message.types[]arrayDetected entity types with counts (may be empty).
dataclean.message.entities[]arrayDetected entity types, their position in the original and processed text, as well as their value (may be empty).
dataclean.file.flaggedbooleanIndicates sensitive data was detected in the attached file.
dataclean.file.save_failedbooleanIndicates whether a file save error occurred.
dataclean.file.check_failedbooleanIndicates whether a file check error occurred.
dataclean.file.files[]arrayList with detailed results for each file (may be empty).
language.flaggedboolean | nullIndicates language check violations.
language.enforcedboolean | nullIndicates the block was set for language mismatch.
language.statusstringdisabled | checked | error
language.errorstring | nullError cause (may be empty).

Each warnings[] item contains three strings: code, message, and message_ru. For example, session_history_full reports that the session pseudonym dictionary is full.

dataclean.message.cleaned_text is null when no processed text is available. In detection mode, available text is unchanged. When language.status is error, flagged and enforced can be null; do not interpret this as a successful language check. Inspect errors, warnings, and each module status before using the result.

{
"type": "NAME",
"count": 1
}

Окно терминала
curl -sS -X POST "$BASE_URL/process_request/" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"application_id":"<uuid>",
"message":"Contact me at alex@example.com.",
"additional_parameters":{
"user_id":"user-123",
"session_id":"session-456"
}
}'

Окно терминала
curl -sS -X POST "$BASE_URL/process_response/" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"application_id":"<uuid>",
"message":"Hello John, I have processed your request.",
"additional_parameters":{
"user_id":"user-123",
"session_id":"session-456"
}
}'

Illustrative synchronous response to the request above when only EMAIL masking is enabled. The token count is illustrative and depends on tokenization.

{
"request_id": "ad1472eb-e7f5-4d5c-ad33-33a9a07ca870",
"schema_version": "2.4.0",
"status": "success",
"errors": [],
"warnings": [],
"tokens": {
"count": 8,
"usage_severity": null
},
"guardrails": {
"flagged": false,
"truncated": false
},
"custom_policy": {
"message": {
"model": {
"flagged": false
},
"blacklist": {
"flagged": false
}
},
"file": {
"blacklist": {
"flagged": false
}
}
},
"dataclean": {
"flagged": true,
"message": {
"flagged": true,
"text_modified": true,
"cleaned_text": "Contact me at XXXXXXXXXXXXXXXX.",
"types": [
{
"type": "EMAIL",
"count": 1
}
],
"entities": [
{
"type": "EMAIL",
"start": 14,
"end": 30,
"processed_start": 14,
"processed_end": 30,
"text": "alex@example.com"
}
]
},
"file": {
"flagged": false,
"save_failed": false,
"check_failed": false,
"files": []
}
},
"language": {
"flagged": false,
"enforced": false,
"status": "disabled",
"error": null
}
}

For an application in async mode with deferred ingest enabled (ENABLE_ASYNC_INGEST=true, the default), the server returns HTTP 202 and status: "accepted". It stores and queues the message; classification happens later. The response retains the same structure with neutral values, such as zero tokens and flagged: false. These values are placeholders, not completed checks.

Use request_id to find the record in session analytics. The original HTTP response is not updated with the later verdict. With deferred ingest disabled, classification runs in the request even for an async application; this does not enable synchronous blocking.

POST /process_request/check and POST /process_response/check accept the same message body and API token as the corresponding base endpoint. They use the application’s protection settings and return a separate, compact response:

FieldTypeMeaning
decisionstringallow, deny, or accepted
reasonstring | nullExplanation of the verdict
request_idstringAnalysis record UUID
errorsstring[] | nullProcessing errors
languageobject | nullLanguage-check result

In synchronous mode, the client must act on decision; calling the endpoint does not itself stop the client’s LLM call. Check errors as well: an allow result with a failed module does not mean all checks succeeded. In deferred mode, HTTP 202 with decision: "accepted" is a receipt, not an allow verdict.