The parent parameter's value depends on the target resource for the request, namely projects or organizations. Each resource type's parent value format is described below:
projects.roles.create: projects/{PROJECT_ID}. This method creates project-level custom roles. Example request URL: https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles
organizations.roles.create: organizations/{ORGANIZATION_ID}. This method creates organization-level custom 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 following IAM permission on the specified resource parent:
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 custom roles within either a project or an organization, using the \u003ccode\u003ePOST\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe URL structure follows gRPC Transcoding syntax and requires either a project ID or an organization ID, specified in the \u003ccode\u003eparent\u003c/code\u003e path parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must include a \u003ccode\u003eroleId\u003c/code\u003e (a string of 3-64 alphanumeric characters, underscores, or periods) and a \u003ccode\u003erole\u003c/code\u003e object detailing the custom role to create.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests will return a JSON representation of the newly created custom \u003ccode\u003eRole\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization for this action requires the \u003ccode\u003eiam.roles.create\u003c/code\u003e permission on the specified \u003ccode\u003eparent\u003c/code\u003e resource and one of two specific OAuth scopes.\u003c/p\u003e\n"]]],[],null,["# Method: projects.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=projects/*}/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)."]]