---
title: Create a Role
slug: create-a-role
docTags: 
createdAt: 2026-04-21T15:22:49.957Z
---

{
  "id": "k9uLmnLdJGzEsmp7OICwx",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://developer.digitail.io/api/v1/roles",
    "servers": [
      {
        "url": "https://developer.digitail.io/api/v1/roles",
        "description": "Sandbox server (uses test data)"
      },
      {
        "url": "https://vet.digitail.io/api/v1/roles",
        "description": "Production server (uses live data)"
      }
    ],
    "name": "Create a Role",
    "description": "<p>Permissions needed: ACCESS_ADMINISTRATION_SETTINGS\nStore Role for a clinic</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "rolebodystore",
          "description": "<p>Role Store Request Body. Provide either clinic_id or group_id (mutually exclusive). Use group_id for enterprise group-level roles (requires enterprise admin). Use clinic_id for clinic-local roles.</p>",
          "schema": [
            {
              "name": "title",
              "kind": "optional",
              "type": "string",
              "description": "",
              "example": "Doctor"
            },
            {
              "name": "clinic_id",
              "kind": "optional",
              "type": "integer",
              "description": "<p>The clinic to create the role for. Required if group_id is not provided. Mutually exclusive with group_id.</p>",
              "example": 1
            },
            {
              "name": "group_id",
              "kind": "optional",
              "type": "integer",
              "description": "<p>The enterprise group to create the role for. Required if clinic_id is not provided. Mutually exclusive with clinic_id. Requires enterprise admin permissions.</p>",
              "example": ""
            },
            {
              "name": "permissions_ids",
              "kind": "optional",
              "type": "array",
              "description": "",
              "example": "",
              "itemType": "integer",
              "customType": "integer[]",
              "itemExample": "",
              "itemDefault": ""
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "passport",
          "name": "passport",
          "kind": "optional",
          "type": "oauth2",
          "description": "Laravel passport oauth2 security.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://digitail.test/oauth/authorize",
              "tokenUrl": "https://digitail.test/oauth/token",
              "refreshUrl": "https://digitail.test/oauth/token"
            }
          }
        },
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "integer",
            "description": "Role Id",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "zLxeqxRqOoCe66nSKG3t7",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://developer.digitail.io/api/v1/roles \\\n     --header 'accept: application/json'"
        },
        {
          "id": "dGkDM9re3TMh7Ex9nI2O_",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://developer.digitail.io/api/v1/roles\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "VXVOCcK0ze_HEojIXDMCB",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://developer.digitail.io/api/v1/roles\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "y6aUDGZWBb2dqAax4CIlY",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://developer.digitail.io/api/v1/roles\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "zLxeqxRqOoCe66nSKG3t7"
    },
    "results": {
      "languages": [
        {
          "id": "6MfJcCzUSsZfsvxMwYsqU",
          "language": "201",
          "code": "// successful operation\n0"
        }
      ],
      "selectedLanguageId": "6MfJcCzUSsZfsvxMwYsqU"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}