---
title: "POST /userprofiles/{userprofilesId}/userRoles"
method: POST
path: "/userprofiles/{userprofilesId}/userRoles"
tags: ["userRoles"]
---

# POST /userprofiles/{userprofilesId}/userRoles

`POST /userprofiles/{userprofilesId}/userRoles`

## Request

- Base URL: `https://dfareporting.googleapis.com/dfareporting/v5`
- URL: `https://dfareporting.googleapis.com/dfareporting/v5/userprofiles/{userprofilesId}/userRoles`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/dfatrafficking`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/dfatrafficking`
- TypeScript: <https://skmtc.dev/google/apis/dfareporting/docs/userprofiles/:userprofilesId/userRoles/post.ts> (a function with typed inputs; its response is checked against the schema)

Inserts a new user role.

## Path parameters

- `userprofilesId` string, required

## Request body

- UserRole: Contains properties of auser role, which is used to manage user access.
  - `accountId` string, int64: Account ID of this user role. This is a read-only field that can be left blank.
  - `defaultUserRole` boolean: Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions.
  - `id` string, int64: ID of this user role. This is a read-only, auto-generated field.
  - `kind` string: Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole".
  - `name` string: Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account.
  - `parentUserRoleId` string, int64: ID of the user role that this user role is based on or copied from. This is a required field.
  - `permissions` UserRolePermission[]: List of permissions associated with this user role.
    - `availability` 'NOT_AVAILABLE_BY_DEFAULT' | 'ACCOUNT_BY_DEFAULT' | 'SUBACCOUNT_AND_ACCOUNT_BY_DEFAULT' | 'ACCOUNT_ALWAYS' | 'SUBACCOUNT_AND_ACCOUNT_ALWAYS' | 'USER_PROFILE_ONLY': Levels of availability for a user role permission.
    - `id` string, int64: ID of this user role permission.
    - `kind` string: Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission".
    - `name` string: Name of this user role permission.
    - `permissionGroupId` string, int64: ID of the permission group that this user role permission belongs to.
  - `subaccountId` string, int64: Subaccount ID of this user role. This is a read-only field that can be left blank.

## Response `200`

Successful response

- UserRole: Contains properties of auser role, which is used to manage user access.
  - `accountId` string, int64: Account ID of this user role. This is a read-only field that can be left blank.
  - `defaultUserRole` boolean: Whether this is a default user role. Default user roles are created by the system for the account/subaccount and cannot be modified or deleted. Each default user role comes with a basic set of preassigned permissions.
  - `id` string, int64: ID of this user role. This is a read-only, auto-generated field.
  - `kind` string: Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRole".
  - `name` string: Name of this user role. This is a required field. Must be less than 256 characters long. If this user role is under a subaccount, the name must be unique among sites of the same subaccount. Otherwise, this user role is a top-level user role, and the name must be unique among top-level user roles of the same account.
  - `parentUserRoleId` string, int64: ID of the user role that this user role is based on or copied from. This is a required field.
  - `permissions` UserRolePermission[]: List of permissions associated with this user role.
    - `availability` 'NOT_AVAILABLE_BY_DEFAULT' | 'ACCOUNT_BY_DEFAULT' | 'SUBACCOUNT_AND_ACCOUNT_BY_DEFAULT' | 'ACCOUNT_ALWAYS' | 'SUBACCOUNT_AND_ACCOUNT_ALWAYS' | 'USER_PROFILE_ONLY': Levels of availability for a user role permission.
    - `id` string, int64: ID of this user role permission.
    - `kind` string: Identifies what kind of resource this is. Value: the fixed string "dfareporting#userRolePermission".
    - `name` string: Name of this user role permission.
    - `permissionGroupId` string, int64: ID of the permission group that this user role permission belongs to.
  - `subaccountId` string, int64: Subaccount ID of this user role. This is a read-only field that can be left blank.

---

[API](https://skmtc.dev/google/apis/dfareporting.md) - [All operations](https://skmtc.dev/google/apis/dfareporting/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/dfareporting/revisions/be73a9a450de?raw)
