Skip to content

Override API

For validating incoming user messages before they are sent to an LLM, when validation rules must be defined inline within the request instead of relying on Web UI settings.


For validating outgoing LLM responses before they are returned to the end user, with validation configured directly in the request.

Override endpoints allow validation behavior to be defined inline, bypassing Web UI configuration.

Important:

  • Web UI validation settings are not applied
  • Validation is fully controlled via validation_config
  • The corresponding services (dataclean, guardrails, custom, language check) must still be enabled at the deployment level

FieldTypeDescription
application_idstring (UUID)Application identifier. Must exist in HiveTrace.
messagestringUser message or LLM response depending on the endpoint.
validation_configobjectInline validation configuration.

FieldTypeDescription
additional_parametersobjectMetadata for session and user tracking.

Note: pseudonymization and depseudonymization require additional_parameters.session_id.


The two endpoints use different schemas:

Setting/process_request/override/process_response/override
Model-based custom policies: custom.policies, custom.message.modelSupportedNot accepted
Message and filename blacklistsSupportedSupported
dataclean.enable_depseudonymizationNot acceptedSupported

Sending a field to the wrong endpoint causes a validation error (HTTP 422). The first example below is for /process_request/override; the depseudonymization example is for /process_response/override.

Override changes the validation rules, but not API-token scope, platform-wide module switches, or the application’s sync/async mode. Deferred requests return HTTP 202 with status: "accepted", as described in Base API.

Defines validation rules directly inside the request.

{
"application_id": "{{application_id}}",
"message": "My name is John, my CVC is 222, and I own a car.",
"additional_parameters": {
"session_id": "{{client_session_id}}",
"user_id": "{{client_user_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"guardrails": {
"enabled": true
},
"custom": {
"enabled": true,
"policies": [
{
"name": "medicine",
"prompt": "Do not provide medical advice or discuss medical topics."
}
]
},
"dataclean": {
"enabled": true,
"clean_type": "pseudonymization",
"patterns": [
"CVC",
{
"name": "AUTOMOBILE",
"regex": "\\bcar\\b",
"pseudonym": "car"
}
]
}
}
}
}

patterns is a list of dataclean patterns. Each item can be:

  • a string with a predefined pattern name
  • an object with a custom pattern { "name": "...", "regex": "..." }

Note: If pseudonymization is selected as the processing type, pseudonym must be passed for objects with a custom pattern.

Allowed values for predefined patterns:

PatternDescription
ADDRESSAddress
BANK_ACCOUNT_NUMBERBank account number
BANK_CARD_NUMBERBank card number
BICBIC
CORRESPONDENT_ACCOUNTCorrespondent account
CVCCard CVC/CVV
DOMAINDomain
DRIVER_LICENSEDriver’s license number
EMAILEmail addresses
INNINN (taxpayer identification number)
IPIP address
KPPKPP
LICENSE_PLATEVehicle registration plate
NAMEPerson name
OGRNOGRN
OGRNIPOGRNIP
PASSPORT_NUMBERPassport number
PHONE_NUMBERPhone number
SNILSSNILS
TOKENAccess token
URLURL
VINVehicle identification number

patterns — exceptions for the personal data cleaning module. They should be applied when a string resembles sensitive data but is valid in your workflow.

Each item should be an object with a custom pattern { "name": "...", "value": "..." }

{
"application_id": "{{application_id}}",
"message": "Unable to navigate to дети.рф",
"additional_parameters": {
"user_id": "{{client_user_id}}",
"session_id": "{{client_session_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"dataclean": {
"enabled": true,
"clean_type": "masking",
"patterns": [
"DOMAIN"
],
"whitelist": {
"patterns": [
{
"name": "cyrillic domain",
"value": "(?i)\\b(?:[а-яёА-ЯЁ0-9-]+\\.)+(?:рф|бел|сайт|онлайн|дети)(?![а-яёА-ЯЁ0-9])"
}
]
}
},
"guardrails": {
"enabled": false
},
"custom": {
"enabled": false
}
}
}
}

dataclean.clean_type (processing type): allowed values

Section titled “dataclean.clean_type (processing type): allowed values”
Processing typeDescription
MASKINGMasking: replaces matches with a mask
DELETIONDeletion: removes matches from the text
DETECTIONDetection: detects matches without modifying the text
PSEUDONYMIZATIONPseudonymization: replaces matches with a stable label such as NAME_1

dataclean.enable_depseudonymization: depseudonymization

Section titled “dataclean.enable_depseudonymization: depseudonymization”

Data can be depseudonymized within a session.

The following example uses /process_response/override. First pseudonymize a request with the same application_id and additional_parameters.session_id so that the session dictionary contains the values to restore.

{
"application_id": "{{application_id}}",
"message": "My KPP is 771301001. KPP_1",
"additional_parameters": {
"session_id": "{{client_session_id}}",
"user_id": "{{client_user_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"dataclean": {
"enabled": true,
"clean_type": "pseudonymization",
"patterns": [
"KPP"
],
"enable_depseudonymization": true
},
"guardrails": {
"enabled": false
},
"custom": {
"enabled": false
}
}
}
}

custom.message.blacklist: blacklist message patterns

Section titled “custom.message.blacklist: blacklist message patterns”

patterns — patterns from this list are applied to message text.

Each item should be an object with a custom pattern { "name": "...", "pattern": "..." }

{
"application_id": "{{application_id}}",
"message": "How can I pay with an expired card?",
"additional_parameters": {
"user_id": "{{client_user_id}}",
"session_id": "{{client_session_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"custom": {
"enabled": true,
"message": {
"blacklist": {
"patterns": [
{
"name": "card",
"pattern": "\\b[Cc]ard\\w*"
}
]
}
}
},
"guardrails": {
"enabled": false
}
}
}
}

custom.file.blacklist: blacklist file patterns

Section titled “custom.file.blacklist: blacklist file patterns”

patterns — patterns from this list are matched against the names of attached files, not their contents. DataClean file processing checks extracted file contents.

Each item should be an object with a custom pattern { "name": "...", "pattern": "..." }

{
"application_id": "{{application_id}}",
"message": "How to use cashback?",
"additional_parameters": {
"user_id": "{{client_user_id}}",
"session_id": "{{client_session_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"custom": {
"enabled": true,
"file": {
"blacklist": {
"patterns": [
{
"name": "FILE_PATTERN",
"pattern": "\\b[Cc]ard\\w*"
}
]
}
}
},
"guardrails": {
"enabled": false
}
}
}
}

allowed_langs — the list of allowed languages defined by a set of codes: en, ar, hy, be, ka, he, kk, ru, tr, uk. You can choose one language or several — up to all of them. Text in a language not included in the list may be flagged as a violation, depending on the threshold of permissible letters from other writing systems.

enforce configures whether a detected language mismatch should be enforced (true) or only recorded (false). It is an input setting; the outcome is reported as language.enforced.

tolerance - sets the permissible share of letters from other writing systems at which the text is not yet considered a violation. The threshold can be set from 0 to 1.

{
"application_id": "{{application_id}}",
"message": "За что списание по карте за неделю, p.s. за последние 3 дня",
"additional_parameters": {
"user_id": "{{client_user_id}}",
"session_id": "{{client_session_id}}"
},
"validation_config": {
"source": "inline",
"inline": {
"language": {
"enabled": true,
"allowed_langs": [
"ru",
"en"
],
"enforce": false,
"tolerance": 0.01
},
"guardrails": {
"enabled": false
},
"custom": {
"enabled": false
}
}
}
}

Override endpoints return the same response structure as the Base API.