Policies

Create Policy

Create a new policy.

The policy will be created under the organization associated with the API key. Requires admin role.

POST
/policies

Request Body

application/json

name*string

Policy name

Length1 <= length <= 255
description?Description|Description

Policy description

categories?

Rule definitions (key -> description)

mode?Mode|Mode

Policy mode

Default"content_moderation"
pre_violation_threshold?Pre Violation Threshold|Pre Violation Threshold
Default0.5
pre_jb_threshold?Pre Jb Threshold|Pre Jb Threshold
Default0.3
post_violation_threshold?Post Violation Threshold|Post Violation Threshold
Default0.5
post_violation_jb_threshold?Post Violation Jb Threshold|Post Violation Jb Threshold
Default0.3
scanners_config?|Scanners Config

Response Body

application/json

application/json

curl -X POST "https://api.grayswan.ai/policies" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{
  "id": "string",
  "name": "string",
  "description": "string",
  "rules": {
    "property1": "string",
    "property2": "string"
  },
  "mode": "string",
  "pre_violation_threshold": 0,
  "pre_jb_threshold": 0,
  "post_violation_threshold": 0,
  "post_violation_jb_threshold": 0,
  "scanners_config": {},
  "is_preset": false,
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}