Theparentparameter's value depends on the target resource for the request, namelyprojectsororganizations. Each resource type'sparentvalue format is described below:
projects.roles.create:projects/{PROJECT_ID}. This method creates project-levelcustom roles. Example request URL:https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles
organizations.roles.create:organizations/{ORGANIZATION_ID}. This method creates organization-levelcustom roles. Example request URL:https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles
Note: Wildcard (*) values are invalid; you must specify a complete project ID or organization ID.
Authorization requires the followingIAMpermission on the specified resourceparent:
iam.roles.create
Request body
The request body contains data with the following structure:
A role ID may contain alphanumeric characters, underscores (_), and periods (.). It must contain a minimum of 3 characters and a maximum of 64 characters.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-21 UTC."],[[["\u003cp\u003eThis endpoint facilitates the creation of a new custom Role, either at the project or organization level, via a \u003ccode\u003ePOST\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eparent\u003c/code\u003e path parameter in the request URL determines whether the Role is created at the project or organization level, with specific formats required for each type (\u003ccode\u003eprojects/{PROJECT_ID}\u003c/code\u003e or \u003ccode\u003eorganizations/{ORGANIZATION_ID}\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe request body requires a \u003ccode\u003eroleId\u003c/code\u003e string (3-64 characters in length, alphanumeric, underscores, and periods) and a \u003ccode\u003erole\u003c/code\u003e object that defines the specifications of the new role being created.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful creation, the response will contain the full details of the newly created \u003ccode\u003eRole\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires either the \u003ccode\u003ehttps://www.googleapis.com/auth/iam\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e OAuth scope and \u003ccode\u003eiam.roles.create\u003c/code\u003e permission.\u003c/p\u003e\n"]]],[],null,["# Method: organizations.roles.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Examples](#examples)\n- [Try it!](#try-it)\n\nCreates a new custom [Role](/iam/docs/reference/rest/v1/organizations.roles#Role).\n\n### HTTP request\n\n`POST https://iam.googleapis.com/v1/{parent=organizations/*}/roles`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Role](/iam/docs/reference/rest/v1/organizations.roles#Role).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/iam`\n- `\n https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]