Glaider helps identify and prevent potential prompt injection attacks that could manipulate AI model behavior. It provides options for asynchronous processing, metadata inclusion, tagging, session tracking, message saving, strictness levels, and notifications to enhance functionality and integration with your applications.
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
Replace YOUR_API_KEY
with your actual API key.
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | The input text to be analyzed for potential prompt injection. |
zero_latency | boolean | No | If true , the request returns immediately, and processing is done asynchronously. Defaults to false . |
tag | string | No | A custom tag or identifier for the request, useful for tracking and categorization. Defaults to "unknown" . |
chat_id | string | No | An identifier for the chat session or conversation. Useful for associating the analysis with a specific session. |
save_message | boolean | No | If true , the prompt message will be saved in the system for future reference or auditing. Defaults to false . |
notifications | boolean | No | If true , notifications will be sent based on the analysis result. Useful for alerting admins or triggering workflows. Defaults to false . |
strictness | integer | No | Controls the strictness level of detection. Accepts 1 , 2 , or 3 . See Strictness Levels for details. Defaults to None . |
metadata | object | No | A JSON object containing additional data or context for the request. Defaults to {} . |
Notes:
false
if omitted.strictness
parameter defaults to None
if not provided, which uses the default detection behavior.metadata
parameter defaults to an empty object {}
if not provided.The strictness
parameter controls when advanced detection is performed:
strictness = 1
): Advanced detection is performed only if the initial detection indicates a potential prompt injection.strictness = 2
): Advanced detection is always performed, regardless of the initial detection result.strictness = 3
): Advanced detection is performed only if the initial detection does not indicate a prompt injection.Using higher strictness levels may result in longer processing times due to additional computation required for advanced detection.
200 OK
application/json
202 Accepted
application/json
status
(string
): Indicates the status of the request ("success"
, "pending"
, or "error"
).result
(object
): Contains the detection result (present in synchronous responses).
is_prompt_injection
(boolean
): true
if prompt injection was detected, false
otherwise.prompt
(string
or null
): The analyzed prompt, included if save_message
is true
.timestamp
(string
): The timestamp when the analysis was performed, in ISO 8601 format.tag
(string
): The tag associated with the request.analysis_id
(string
): Unique identifier for the analysis; can be used to retrieve results later.chat_id
(string
or null
): The chat session identifier, if provided.metadata
(object
or null
): The metadata provided in the request, if any.notifications
(boolean
): Indicates whether notifications were enabled.strictness
(integer
or null
): The strictness level used in the analysis.initial_detection_label
(string
): Classification label of the initial detection ("INJECTION"
or "SAFE"
).initial_detection_score
(number
or null
): Confidence score of the initial classification (between 0
and 1
).advanced_detection_result
(boolean
or null
): Result of the advanced detection (true
if injection detected, false
if not, null
if advanced detection not performed).message
(string
): Additional information or error message.prompt
: The text input that will be analyzed for potential prompt injections. This field is required.
zero_latency
: When set to true
, the endpoint will not wait for the analysis to complete. Instead, it will immediately return a response with a status
of "success"
and a message
indicating that processing is occurring in the background. Use the provided analysis_id
to retrieve the analysis result later via the /analysis-result
endpoint.
tag
: A user-defined string for labeling or categorizing the request. It’s useful for tracking purposes or analytics within your application.
chat_id
: An identifier for the chat session or conversation. If provided, it can help associate the analysis result with a specific session in your application.
save_message
: If true
, the prompt message will be stored in the system. This is useful for auditing, compliance, or future analysis.
notifications
: If true
, the system will send notifications based on the analysis result. Notifications might include alerts to administrators or triggering automated workflows.
strictness
: Controls when advanced detection is performed:
strictness = 1
): Advanced detection is performed only if the initial detection indicates a potential prompt injection.strictness = 2
): Advanced detection is always performed.strictness = 3
): Advanced detection is performed only if the initial detection does not indicate a prompt injection.If strictness
is omitted or set to null
, default detection behavior is used without advanced detection.
metadata
: An optional JSON object containing additional data or context for the request. This metadata can include any information that you want to associate with the analysis, such as user identifiers, session details, or custom notes. The contents of metadata
are not processed by the API but are stored and returned in the results for your reference.
If you use asynchronous processing by setting zero_latency
to true
, you will receive an analysis_id
in the response. You can retrieve the analysis result using this ID through the /analysis-result
endpoint.
Rate Limiting: The API enforces rate limits to ensure fair usage. If you exceed the rate limit, you will receive a 429 Too Many Requests
response. Please implement appropriate retry logic with exponential backoff in your applications.
Error Handling: Always check the status
field in the response. If it’s "error"
, refer to the message
field for details.
Security: Keep your API key secure. Do not expose it in client-side code, public repositories, or logs.
Support: For assistance or inquiries, contact our support team at info@glaider.it.
Data Privacy: If you enable save_message
, ensure you comply with data protection regulations and policies relevant to your organization and jurisdiction.
Notifications: The nature of notifications (e.g., email alerts, webhook triggers) depends on your account configuration. Contact support to set up notifications.
Example Scenario:
You have a chat application and want to analyze user prompts for potential prompt injection attacks with varying levels of strictness based on the user’s role or the sensitivity of the conversation. By including the metadata
parameter, you can attach additional context to each request, such as the user’s ID, session details, or custom flags. This allows you to correlate analysis results with specific users or sessions, enhancing your security monitoring and incident response processes.
By adjusting the strictness
parameter, you can control the trade-off between detection accuracy and processing time. For high-risk interactions, you might set strictness
to 2
to always perform advanced detection, ensuring maximum security.
Also, by setting zero_latency
to true
, your application can quickly respond to the user while the analysis happens in the background. If a prompt injection is detected, and notifications
is set to true
, your system can receive an alert to take appropriate action, such as logging the event or notifying a moderator.
Glaider helps identify and prevent potential prompt injection attacks that could manipulate AI model behavior. It provides options for asynchronous processing, metadata inclusion, tagging, session tracking, message saving, strictness levels, and notifications to enhance functionality and integration with your applications.
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
Replace YOUR_API_KEY
with your actual API key.
Parameter | Type | Required | Description |
---|---|---|---|
prompt | string | Yes | The input text to be analyzed for potential prompt injection. |
zero_latency | boolean | No | If true , the request returns immediately, and processing is done asynchronously. Defaults to false . |
tag | string | No | A custom tag or identifier for the request, useful for tracking and categorization. Defaults to "unknown" . |
chat_id | string | No | An identifier for the chat session or conversation. Useful for associating the analysis with a specific session. |
save_message | boolean | No | If true , the prompt message will be saved in the system for future reference or auditing. Defaults to false . |
notifications | boolean | No | If true , notifications will be sent based on the analysis result. Useful for alerting admins or triggering workflows. Defaults to false . |
strictness | integer | No | Controls the strictness level of detection. Accepts 1 , 2 , or 3 . See Strictness Levels for details. Defaults to None . |
metadata | object | No | A JSON object containing additional data or context for the request. Defaults to {} . |
Notes:
false
if omitted.strictness
parameter defaults to None
if not provided, which uses the default detection behavior.metadata
parameter defaults to an empty object {}
if not provided.The strictness
parameter controls when advanced detection is performed:
strictness = 1
): Advanced detection is performed only if the initial detection indicates a potential prompt injection.strictness = 2
): Advanced detection is always performed, regardless of the initial detection result.strictness = 3
): Advanced detection is performed only if the initial detection does not indicate a prompt injection.Using higher strictness levels may result in longer processing times due to additional computation required for advanced detection.
200 OK
application/json
202 Accepted
application/json
status
(string
): Indicates the status of the request ("success"
, "pending"
, or "error"
).result
(object
): Contains the detection result (present in synchronous responses).
is_prompt_injection
(boolean
): true
if prompt injection was detected, false
otherwise.prompt
(string
or null
): The analyzed prompt, included if save_message
is true
.timestamp
(string
): The timestamp when the analysis was performed, in ISO 8601 format.tag
(string
): The tag associated with the request.analysis_id
(string
): Unique identifier for the analysis; can be used to retrieve results later.chat_id
(string
or null
): The chat session identifier, if provided.metadata
(object
or null
): The metadata provided in the request, if any.notifications
(boolean
): Indicates whether notifications were enabled.strictness
(integer
or null
): The strictness level used in the analysis.initial_detection_label
(string
): Classification label of the initial detection ("INJECTION"
or "SAFE"
).initial_detection_score
(number
or null
): Confidence score of the initial classification (between 0
and 1
).advanced_detection_result
(boolean
or null
): Result of the advanced detection (true
if injection detected, false
if not, null
if advanced detection not performed).message
(string
): Additional information or error message.prompt
: The text input that will be analyzed for potential prompt injections. This field is required.
zero_latency
: When set to true
, the endpoint will not wait for the analysis to complete. Instead, it will immediately return a response with a status
of "success"
and a message
indicating that processing is occurring in the background. Use the provided analysis_id
to retrieve the analysis result later via the /analysis-result
endpoint.
tag
: A user-defined string for labeling or categorizing the request. It’s useful for tracking purposes or analytics within your application.
chat_id
: An identifier for the chat session or conversation. If provided, it can help associate the analysis result with a specific session in your application.
save_message
: If true
, the prompt message will be stored in the system. This is useful for auditing, compliance, or future analysis.
notifications
: If true
, the system will send notifications based on the analysis result. Notifications might include alerts to administrators or triggering automated workflows.
strictness
: Controls when advanced detection is performed:
strictness = 1
): Advanced detection is performed only if the initial detection indicates a potential prompt injection.strictness = 2
): Advanced detection is always performed.strictness = 3
): Advanced detection is performed only if the initial detection does not indicate a prompt injection.If strictness
is omitted or set to null
, default detection behavior is used without advanced detection.
metadata
: An optional JSON object containing additional data or context for the request. This metadata can include any information that you want to associate with the analysis, such as user identifiers, session details, or custom notes. The contents of metadata
are not processed by the API but are stored and returned in the results for your reference.
If you use asynchronous processing by setting zero_latency
to true
, you will receive an analysis_id
in the response. You can retrieve the analysis result using this ID through the /analysis-result
endpoint.
Rate Limiting: The API enforces rate limits to ensure fair usage. If you exceed the rate limit, you will receive a 429 Too Many Requests
response. Please implement appropriate retry logic with exponential backoff in your applications.
Error Handling: Always check the status
field in the response. If it’s "error"
, refer to the message
field for details.
Security: Keep your API key secure. Do not expose it in client-side code, public repositories, or logs.
Support: For assistance or inquiries, contact our support team at info@glaider.it.
Data Privacy: If you enable save_message
, ensure you comply with data protection regulations and policies relevant to your organization and jurisdiction.
Notifications: The nature of notifications (e.g., email alerts, webhook triggers) depends on your account configuration. Contact support to set up notifications.
Example Scenario:
You have a chat application and want to analyze user prompts for potential prompt injection attacks with varying levels of strictness based on the user’s role or the sensitivity of the conversation. By including the metadata
parameter, you can attach additional context to each request, such as the user’s ID, session details, or custom flags. This allows you to correlate analysis results with specific users or sessions, enhancing your security monitoring and incident response processes.
By adjusting the strictness
parameter, you can control the trade-off between detection accuracy and processing time. For high-risk interactions, you might set strictness
to 2
to always perform advanced detection, ensuring maximum security.
Also, by setting zero_latency
to true
, your application can quickly respond to the user while the analysis happens in the background. If a prompt injection is detected, and notifications
is set to true
, your system can receive an alert to take appropriate action, such as logging the event or notifying a moderator.