> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-platform/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo-platform/_mcp/server.

# Guardrail check request

POST /apis/guardrails/v2/workspaces/{workspace}/checks
Content-Type: application/json

Chat completion for the provided conversation.

Reference: https://docs.nvidia.com/nemo-platform/nemo-platform/v0.3.0/documentation/reference/api-reference/guardrails/check-apis-guardrails-v-2-workspaces-workspace-checks-post

## Request

### Path parameters

- `workspace` (string, required)

### Body (application/json)

- `model` (string, required) — The model to use for completion. Must be one of the available models.
- `messages` (list of object or object or object or object or object, required) — A list of messages comprising the conversation so far
  - ChatCompletionSystemMessageParam
    - `content` (string, required) — The contents of the system message.
    - `role` ("system", required) — The role of the messages author, in this case `system`.
    - `name` (string, optional) — An optional name for the participant.
  - ChatCompletionUserMessageParam
    - `content` (string or list of object or object, required) — The contents of the user message.
    - `role` ("user", required) — The role of the messages author, in this case `user`.
    - `name` (string, optional) — An optional name for the participant.
  - ChatCompletionAssistantMessageParam
    - `role` ("assistant", required) — The role of the messages author, in this case `assistant`.
    - `content` (string, optional) — The contents of the assistant message.
    - `function_call` (object, optional) — Deprecated and replaced by `tool_calls`.
      - `arguments` (string, required) — The arguments to call the function with, as generated by the model in JSON format.
      - `name` (string, required) — The name of the function to call.
    - `name` (string, optional) — An optional name for the participant.
    - `tool_calls` (list of object, optional) — The tool calls generated by the model, such as function calls.
      - `id` (string, required) — The ID of the tool call.
      - `function` (object, required) — The function that the model called.
        - `arguments` (string, required) — The arguments to call the function with, as generated by the model in JSON format.
        - `name` (string, required) — The name of the function to call.
      - `type` ("function", required) — The type of the tool. Currently, only `function` is supported.
  - ChatCompletionToolMessageParam
    - `content` (string, required) — The contents of the tool message.
    - `role` ("tool", required) — The role of the messages author, in this case `tool`.
    - `tool_call_id` (string, required) — Tool call that this message is responding to.
  - ChatCompletionFunctionMessageParam
    - `content` (string, required) — The contents of the function message.
    - `name` (string, required) — The name of the function to call.
    - `role` ("function", required) — The role of the messages author, in this case `function`.
- `response_format` (map from string to any, optional) — Format of the response. Use \{'type': 'json\_object'} for JSON mode or \{'type': 'json\_schema', 'json\_schema': \{...}} for structured outputs.
- `max_tokens` (integer, optional) — The maximum number of tokens that can be generated in the chat completion.
- `n` (integer, optional) — How many chat completion choices to generate for each input message.
- `stream` (boolean, optional, default: false) — If set, partial message deltas will be sent, like in ChatGPT.
- `temperature` (double, optional) — What sampling temperature to use, between 0 and 2.
- `top_p` (double, optional) — An alternative to sampling with temperature, called nucleus sampling.
- `stop` (string or list of string, optional) — Up to 4 sequences where the API will stop generating further tokens.
- `frequency_penalty` (double, optional) — Positive values penalize new tokens based on their existing frequency in the text.
- `presence_penalty` (double, optional) — Positive values penalize new tokens based on whether they appear in the text so far.
- `function_call` (string or map from string to any, optional) — Deprecated in favor of tool\_choice. 'none' means the model will not call a function and instead generates a message. 'auto' means the model can pick between generating a message or calling a function. Specifying a particular function via \{'name': 'my\_function'} forces the model to call that function.
- `seed` (integer, optional) — If specified, attempts to sample deterministically.
- `logit_bias` (map from string to double, optional) — Modify the likelihood of specified tokens appearing in the completion. Maps token IDs (as strings) to bias values from -100 to 100.
- `top_logprobs` (integer, optional) — The number of most likely tokens to return at each token position.
- `logprobs` (boolean, optional) — Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message
- `tool_choice` (string or map from string to any, optional) — Controls which (if any) tool is called by the model. 'none' means no tool is called, 'auto' lets the model decide, 'required' forces a tool call.
- `user` (string, optional) — A unique identifier representing your end-user, used by some providers for abuse monitoring.
- `tools` (list of map from string to any, optional) — A list of tools the model may call. Each tool is an object with a 'type' field and a 'function' definition.
- `ignore_eos` (boolean, optional) — Ignore the eos when running
- `reasoning_effort` (string, optional) — Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
- `max_completion_tokens` (integer, optional) — An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. Preferred over max_tokens for reasoning models.
- `stream_options` (map from string to boolean, optional) — Options for streaming response. Only set this when stream=True. Supports include_usage to receive token usage in the final stream chunk.
- `vision` (boolean, optional) — Whether this is a vision-capable request with image inputs.
- `guardrails` (object, optional) — Guardrails specific options for the request.
  - `config` (string or object, optional, default: system/default) — The id of the configuration or its dict representation to be used.
    - RailsConfig
      - `models` (list of object, optional) — The list of models used by the rails configuration.
        - `type` (string, required)
        - `engine` (string, required)
        - `model` (string, optional) — The model name. If using Inference Gateway, this should be the Model Entity reference ('workspace/model_name').
        - `parameters` (object, optional) — Additional parameters to configure how to interact with the model.
          - `base_url` (string, optional) — The URL to use for inference with this model.
          - `default_headers` (map from string to string, optional) — Custom HTTP headers to include in requests to this model. Each key-value pair represents a header name (key) and its default value (value). You can override the default value for a header by populating it in the request headers.
        - `mode` (enum, optional, default: chat) — Whether the mode is 'text' completion or 'chat' completion. Allowed values are 'chat' or 'text'.
          - Allowed values: `chat`, `text`
        - `cache` (object, optional) — Cache configuration for this specific model (primarily used for content safety models)
          - `enabled` (boolean, optional, default: false) — Whether caching is enabled (default: False - no caching)
          - `maxsize` (integer, optional, default: 50000) — Maximum number of entries in the cache per model
          - `stats` (object, optional) — Configuration for cache statistics tracking and logging
            - `enabled` (boolean, optional, default: false) — Whether cache statistics tracking is enabled
            - `log_interval` (double, optional) — Seconds between periodic cache stats logging to logs (None disables logging)
      - `instructions` (list of object, optional, default: [{"type":"general","content":"Below is a conversation between a helpful AI assistant and a user. The bot is designed to generate human-like text based on the input that it receives. The bot is talkative and provides lots of specific details. If the bot does not know the answer to a question, it truthfully says it does not know."}]) — List of instructions in natural language that the LLM should use.
        - `type` (string, required)
        - `content` (string, required)
      - `actions_server_url` (string, optional) — The URL of the actions server that should be used for the rails.
      - `sample_conversation` (string, optional, default: user "Hello there!"
  express greeting
bot express greeting
  "Hello! How can I assist you today?"
user "What can you do for me?"
  ask about capabilities
bot respond about capabilities
  "As an AI assistant, I can help you with a wide range of tasks. This includes question answering on various topics, generating text for various purposes and providing suggestions based on your preferences."
user "Tell me a bit about the history of NVIDIA."
  ask general question
bot response for general question
  "NVIDIA is a technology company that specializes in designing and manufacturing graphics processing units (GPUs) and other computer hardware. The company was founded in 1993 by Jen-Hsun Huang, Chris Malachowsky, and Curtis Priem."
user "tell me more"
  request more information
bot provide more information
  "Initially, the company focused on developing 3D graphics processing technology for the PC gaming market. In 1999, NVIDIA released the GeForce 256, the world's first GPU, which was a major breakthrough for the gaming industry. The company continued to innovate in the GPU space, releasing new products and expanding into other markets such as professional graphics, mobile devices, and artificial intelligence."
user "thanks"
  express appreciation
bot express appreciation and offer additional help
  "You're welcome. If you have any more questions or if there's anything else I can help you with, please don't hesitate to ask."
) — The sample conversation that should be used inside the prompts.
      - `prompts` (list of object, optional) — The prompts that should be used for the various LLM tasks.
        - `task` (string, required) — The id of the task associated with this prompt.
        - `content` (string, optional) — The content of the prompt, if it's a string.
        - `messages` (list of object or string, optional) — The list of messages included in the prompt. Used for chat models.
          - MessageTemplate
            - `type` (string, required) — The type of message, e.g., 'assistant', 'user', 'system'.
            - `content` (string, required) — The content of the message.
        - `models` (list of string, optional) — If specified, the prompt will be used only for the given LLM engines/models. The format is a list of strings with the format: \<engine> or \<engine>/\<model>.
        - `output_parser` (string, optional) — The name of the output parser to use for this prompt.
        - `max_length` (integer, optional, default: 16000) — The maximum length of the prompt in number of characters.
        - `mode` (string, optional, default: standard) — Corresponds to the `prompting_mode` for which this prompt is fetched. Default is 'standard'.
        - `stop` (list of string, optional) — If specified, will be configure stop tokens for models that support this.
        - `max_tokens` (integer, optional) — The maximum number of tokens that can be generated in the chat completion.
      - `prompting_mode` (string, optional, default: standard) — Allows choosing between different prompting strategies.
      - `lowest_temperature` (double, optional, default: 0.001) — The lowest temperature that should be used for the LLM.
      - `enable_multi_step_generation` (boolean, optional, default: false) — Whether to enable multi-step generation for the LLM.
      - `colang_version` (string, optional, default: 1.0) — The Colang version to use.
      - `custom_data` (map from string to any, optional) — Any custom configuration data that might be needed.
      - `rails` (object, optional) — Configuration for the various rails (input, output, etc.).
        - `config` (object, optional) — Configuration data for specific rails that are supported out-of-the-box.
          - `fact_checking` (object, optional) — Configuration data for the fact-checking rail.
            - `parameters` (map from string to any, optional)
            - `fallback_to_self_check` (boolean, optional, default: false) — Whether to fall back to self-check if another method fail.
          - `autoalign` (object, optional) — Configuration data for the AutoAlign guardrails API.
            - `parameters` (map from string to any, optional)
            - `input` (object, optional) — Input configuration for AutoAlign guardrails
            - `output` (object, optional) — Output configuration for AutoAlign guardrails
          - `patronus` (object, optional) — Configuration data for the Patronus Evaluate API.
            - `input` (object, optional) — Patronus Evaluate API configuration for an Input Guardrail
            - `output` (object, optional) — Patronus Evaluate API configuration for an Output Guardrail
          - `sensitive_data_detection` (object, optional) — Configuration for detecting sensitive data.
            - `recognizers` (list of map from string to any, optional) — Additional custom recognizers. Check out https://microsoft.github.io/presidio/tutorial/08_no_code/ for more details.
            - `input` (object, optional) — Configuration of the entities to be detected on the user input.
            - `output` (object, optional) — Configuration of the entities to be detected on the bot output.
            - `retrieval` (object, optional) — Configuration of the entities to be detected on retrieved relevant chunks.
          - `regex_detection` (object, optional) — Configuration for regex pattern detection.
            - `input` (object, optional) — Configuration for regex patterns to detect on user input.
            - `output` (object, optional) — Configuration for regex patterns to detect on bot output.
            - `retrieval` (object, optional) — Configuration for regex patterns to detect on retrieved relevant chunks.
          - `jailbreak_detection` (object, optional) — Configuration for jailbreak detection.
            - `server_endpoint` (string, optional) — The endpoint for the jailbreak detection heuristics/model container.
            - `length_per_perplexity_threshold` (double, optional, default: 89.79) — The length/perplexity threshold.
            - `prefix_suffix_perplexity_threshold` (double, optional, default: 1845.65) — The prefix/suffix perplexity threshold.
            - `nim_base_url` (string, optional) — Base URL for jailbreak detection model. Example: http://localhost:8000/v1
            - `nim_server_endpoint` (string, optional, default: classify) — Classification path uri. Defaults to 'classify' for NemoGuard JailbreakDetect.
            - `api_key` (string, optional) — Secret String with API key for use in Jailbreak requests. Takes precedence over api_key_env_var
            - `api_key_env_var` (string, optional) — Environment variable containing API key for jailbreak detection model
            - `nim_url` (string, optional, deprecated) — DEPRECATED: Use nim_base_url instead
            - `nim_port` (integer, optional, deprecated) — DEPRECATED: Include port in nim_base_url instead
            - `embedding` (string, optional, deprecated)
          - `injection_detection` (object, optional) — Configuration for injection detection.
            - `injections` (list of string, optional) — The list of injection types to detect. Options are 'sqli', 'template', 'code', 'xss'.Currently, only SQL injection, template injection, code injection, and markdown cross-site scripting are supported. Custom rules can be added, provided they are in the `yara_path` and have a `.yara` file extension.
            - `action` (string, optional, default: reject) — Action to take. Options are 'reject' to offer a rejection message, 'omit' to mask the offending content, and 'sanitize' to pass the content as-is in the safest way. These options are listed in descending order of relative safety. 'sanitize' is not implemented at this time.
            - `yara_rules` (map from string to string, optional) — Dictionary mapping rule names to YARA rule strings. If provided, these rules will be used instead of loading rules from yara_path. Each rule should be a valid YARA rule string.
          - `privateai` (object, optional) — Configuration for Private AI.
            - `server_endpoint` (string, optional) — The endpoint for the private AI detection server.
            - `input` (object, optional) — Configuration of the entities to be detected on the user input.
            - `output` (object, optional) — Configuration of the entities to be detected on the bot output.
            - `retrieval` (object, optional) — Configuration of the entities to be detected on retrieved relevant chunks.
          - `gliner` (object, optional) — Configuration for GLiNER PII detection.
            - `server_endpoint` (string, optional, default: http://localhost:8000/v1/chat/completions) — The endpoint for the GLiNER detection server. By default, this is for a locally hosted NIM instance running the GLiNER model. Changed from http://localhost:1235/v1/extract (custom server) to http://localhost:8000/v1/chat/completions (NIM) in this release. If you use the custom gliner_server, set this explicitly to http://localhost:1235/v1/extract.
            - `model` (string, optional, default: nvidia/gliner-pii) — Model identifier sent in NIM API requests (only used when server_endpoint ends with /v1/chat/completions).
            - `api_key_env_var` (string, optional) — Name of the environment variable containing the API key for authenticated endpoints (e.g., NVIDIA_API_KEY).
            - `threshold` (double, optional, default: 0.5) — Confidence threshold for entity detection (0.0 to 1.0).
            - `chunk_length` (integer, optional, default: 384) — Length of text chunks for processing.
            - `overlap` (integer, optional, default: 128) — Overlap between chunks.
            - `flat_ner` (boolean, optional, default: false) — Whether to use flat NER mode. Setting to False allows for nested entities.
            - `input` (object, optional) — Configuration of the entities to be detected on the user input.
            - `output` (object, optional) — Configuration of the entities to be detected on the bot output.
            - `retrieval` (object, optional) — Configuration of the entities to be detected on retrieved relevant chunks.
          - `polygraf` (object, optional) — Configuration for Polygraf PII detection.
            - `server_endpoint` (string, optional, default: http://localhost:8000/v1/pii/text-detect) — The endpoint for the Polygraf detection server.
            - `input` (object, optional) — Configuration of the entities to be detected on the user input.
            - `output` (object, optional) — Configuration of the entities to be detected on the bot output.
            - `retrieval` (object, optional) — Configuration of the entities to be detected on retrieved relevant chunks.
          - `fiddler` (object, optional) — Configuration for Fiddler Guardrails.
            - `fiddler_endpoint` (string, optional, default: http://localhost:8080/process/text) — The global endpoint for Fiddler Guardrails requests.
            - `safety_threshold` (double, optional, default: 0.1) — Fiddler Guardrails safety detection threshold.
            - `faithfulness_threshold` (double, optional, default: 0.05) — Fiddler Guardrails faithfulness detection threshold.
          - `clavata` (object, optional) — Configuration for Clavata.
            - `server_endpoint` (string, optional, default: https://gateway.app.clavata.ai:8443) — The endpoint for the Clavata API
            - `policies` (map from string to string, optional) — A dictionary of policy aliases and their corresponding IDs.
            - `label_match_logic` (enum, optional, default: ANY) — The logic to use when deciding whether the evaluation matched. If ANY, only one of the configured labels needs to be found in the input or output. If ALL, all configured labels must be found in the input or output.
            - `input` (object, optional) — Clavata configuration for an Input Guardrail
            - `output` (object, optional) — Clavata configuration for an Output Guardrail
          - `crowdstrike_aidr` (object, optional) — Configuration for CrowdStrike AIDR.
            - `timeout` (double, optional, default: 30) — Timeout in seconds for API requests to CrowdStrike AIDR
          - `pangea` (object, optional) — Configuration for Pangea.
            - `input` (object, optional) — Pangea configuration for an Input Guardrail
            - `output` (object, optional) — Pangea configuration for an Output Guardrail
          - `guardrails_ai` (object, optional) — Configuration for Guardrails AI validators.
            - `validators` (list of object, optional) — List of Guardrails AI validators to apply. Each validator can have its own parameters and metadata.
          - `trend_micro` (object, optional) — Configuration for Trend Micro.
            - `v1_url` (string, optional, default: https://api.xdr.trendmicro.com/v3.0/aiSecurity/applyGuardrails) — The endpoint for the Trend Micro AI Guard API. For other regions, use: [https://api.\{region}.xdr.trendmicro.com/v3.0/aiSecurity/applyGuardrails](https://api.\{region}.xdr.trendmicro.com/v3.0/aiSecurity/applyGuardrails) where region is eu, jp, au, in, sg, or mea.
            - `api_key_env_var` (string, optional) — Environment variable containing API key for Trend Micro AI Guard
            - `application_name` (string, optional, default: nemo-guardrails) — Application name for TMV1-Application-Name header (REQUIRED). Must contain only letters, numbers, hyphens, and underscores, with a maximum length of 64 characters.
            - `detailed_response` (boolean, optional, default: false) — If True, returns detailed AI Guard results with confidence scores (Prefer: return=representation). If False, returns minimal response with only action and reasons (Prefer: return=minimal).
          - `ai_defense` (object, optional) — Configuration for Cisco AI Defense.
            - `timeout` (double, optional, default: 30) — Timeout in seconds for API requests to AI Defense service
            - `fail_open` (boolean, optional, default: false) — If True, allow content when AI Defense API call fails (fail open). If False, block content when API call fails (fail closed). Does not affect missing configuration validation.
          - `content_safety` (object, optional) — Configuration for content safety rails.
            - `multilingual` (object, optional) — Configuration for multilingual refusal messages.
            - `reasoning` (object, optional) — Configuration for reasoning mode in content safety models.
          - `hf_classifier` (map from string to object, optional) — Named HF classifier configurations. Keys are classifier names referenced by flows.
            - `engine`: `fms` (RemoteHFClassifierConfig)
              - `base_url` (string, required) — Base URL for the inference server (e.g. 'http://host:8000').
              - `model` (string, required) — HF model ID, local path, or server-side model identifier.
              - `api_key_env_var` (string, optional) — Environment variable name holding the API key. Resolved at runtime to an Authorization: Bearer header.
              - `blocked_labels` (list of string, optional) — Labels that should trigger blocking when detected above threshold.
              - `parameters` (map from string to any, optional) — Remote backend parameters: 'timeout' (float, seconds), 'verify_ssl' (bool), 'ca_cert'/'client_cert'/'client_key' (str, paths). Note: 'ca_cert' replaces (not extends) system CAs; use a concatenated bundle to include both custom and system CAs.
              - `threshold` (double, optional, default: 0.5) — Minimum score for a detection to trigger blocking.
            - `engine`: `kserve` (RemoteHFClassifierConfig)
              - `base_url` (string, required) — Base URL for the inference server (e.g. 'http://host:8000').
              - `model` (string, required) — HF model ID, local path, or server-side model identifier.
              - `api_key_env_var` (string, optional) — Environment variable name holding the API key. Resolved at runtime to an Authorization: Bearer header.
              - `blocked_labels` (list of string, optional) — Labels that should trigger blocking when detected above threshold.
              - `parameters` (map from string to any, optional) — Remote backend parameters: 'timeout' (float, seconds), 'verify_ssl' (bool), 'ca_cert'/'client_cert'/'client_key' (str, paths). Note: 'ca_cert' replaces (not extends) system CAs; use a concatenated bundle to include both custom and system CAs.
              - `threshold` (double, optional, default: 0.5) — Minimum score for a detection to trigger blocking.
            - `engine`: `local` (LocalHFClassifierConfig)
              - `model` (string, required) — HF model ID, local path, or server-side model identifier.
              - `blocked_labels` (list of string, optional) — Labels that should trigger blocking when detected above threshold.
              - `parameters` (map from string to any, optional) — Forwarded as kwargs to transformers.pipeline() (e.g. device, dtype, trust_remote_code, token, revision, aggregation_strategy).
              - `task` (enum, optional, default: text-classification) — HuggingFace pipeline task type.
              - `threshold` (double, optional, default: 0.5) — Minimum score for a detection to trigger blocking.
            - `engine`: `vllm` (RemoteHFClassifierConfig)
              - `base_url` (string, required) — Base URL for the inference server (e.g. 'http://host:8000').
              - `model` (string, required) — HF model ID, local path, or server-side model identifier.
              - `api_key_env_var` (string, optional) — Environment variable name holding the API key. Resolved at runtime to an Authorization: Bearer header.
              - `blocked_labels` (list of string, optional) — Labels that should trigger blocking when detected above threshold.
              - `parameters` (map from string to any, optional) — Remote backend parameters: 'timeout' (float, seconds), 'verify_ssl' (bool), 'ca_cert'/'client_cert'/'client_key' (str, paths). Note: 'ca_cert' replaces (not extends) system CAs; use a concatenated bundle to include both custom and system CAs.
              - `threshold` (double, optional, default: 0.5) — Minimum score for a detection to trigger blocking.
          - `context_bloat_detection` (object, optional) — Configuration for context bloat / context manipulation detection.
            - `max_chars` (integer, optional, default: 5000) — Size cap in characters. Inputs exceeding this are flagged.
            - `min_chars` (integer, optional, default: 50) — Minimum characters before entropy/run/repetition checks apply. Shorter texts are only checked against size cap.
            - `min_entropy` (double, optional, default: 3.5) — Shannon entropy floor (bits/char). English prose is ~4.0-4.5.
            - `max_repetition_ratio` (double, optional, default: 0.4) — Max fraction of repeated n-grams (0.0-1.0).
            - `ngram_size` (integer, optional, default: 3) — Size of n-grams used for repetition detection.
            - `max_run_ratio` (double, optional, default: 0.1) — Max fraction of text that is the longest single-char run.
            - `action` (enum, optional, default: reject) — Action on detection: 'reject', 'truncate', or 'warn'.
        - `input` (object, optional) — Configuration of the input rails.
          - `parallel` (boolean, optional, default: false) — If True, the input rails are executed in parallel.
          - `flows` (list of string, optional) — The names of all the flows that implement input rails.
        - `output` (object, optional) — Configuration of the output rails.
          - `parallel` (boolean, optional, default: false) — If True, the output rails are executed in parallel.
          - `flows` (list of string, optional) — The names of all the flows that implement output rails.
          - `streaming` (object, optional) — Configuration for streaming output rails.
            - `enabled` (boolean, optional, default: true) — Enables streaming mode when True.
            - `chunk_size` (integer, optional, default: 200) — The number of tokens in each processing chunk. This is the size of the token block on which output rails are applied.
            - `context_size` (integer, optional, default: 50) — The number of tokens carried over from the previous chunk to provide context for continuity in processing.
            - `stream_first` (boolean, optional, default: true) — If True, token chunks are streamed immediately before output rails are applied.
          - `apply_to_reasoning_traces` (boolean, optional, default: false) — If True, output rails will apply guardrails to both reasoning traces and output response. If False, output rails will only apply guardrails to the output response excluding the reasoning traces, thus keeping reasoning traces unaltered.
        - `retrieval` (object, optional) — Configuration of the retrieval rails.
          - `flows` (list of string, optional) — The names of all the flows that implement retrieval rails.
        - `dialog` (object, optional) — Configuration of the dialog rails.
          - `single_call` (object, optional) — Configuration for the single LLM call option.
            - `enabled` (boolean, optional, default: false)
            - `fallback_to_multiple_calls` (boolean, optional, default: true) — Whether to fall back to multiple calls if a single call is not possible.
          - `user_messages` (object, optional) — Configuration for how the user messages are interpreted.
            - `embeddings_only` (boolean, optional, default: false) — Whether to use only embeddings for computing the user canonical form messages.
            - `embeddings_only_similarity_threshold` (double, optional) — The similarity threshold to use when using only embeddings for computing the user canonical form messages.
            - `embeddings_only_fallback_intent` (string, optional) — Defines the fallback intent when the similarity is below the threshold. If set to None, the user intent is computed normally using the LLM. If set to a string value, that string is used as the intent.
        - `actions` (object, optional) — Configuration of action rails.
          - `instant_actions` (list of string, optional) — The names of all actions which should finish instantly.
        - `tool_output` (object, optional) — Configuration of tool output rails.
          - `flows` (list of string, optional) — The names of all the flows that implement tool output rails.
          - `parallel` (boolean, optional, default: false) — If True, the tool output rails are executed in parallel.
        - `tool_input` (object, optional) — Configuration of tool input rails.
          - `flows` (list of string, optional) — The names of all the flows that implement tool input rails.
          - `parallel` (boolean, optional, default: false) — If True, the tool input rails are executed in parallel.
      - `enable_rails_exceptions` (boolean, optional, default: false) — If set, the pre-defined guardrails raise exceptions instead of returning pre-defined messages.
      - `passthrough` (boolean, optional) — Whether the original prompt should pass through the guardrails configuration as is. This means it will not be altered in any way.
      - `tracing` (object, optional) — Configuration for tracing.
        - `enabled` (boolean, optional, default: false)
        - `adapters` (list of object, optional) — The list of tracing adapters to use. If not specified, the default adapters are used.
          - `name` (string, optional, default: FileSystem) — The name of the adapter.
        - `span_format` (string, optional, default: opentelemetry) — The span format to use. Options are 'legacy' (simple metrics) or 'opentelemetry' (OpenTelemetry semantic conventions).
        - `enable_content_capture` (boolean, optional, default: false) — Capture prompts and responses (user/assistant/tool message content) in tracing/telemetry events. Disabled by default for privacy and alignment with OpenTelemetry GenAI semantic conventions. WARNING: Enabling this may include PII and sensitive data in your telemetry backend.
  - `config_id` (string, optional, default: system/default) — The id of the configuration to be used.
  - `config_ids` (list of string, optional) — The list of configuration ids to be used. If set, the configurations will be combined.
  - `return_choice` (boolean, optional, default: false) — If set, guardrails data will be included as a JSON in the choices array.
  - `context` (map from string to any, optional) — Additional context data to be added to the conversation.
  - `stream` (boolean, optional, default: false) — If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
  - `options` (object, optional) — Additional options for controlling the generation.
    - `rails` (object, optional) — Options for which rails should be applied for the generation. By default, all rails are enabled.
      - `input` (boolean or list of string, optional, default: true) — Whether the input rails are enabled or not. If a list of names is specified, then only the specified input rails will be applied.
      - `output` (boolean or list of string, optional, default: true) — Whether the output rails are enabled or not. If a list of names is specified, then only the specified output rails will be applied.
      - `retrieval` (boolean or list of string, optional, default: true) — Whether the retrieval rails are enabled or not. If a list of names is specified, then only the specified retrieval rails will be applied.
      - `dialog` (boolean, optional, default: true) — Whether the dialog rails are enabled or not.
    - `llm_params` (map from string to any, optional) — Additional parameters that should be used for the LLM call
    - `llm_output` (boolean, optional, default: false) — Whether the response should also include any custom LLM output.
    - `output_vars` (boolean or list of string, optional) — Whether additional context information should be returned. When True is specified, the whole context is returned. Otherwise, a list of key names can be specified.
    - `log` (object, optional) — Options about what to include in the log. By default, nothing is included.
      - `activated_rails` (boolean, optional, default: false) — Include detailed information about the rails that were activated during generation.
      - `llm_calls` (boolean, optional, default: false) — Include information about all the LLM calls that were made. This includes: prompt, completion, token usage, raw response, etc.
      - `internal_events` (boolean, optional, default: false) — Include the array of internal generated events.
      - `colang_history` (boolean, optional, default: false) — Include the history of the conversation in Colang format.
      - `stats` (boolean, optional, default: false) — Include generation statistics — rail durations, LLM call counts, and token usage.
  - `state` (map from string to any, optional) — A state object that should be used to continue the interaction.

## Response

### 200

Successful Response

- `status` (enum, required) — Overall status indicating if all rails passed or if any failed.
  - Allowed values: `blocked`, `success`, `unknown`
- `rails_status` (map from string to object, required) — Dictionary mapping each rail to its status.
  - `status` (enum, required) — Status of the individual rail.
    - Allowed values: `blocked`, `success`, `unknown`
- `guardrails_data` (object, optional) — Additional data related to guardrails.
  - `llm_output` (map from string to any, optional) — Contains any additional output coming from the LLM.
  - `config_ids` (list of string, optional) — The list of configuration ids that were used.
  - `output_data` (map from string to any, optional) — The output data, i.e. a dict with the values corresponding to the `output_vars`.
  - `log` (object, optional) — Additional logging information.
    - `activated_rails` (list of object, optional) — The list of rails that were activated during generation.
      - `type` (string, required) — The type of the rail that was activated, e.g., input, output, dialog.
      - `name` (string, required) — The name of the rail, i.e., the name of the flow implementing the rail.
      - `decisions` (list of string, optional) — A sequence of decisions made by the rail, e.g., 'bot refuse to respond', 'stop', 'continue'.
      - `executed_actions` (list of object, optional) — The list of actions executed by the rail.
        - `action_name` (string, required) — The name of the action that was executed.
        - `action_params` (map from string to any, optional) — The parameters for the action.
        - `return_value` (any, optional) — The value returned by the action.
        - `llm_calls` (list of object, optional) — Information about the LLM calls made by the action.
          - `task` (string, optional) — The internal task that made the call.
          - `duration` (double, optional) — The duration in seconds.
          - `total_tokens` (integer, optional) — The total number of used tokens.
          - `prompt_tokens` (integer, optional) — The number of input tokens.
          - `completion_tokens` (integer, optional) — The number of output tokens.
          - `started_at` (double, optional, default: 0) — The timestamp for when the LLM call started.
          - `finished_at` (double, optional, default: 0) — The timestamp for when the LLM call finished.
          - `id` (string, optional) — The unique prompt identifier.
          - `prompt` (string, optional) — The prompt that was used for the LLM call.
          - `completion` (string, optional) — The completion generated by the LLM.
          - `raw_response` (map from string to any, optional) — The raw response received from the LLM. May contain additional information, e.g. logprobs.
          - `llm_model_name` (string, optional, default: unknown) — The name of the model use for the LLM call.
        - `started_at` (double, optional) — Timestamp for when the action started.
        - `finished_at` (double, optional) — Timestamp for when the action finished.
        - `duration` (double, optional) — How long the action took to execute, in seconds.
      - `stop` (boolean, optional, default: false) — Whether the rail decided to stop any further processing.
      - `additional_info` (map from string to any, optional) — Additional information coming from rail.
      - `started_at` (double, optional) — Timestamp for when the rail started.
      - `finished_at` (double, optional) — Timestamp for when the rail finished.
      - `duration` (double, optional) — The duration in seconds for applying the rail. Some rails are applied instantly, e.g., dialog rails, so they don't have a duration.
    - `stats` (object, optional) — General stats about the generation process.
      - `input_rails_duration` (double, optional) — The time in seconds spent in processing the input rails.
      - `dialog_rails_duration` (double, optional) — The time in seconds spent in processing the dialog rails.
      - `generation_rails_duration` (double, optional) — The time in seconds spent in generation rails.
      - `output_rails_duration` (double, optional) — The time in seconds spent in processing the output rails.
      - `total_duration` (double, optional) — The total time in seconds.
      - `llm_calls_duration` (double, optional, default: 0) — The time in seconds spent in LLM calls.
      - `llm_calls_count` (integer, optional, default: 0) — The number of LLM calls in total.
      - `llm_calls_total_prompt_tokens` (integer, optional, default: 0) — The total number of prompt tokens.
      - `llm_calls_total_completion_tokens` (integer, optional, default: 0) — The total number of completion tokens.
      - `llm_calls_total_tokens` (integer, optional, default: 0) — The total number of tokens.
    - `llm_calls` (list of object, optional) — The list of LLM calls that have been made to fulfill the generation request.
      - `task` (string, optional) — The internal task that made the call.
      - `duration` (double, optional) — The duration in seconds.
      - `total_tokens` (integer, optional) — The total number of used tokens.
      - `prompt_tokens` (integer, optional) — The number of input tokens.
      - `completion_tokens` (integer, optional) — The number of output tokens.
      - `started_at` (double, optional, default: 0) — The timestamp for when the LLM call started.
      - `finished_at` (double, optional, default: 0) — The timestamp for when the LLM call finished.
      - `id` (string, optional) — The unique prompt identifier.
      - `prompt` (string, optional) — The prompt that was used for the LLM call.
      - `completion` (string, optional) — The completion generated by the LLM.
      - `raw_response` (map from string to any, optional) — The raw response received from the LLM. May contain additional information, e.g. logprobs.
      - `llm_model_name` (string, optional, default: unknown) — The name of the model use for the LLM call.
    - `internal_events` (list of map from string to any, optional) — The complete sequence of internal events generated.
    - `colang_history` (string, optional) — The Colang history associated with the generation.

## Examples

**Request**

```json
{
  "model": "string",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ]
}
```

**Response**

```json
{
  "status": "blocked",
  "rails_status": {},
  "guardrails_data": {
    "llm_output": {},
    "config_ids": [
      "string"
    ],
    "output_data": {},
    "log": {
      "activated_rails": [
        {
          "type": "string",
          "name": "string",
          "decisions": [
            "string"
          ],
          "executed_actions": [
            {
              "action_name": "string",
              "action_params": {},
              "return_value": null,
              "llm_calls": [
                {
                  "task": "string",
                  "duration": 1.1,
                  "total_tokens": 1,
                  "prompt_tokens": 1,
                  "completion_tokens": 1,
                  "started_at": 0,
                  "finished_at": 0,
                  "id": "string",
                  "prompt": "string",
                  "completion": "string",
                  "raw_response": {},
                  "llm_model_name": "unknown"
                }
              ],
              "started_at": 1.1,
              "finished_at": 1.1,
              "duration": 1.1
            }
          ],
          "stop": false,
          "additional_info": {},
          "started_at": 1.1,
          "finished_at": 1.1,
          "duration": 1.1
        }
      ],
      "stats": {
        "input_rails_duration": 1.1,
        "dialog_rails_duration": 1.1,
        "generation_rails_duration": 1.1,
        "output_rails_duration": 1.1,
        "total_duration": 1.1,
        "llm_calls_duration": 0,
        "llm_calls_count": 0,
        "llm_calls_total_prompt_tokens": 0,
        "llm_calls_total_completion_tokens": 0,
        "llm_calls_total_tokens": 0
      },
      "llm_calls": [
        {
          "task": "string",
          "duration": 1.1,
          "total_tokens": 1,
          "prompt_tokens": 1,
          "completion_tokens": 1,
          "started_at": 0,
          "finished_at": 0,
          "id": "string",
          "prompt": "string",
          "completion": "string",
          "raw_response": {},
          "llm_model_name": "unknown"
        }
      ],
      "internal_events": [
        {}
      ],
      "colang_history": "string"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks"

payload = {
    "model": "string",
    "messages": [
        {
            "content": "string",
            "role": "string"
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"model":"string","messages":[{"content":"string","role":"string"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks"

	payload := strings.NewReader("{\n  \"model\": \"string\",\n  \"messages\": [\n    {\n      \"content\": \"string\",\n      \"role\": \"string\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"string\",\n  \"messages\": [\n    {\n      \"content\": \"string\",\n      \"role\": \"string\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"string\",\n  \"messages\": [\n    {\n      \"content\": \"string\",\n      \"role\": \"string\"\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks', [
  'body' => '{
  "model": "string",
  "messages": [
    {
      "content": "string",
      "role": "string"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"string\",\n  \"messages\": [\n    {\n      \"content\": \"string\",\n      \"role\": \"string\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "model": "string",
  "messages": [
    [
      "content": "string",
      "role": "string"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/guardrails/v2/workspaces/workspace/checks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```