API Documentation
Guardian API Details

<POST> Chat API

3min
The Chat API processes user prompts according to the specified execution mode and returns a detailed response, including application metadata, guardrail configurations, token usage, and policy compliance checks.
POST
Request
Response
Path Params
app_name
required
String
Specifies the application endpoint for inference. Possible values: app1, app2, app3.
Body Parameters
prompt
required
String
The user's input or query to be processed by the API.
Curl
Python
Responses
200
401
429
500


Response Field Definitions:

The table below provides a comprehensive breakdown of all the fields included in the API response. It describes each field's purpose, type, and possible values to help you understand how to interpret the API's output effectively.

Field

Type

Description

api_status_code

integer

HTTP status code of the API response. Possible values: 200 (Success), 401 (Access Denied), 412 (Precondition Failed), 500 (Internal Server Error).

api_status_message

string

Message indicating the status of the API call (e.g., "Successful", "LLM Connectivity Issue", "Internal Server Error", "Access Denied").



app_prompt

string

The user's application-specific prompt.

app_prompt_context

string

Context provided alongside the user's prompt. This field is currently an empty string.

input

dictionary

Details about the input, including:





  • guardrails_metadata: Input configuration, number of active and inactive guardrails.





  • num_tokens: Number of tokens processed in the input.





  • violated_policies: Policies violated, if any, or an empty string.





  • latency/sec: given user's prompt processing time in sec

output

dictionary

Details about the output, including:





  • guardrails_metadata: output configuration, number of active and inactive guardrails.





  • num_tokens: Number of tokens processed in the input.





  • violated_policies: Policies violated, if any, or an empty string.





  • latency/sec: llm response processing time in sec

metadata

dictionary

Metadata about the API call, including:





  • api_version: API version (e.g., v1.5).





  • app_name: Application name





  • event_id: Unique identifier for the API call.





  • execution_mode: Mode of operation (e.g., Block).





  • timestamp: Time of the API call in GMT.

redacted_prompt

string

Sanitized or redacted version of the user prompt if PII Redaction is enabled, or an empty string otherwise.

siem

dictionary

Security Information and Event Management (SIEM) details, including:





  • active_siem: List of active SIEM systems.





  • inactive_siem: List of inactive SIEM systems.





  • status_code: Status code for SIEM processing. Possible values: 200 (Success) , 500 (Internal Server Error), null or empty is not needed to send message to siem





  • status_message: Status message for SIEM processing.(e.g., "Successful", "Internal Server Error", empty string ).

violation_exist

boolean

Indicates if any policy violations occurred (true or false).

violation_on

string

Indicates whether the policy violation occurred due to the user's prompt (input) or the LLM response(output).

Connecting to the Chat API:

This below Gist provides a detailed example of how to connect to the Chat API, including how to structure the request, handle the response, and customize the API call based on your specific needs.

To get started with integrating the Chat API, you can refer to the following GitHub Gist for a step-by-step guide and example code: