---
title: Save Policy Group
slug: single-connect-api-3-0-3/save-policy-group
description: Learn how to save a policy key group effortlessly with this comprehensive document. Featuring a detailed example of a curl code, including specific headers and data, this guide will help you efficiently utilize REST API to streamline your policy key group
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "Vsc1J_CQQuoFGxkLjOHYU",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/policy/savePolicyKeyGroup",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": " {\r\n        \"dbId\": 19934,\r\n        \"name\": \"pg_ex\",\r\n        \"description\": \"p_api\",\r\n        \"httpPolicies\": [],\r\n        \"maskingPolicies\": [],\r\n        \"timeRestrictions\": [],\r\n        \"sendEmail\": false,\r\n        \"sendSnmp\": false,\r\n        \"action\": \"GENERATE_ERROR\",\r\n        \"confirmationText\": null,\r\n        \"operationMode\": \"OPERATION\",\r\n        \"userCreate\": null\r\n    }",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Create Policy Group",
        "jsonExample": "{\n    \"dbId\": 406596,\n    \"name\": \"pg_ex\",\n    \"description\": \"p_api\",\n    \"policies\": [],\n    \"policyKeys\": [],\n    \"httpPolicies\": [],\n    \"maskingPolicies\": [],\n    \"timeRestrictions\": [],\n    \"realms\": null,\n    \"sendEmail\": false,\n    \"sendSnmp\": false,\n    \"action\": \"GENERATE_ERROR\",\n    \"confirmationText\": null,\n    \"operationMode\": \"OPERATION\",\n    \"userCreate\": null,\n    \"userUpdate\": null,\n    \"creationDate\": null,\n    \"lastUpdate\": null\n}"
      }
    ],
    "contentType": "application/json",
    "description": "This method creates a new policy group as a response if the related featues of the new policy group is sent in request body.",
    "examples": {
      "languages": [
        {
          "id": "9z53bSJ0WLzfqLJyHx102",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/policy/savePolicyKeyGroup \\\n     --header 'accept: application/json'"
        },
        {
          "id": "SckxusqWn2PTFY2v8UxwD",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/policy/savePolicyKeyGroup\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "z2iOWovQctBEaQOPbsbiM",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/policy/savePolicyKeyGroup\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ja9rrhLglkqCBO70LD23Z",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/policy/savePolicyKeyGroup\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "9z53bSJ0WLzfqLJyHx102"
    },
    "results": {
      "languages": [
        {
          "id": "qXQw8J23x1uJo1wI7wqSg",
          "language": "200",
          "code": "{\n    \"dbId\": 406596,\n    \"name\": \"pg_ex\",\n    \"description\": \"p_api\",\n    \"policies\": [],\n    \"policyKeys\": [],\n    \"httpPolicies\": [],\n    \"maskingPolicies\": [],\n    \"timeRestrictions\": [],\n    \"realms\": null,\n    \"sendEmail\": false,\n    \"sendSnmp\": false,\n    \"action\": \"GENERATE_ERROR\",\n    \"confirmationText\": null,\n    \"operationMode\": \"OPERATION\",\n    \"userCreate\": null,\n    \"userUpdate\": null,\n    \"creationDate\": null,\n    \"lastUpdate\": null\n}"
        }
      ],
      "selectedLanguageId": "qXQw8J23x1uJo1wI7wqSg"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}