Skip to main content

Get All Projects

Endpoint: GET https://guardrails.aporia.com/api/v1/projects 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:
uuid
required
The project ID.
string
required
The project name.
string
The project description.
string
The project icon, possible values are codepen, chatBubbleLeftRight, serverStack, academicCap, bookOpen, commandLine, creditCard, rocketLaunch, envelope, identification.
string
The project color, possible values are turquoiseBlue, mustard, cornflowerBlue, heliotrope, spray, peachOrange, shocking, white, manz, geraldine.
uuid
required
The organization ID.
bool
required
Boolean indicating whether the project is active or not.
list[Policy]
required
List of policies, each Policy has the following attributes: id (uuid), policy_type (string), name (string), enabled (bool), condition (dict), action (dict).
list[ExtractionProperties]
required
List of extractions defined for the project. Each extraction contains the following fields:
  • descriptor_type: Either default or custom. Default extractions are supported by all Aporia policies, and it is recommended to define them for optimal results. Custom extractions are user-defined and are more versatile, but not all policies can utilize them.
  • descriptor - A descriptor of what exactly is extracted by the extraction. For default extractions, the supported descriptors are question, context, and answer.
  • extraction_target - Either prompt or response, based on where data should be extracted from (prompt or response, respectively)
  • extraction - Extraction method, can be either RegexExtraction or JSONPathExtraction.
RegexExtraction is an object containing type (string equal to regex) and regex (string containing the regex expression to extract with). for example:
JSONPathExtraction is an object containing type (string equal to jsonpath) and path (string specifies the JSONPath expression used to navigate and extract specific data from a JSON document). for example:
Object
deprecated
Extraction method for context, can be either RegexExtraction or JSONPathExtraction.RegexExtraction is an object containing type (string equal to regex) and regex (string containing the regex expression to extract with). for example:
JSONPathExtraction is an object containing type (string equal to jsonpath) and path (string specifies the JSONPath expression used to navigate and extract specific data from a JSON document). for example:
Object
deprecated
Extraction method for question, can be either RegexExtraction or JSONPathExtraction.see full explanation about RegexExtraction and JSONPathExtraction in context_extraction field in Get All Projects endpoint.
Object
deprecated
Extraction method for answer, can be either RegexExtraction or JSONPathExtraction.see full explanation about RegexExtraction and JSONPathExtraction in context_extraction field in Get All Projects endpoint.
int
Maximum runtime for policies on prompt in milliseconds.
int
Maximum runtime for policies on response in milliseconds.
string
required
Project integration status, possible values are: pending, failed, success.
int
required
The size of the project, possible values are 0, 1, 2, 3. defaults to 0.
Response JSON Example:

Get Project by ID

Endpoint: GET https://guardrails.aporia.com/api/v1/projects/{project_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project to retrieve.
Response Fields:
uuid
required
The project ID.
string
required
The project name.
string
The project description.
string
The project icon, possible values are codepen, chatBubbleLeftRight, serverStack, academicCap, bookOpen, commandLine, creditCard, rocketLaunch, envelope, identification.
string
The project color, possible values are turquoiseBlue, mustard, cornflowerBlue, heliotrope, spray, peachOrange, shocking, white, manz, geraldine.
uuid
required
The organization ID.
bool
required
Boolean indicating whether the project is active or not.
list[PartialPolicy]
required
List of partial policies. Each PartialPolicy has the following attributes: id (uuid), policy_type (string), name (string), enabled (bool), condition (dict), action (dict).
list[ExtractionProperties]
required
List of extractions defined for the project.see full explanation about project_extractions in Get All Projects endpoint.
Object
deprecated
Extraction method for context, can be either RegexExtraction or JSONPathExtraction.see full explanation about RegexExtraction and JSONPathExtraction in context_extraction field in Get All Projects endpoint.
Object
deprecated
Extraction method for question, can be either RegexExtraction or JSONPathExtraction.see full explanation about RegexExtraction and JSONPathExtraction in context_extraction field in Get All Projects endpoint.
Object
deprecated
Extraction method for answer, can be either RegexExtraction or JSONPathExtraction.see full explanation about RegexExtraction and JSONPathExtraction in context_extraction field in Get All Projects endpoint.
int
Maximum runtime for policies on prompt in milliseconds.
int
Maximum runtime for policies on response in milliseconds.
string
required
Project integration status, possible values are: pending, failed, success.
int
required
The size of the project, possible values are 0, 1, 2, 3. defaults to 0.
Response JSON Example:

Create Project

Endpoint: POST https://guardrails.aporia.com/api/v1/projects Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Request Fields:
string
required
The name of the project.
string
The description of the project.
int
Maximum runtime for policies on prompt in milliseconds.
int
Maximum runtime for policies on response in milliseconds.
ProjectIcon
Icon of the project, with possible values: codepen, chatBubbleLeftRight, serverStack, academicCap, bookOpen, commandLine, creditCard, rocketLaunch, envelope, identification.
ProjectColor
Color of the project, with possible values: turquoiseBlue, mustard, cornflowerBlue, heliotrope, spray, peachOrange, shocking, white, manz, geraldine.
list[ExtractionProperties]
required
List of extractions to define for the project.see full explanation about project_extractions in Get All Projects endpoint.
Extraction
deprecated
Extraction method for context, defaults to RegexExtraction with a predefined regex: <context>(.+)</context>.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
Extraction
deprecated
Extraction method for question, defaults to RegexExtraction with a predefined regex: <question>(.+)</question>.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
Extraction
deprecated
Extraction method for answer, defaults to RegexExtraction with a predefined regex: <answer>(.+)</answer>.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
bool
required
Boolean indicating whether the project is active, defaults to true.
int
required
The size of the project, possible values are 0, 1, 2, 3. defaults to 0.
Request JSON Example:
Response Fields: The response fields will mirror those specified in the ProjectRead object, as described in the previous documentation for retrieving a project. Response JSON Example: The response json example will be identical to the one in the Get Project by ID endpoint.

Update Project

Endpoint: PUT https://guardrails.aporia.com/api/v1/projects/{project_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project to update.
Request Fields:
string
The name of the project.
string
The description of the project.
int
Maximum runtime for policies on prompt in milliseconds.
int
Maximum runtime for policies on response in milliseconds.
ProjectIcon
Icon of the project, with possible values like codepen, chatBubbleLeftRight, etc.
ProjectColor
Color of the project, with possible values like turquoiseBlue, mustard, etc.
list[ExtractionProperties]
List of extractions to define for the project.see full explanation about project_extractions in Get All Projects endpoint.
Extraction
deprecated
Extraction method for context, defaults to RegexExtraction with a predefined regex.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
Extraction
deprecated
Extraction method for question, defaults to RegexExtraction with a predefined regex.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
Extraction
deprecated
Extraction method for answer, defaults to RegexExtraction with a predefined regex.see full explanation about RegexExtraction in context_extraction field in Get All Projects endpoint.
bool
Boolean indicating whether the project is active.
int
required
The size of the project, possible values are 0, 1, 2, 3. defaults to 0.
bool
Boolean indicating whether to allow project resizing (in case we downgrade a project which surpassed the max tokens for the new project size)
bool
Boolean indicating whether to remove the scheduled size from the project
list[str]
Al list of policy ids to keep, in case we downgrade the project.
Request JSON Example:
Response Fields: The response fields will mirror those specified in the ProjectRead object, as previously documented. Response JSON Example: The response json example will be identical to the one in the Get Project by ID endpoint.

Delete Project

Endpoint: DELETE https://guardrails.aporia.com/api/v1/projects/{project_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project to delete.
Response Fields: The response fields will mirror those specified in the ProjectRead object, as previously documented. Response JSON Example: The response json example will be identical to the one in the Get Project by ID endpoint.

Get All Policies of a Project

Endpoint: GET https://guardrails.aporia.com/api/v1/projects/{project_id}/policies Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project whose policies you want to retrieve.
Response Fields: The response type is a list. each object in the list contains the following fields:
str
required
The unique identifier of the policy.
ActionConfig
required
Configuration details of the action to be taken by this policy.ActionConfig is an object containing type field, with possible values of: modify, rephrase, block, passthrough.For modify action, extra fields will be prefix and suffix, both optional strings. The value in prefix will be added in the beginning of the response, and the value of suffix will be added in the end of the response.For rephrase action, extra fields will be prompt (required) and llm_model_to_use (optional). prompt is a string that will be used as an addition to the question being sent to the llm. llm_model_to_use is a string representing the llm model that will be used. default value is gpt3.5_1106.For block action, extra field will be response, which is a required string. This response will replace the original response from the llm.For passthrough action, there will be no extra fields.
bool
required
Boolean indicating whether the policy is currently enabled.
dict
required
Conditions under which the policy is triggered. The condition changes per policy.
str
required
Type of the policy, defining its nature and behavior.
int
required
The order of priority of this policy among others within the same project. There must be no duplicates.
Response JSON Example:

Get Policy by ID

Endpoint: GET https://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project from which to retrieve a specific policy.
uuid
The ID of the policy to retrieve.
Response Fields:
str
required
The unique identifier of the policy.
ActionConfig
required
Configuration details of the action to be taken by this policy.ActionConfig is an object containing type field, with possible values of: modify, rephrase, block, passthrough.For modify action, extra fields will be prefix and suffix, both optional strings. The value in prefix will be added in the beginning of the response, and the value of suffix will be added in the end of the response.For rephrase action, extra fields will be prompt (required) and llm_model_to_use (optional). prompt is a string that will be used as an addition to the question being sent to the llm. llm_model_to_use is a string representing the llm model that will be used. default value is gpt3.5_1106.For block action, extra field will be response, which is a required string. This response will replace the original response from the llm.For passthrough action, there will be no extra fields.
bool
required
Boolean indicating whether the policy is currently enabled.
dict
required
Conditions under which the policy is triggered. The condition changes per policy.
str
required
Type of the policy, defining its nature and behavior.
int
required
The order of priority of this policy among others within the same project. There must be no duplicates.
Response JSON Example:

Create Policies

Endpoint: POST https://guardrails.aporia.com/api/v1/projects/{project_id}/policies Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project within which the policy will be created.
Request Fields: The reuqest field is a list. each object in the list contains the following fields:
string
required
The type of policy, which defines its behavior and the template it follows.
ActionConfig
required
The action that the policy enforces when its conditions are met.ActionConfig is an object containing type field, with possible values of: modify, rephrase, block, passthrough.For modify action, extra fields will be prefix and suffix, both optional strings. The value in prefix will be added in the beginning of the response, and the value of suffix will be added in the end of the response.For rephrase action, extra fields will be prompt (required) and llm_model_to_use (optional). prompt is a string that will be used as an addition to the question being sent to the llm. llm_model_to_use is a string representing the llm model that will be used. default value is gpt3.5_1106.For block action, extra field will be response, which is a required string. This response will replace the original response from the llm.For passthrough action, there will be no extra fields.
dict
The conditions under which the policy will trigger its action. defauls to {}. The condition changes per policy.
int
The priority of the policy within the project, affecting the order in which it is evaluated against others. There must be no duplicates.
Request JSON Example:
Response Fields: The response fields will mirror those specified in the PolicyRead object, with additional details specific to the newly created policy. Response JSON Example:

Update Policy

Endpoint: PUT https://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project within which the policy will be updated.
uuid
The ID of the policy to be updated.
Request Fields:
ActionConfig
Specifies the action that the policy enforces when its conditions are met.ActionConfig is an object containing type field, with possible values of: modify, rephrase, block, passthrough.For modify action, extra fields will be prefix and suffix, both optional strings. The value in prefix will be added in the beginning of the response, and the value of suffix will be added in the end of the response.For rephrase action, extra fields will be prompt (required) and llm_model_to_use (optional). prompt is a string that will be used as an addition to the question being sent to the llm. llm_model_to_use is a string representing the llm model that will be used. default value is gpt3.5_1106.For block action, extra field will be response, which is a required string. This response will replace the original response from the llm.For passthrough action, there will be no extra fields.
dict
Defines the conditions under which the policy will trigger its action. The condition changes per policy.
bool
Indicates whether the policy should be active.
int
The priority of the policy within the project, affecting the order in which it is evaluated against other policies. There must be no duplicates.
Request JSON Example:
Response Fields: The response fields will mirror those specified in the PolicyRead object, updated to reflect the changes made to the policy. Response JSON Example:

Delete Policy

Endpoint: DELETE https://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id} Headers:
  • Content-Type: application/json
  • Authorization: Bearer + Your copied Aporia API key
Path Parameters:
uuid
The ID of the project from which a policy will be deleted.
uuid
The ID of the policy to be deleted.
Response Fields:
str
required
The unique identifier of the policy.
ActionConfig
required
Configuration details of the action that was enforced by this policy.ActionConfig is an object containing type field, with possible values of: modify, rephrase, block, passthrough.For modify action, extra fields will be prefix and suffix, both optional strings. The value in prefix will be added in the beginning of the response, and the value of suffix will be added in the end of the response.For rephrase action, extra fields will be prompt (required) and llm_model_to_use (optional). prompt is a string that will be used as an addition to the question being sent to the llm. llm_model_to_use is a string representing the llm model that will be used. default value is gpt3.5_1106.For block action, extra field will be response, which is a required string. This response will replace the original response from the llm.For passthrough action, there will be no extra fields.
bool
required
Indicates whether the policy was enabled at the time of deletion.
dict
required
The conditions under which the policy triggered its action.
str
required
The type of the policy, defining its nature and behavior.
int
required
The priority this policy held within the project, affecting the order in which it was evaluated against other policies. There must be no duplicates.
Response JSON Example: