Get All Projects
Endpoint: GEThttps://guardrails.aporia.com/api/v1/projects
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
list
. each object in the list contains the following fields:
The project ID.
The project name.
The project description.
The project icon, possible values are
codepen
, chatBubbleLeftRight
, serverStack
, academicCap
, bookOpen
, commandLine
, creditCard
, rocketLaunch
, envelope
, identification
.The project color, possible values are
turquoiseBlue
, mustard
, cornflowerBlue
, heliotrope
, spray
, peachOrange
, shocking
, white
, manz
, geraldine
.The organization ID.
Boolean indicating whether the project is active or not.
List of policies, each Policy has the following attributes:
id
(uuid), policy_type
(string), name
(string), enabled
(bool), condition
(dict), action
(dict).List of extractions defined for the project. Each extraction contains the following fields:
descriptor_type
: Eitherdefault
orcustom
. 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. Fordefault
extractions, the supported descriptors arequestion
,context
, andanswer
.extraction_target
- Eitherprompt
orresponse
, based on where data should be extracted from (prompt or response, respectively)extraction
- Extraction method, can be eitherRegexExtraction
orJSONPathExtraction
.
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: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: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.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.Maximum runtime for policies on prompt in milliseconds.
Maximum runtime for policies on response in milliseconds.
Project integration status, possible values are:
pending
, failed
, success
.The size of the project, possible values are
0
, 1
, 2
, 3
. defaults to 0
.Get Project by ID
Endpoint: GEThttps://guardrails.aporia.com/api/v1/projects/{project_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project to retrieve.
The project ID.
The project name.
The project description.
The project icon, possible values are
codepen
, chatBubbleLeftRight
, serverStack
, academicCap
, bookOpen
, commandLine
, creditCard
, rocketLaunch
, envelope
, identification
.The project color, possible values are
turquoiseBlue
, mustard
, cornflowerBlue
, heliotrope
, spray
, peachOrange
, shocking
, white
, manz
, geraldine
.The organization ID.
Boolean indicating whether the project is active or not.
List of partial policies. Each PartialPolicy has the following attributes:
id
(uuid), policy_type
(string), name
(string), enabled
(bool), condition
(dict), action
(dict).List of extractions defined for the project.see full explanation about
project_extractions
in Get All Projects
endpoint.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.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.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.Maximum runtime for policies on prompt in milliseconds.
Maximum runtime for policies on response in milliseconds.
Project integration status, possible values are:
pending
, failed
, success
.The size of the project, possible values are
0
, 1
, 2
, 3
. defaults to 0
.Create Project
Endpoint: POSThttps://guardrails.aporia.com/api/v1/projects
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The name of the project.
The description of the project.
Maximum runtime for policies on prompt in milliseconds.
Maximum runtime for policies on response in milliseconds.
Icon of the project, with possible values:
codepen
, chatBubbleLeftRight
, serverStack
, academicCap
, bookOpen
, commandLine
, creditCard
, rocketLaunch
, envelope
, identification
.Color of the project, with possible values:
turquoiseBlue
, mustard
, cornflowerBlue
, heliotrope
, spray
, peachOrange
, shocking
, white
, manz
, geraldine
.List of extractions to define for the project.see full explanation about
project_extractions
in Get All Projects
endpoint.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 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 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.Boolean indicating whether the project is active, defaults to
true
.The size of the project, possible values are
0
, 1
, 2
, 3
. defaults to 0
.Get Project by ID
endpoint.
Update Project
Endpoint: PUThttps://guardrails.aporia.com/api/v1/projects/{project_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project to update.
The name of the project.
The description of the project.
Maximum runtime for policies on prompt in milliseconds.
Maximum runtime for policies on response in milliseconds.
Icon of the project, with possible values like
codepen
, chatBubbleLeftRight
, etc.Color of the project, with possible values like
turquoiseBlue
, mustard
, etc.List of extractions to define for the project.see full explanation about
project_extractions
in Get All Projects
endpoint.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 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 method for answer, defaults to
RegexExtraction
with a predefined regex.see full explanation about RegexExtraction
in context_extraction
field in Get All Projects
endpoint.Boolean indicating whether the project is active.
The size of the project, possible values are
0
, 1
, 2
, 3
. defaults to 0
.Boolean indicating whether to allow project resizing (in case we downgrade a project which surpassed the max tokens for the new project size)
Boolean indicating whether to remove the scheduled size from the project
Al list of policy ids to keep, in case we downgrade the project.
Get Project by ID
endpoint.
Delete Project
Endpoint: DELETEhttps://guardrails.aporia.com/api/v1/projects/{project_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project to delete.
Get Project by ID
endpoint.
Get All Policies of a Project
Endpoint: GEThttps://guardrails.aporia.com/api/v1/projects/{project_id}/policies
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project whose policies you want to retrieve.
list
. each object in the list contains the following fields:
The unique identifier of the policy.
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.Boolean indicating whether the policy is currently enabled.
Conditions under which the policy is triggered. The condition changes per policy.
Type of the policy, defining its nature and behavior.
The order of priority of this policy among others within the same project. There must be no duplicates.
Get Policy by ID
Endpoint: GEThttps://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project from which to retrieve a specific policy.
The ID of the policy to retrieve.
The unique identifier of the policy.
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.Boolean indicating whether the policy is currently enabled.
Conditions under which the policy is triggered. The condition changes per policy.
Type of the policy, defining its nature and behavior.
The order of priority of this policy among others within the same project. There must be no duplicates.
Create Policies
Endpoint: POSThttps://guardrails.aporia.com/api/v1/projects/{project_id}/policies
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project within which the policy will be created.
list
. each object in the list contains the following fields:
The type of policy, which defines its behavior and the template it follows.
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.The conditions under which the policy will trigger its action. defauls to
{}
. The condition changes per policy.The priority of the policy within the project, affecting the order in which it is evaluated against others. There must be no duplicates.
Update Policy
Endpoint: PUThttps://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project within which the policy will be updated.
The ID of the policy to be updated.
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.Defines the conditions under which the policy will trigger its action. The condition changes per policy.
Indicates whether the policy should be active.
The priority of the policy within the project, affecting the order in which it is evaluated against other policies. There must be no duplicates.
Delete Policy
Endpoint: DELETEhttps://guardrails.aporia.com/api/v1/projects/{project_id}/policies/{policy_id}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The ID of the project from which a policy will be deleted.
The ID of the policy to be deleted.
The unique identifier of the policy.
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.Indicates whether the policy was enabled at the time of deletion.
The conditions under which the policy triggered its action.
The type of the policy, defining its nature and behavior.
The priority this policy held within the project, affecting the order in which it was evaluated against other policies. There must be no duplicates.