Skip to main content

Get All Policy Templates

Endpoint: GET https://guardrails.aporia.com/api/v1/policies Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Response Fields: The response type is a list. each object in the list contains the following fields:
string
required
The policy type.
string
required
The policy category.
string
required
The policy default_name.
string
required
Description of the policy.
Response JSON Example:

Get Specific Policy Template

Endpoint: GET https://guardrails.aporia.com/api/v1/policies/{template_type} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters::
string
required
The type identifier of the policy template to retrieve.
Response Fields:
string
required
The policy type.
string
required
The policy category.
string
required
The policy default name.
string
required
Description of the policy.
Response JSON Example:

Create Custom Policy

Endpoint: POST https://guardrails.aporia.com/api/v1/policies/custom_policy Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Request Fields:
string
required
The name of the custom policy.
string
required
The target of the policy - either prompt or response.
CustomPolicyConditionConfig
required
There are 2 configuration modes for custom policy - simple and advanced, each with it’s own condition config.For simple mode, the following parameters must be passed:
  • evaluation_instructions - Instructions that define how the policy should evaluate inputs.
  • modality - Defines whether instructions trigger a violation if they evaluate to TRUE or FALSE.
For advanced mode, the following parameters must be passed:
  • system_prompt - The system prompt that will be passed to the LLM
  • top_p - Top-P sampling probability, between 0 and 1. Defaults to 1.
  • temperature - Sampling temperature to use, between 0 and 2. Defaults to 1.
  • modality - Defines whether instructions trigger a violation if they evaluate to TRUE or FALSE.
Response Fields:
string
required
The custom policy type identifier.
string
required
The policy category, typically ‘custom’ for user-defined policies.
string
required
The default name for the policy template, as provided in the request.
string
required
A description of the policy based on the evaluation instructions.
Response JSON Example:

Edit Custom Policy

Endpoint: PUT https://guardrails.aporia.com/api/v1/policies/custom_policy/{custom_policy_type} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
string
required
The custom policy type identifier to update. Returned from Create Custom Policy endpoint.
Request Fields:
string
required
The name of the custom policy.
string
required
The target of the policy - either prompt or response.
CustomPolicyConditionConfig
required
There are 2 configuration modes for custom policy - simple and advanced, each with it’s own condition config.For simple mode, the following parameters must be passed:
  • evaluation_instructions - Instructions that define how the policy should evaluate inputs.
  • modality - Defines whether instructions trigger a violation if they evaluate to TRUE or FALSE.
For advanced mode, the following parameters must be passed:
  • system_prompt - The system prompt that will be passed to the LLM
  • top_p - Top-P sampling probability, between 0 and 1. Defaults to 1.
  • temperature - Sampling temperature to use, between 0 and 2. Defaults to 1.
  • modality - Defines whether instructions trigger a violation if they evaluate to TRUE or FALSE.
Response Fields:
string
required
The custom policy type identifier.
string
required
The policy category, typically ‘custom’ for user-defined policies.
string
required
The default name for the policy template.
string
required
Updated description of the policy based on the new evaluation instructions.
Response JSON Example:

Delete Custom Policy

Endpoint: DELETE https://guardrails.aporia.com/api/v1/policies/custom_policy/{custom_policy_type} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
string
required
The custom policy type identifier to delete. Returned from Create Custom Policy endpoint.
Response: 200 OK

Create policies for multiple projects

Endpoint: PUT https://guardrails.aporia.com/api/v1/policies/ Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Request Fields:
list[UUID]
required
The project ids to create the policies in
list[Policies]
required
A list of policies to create. List of policies, each Policy has the following attributes: policy_type (string), priority (int), condition (dict), action (dict).