---
updatedAt: 2026-06-08T03:35:06.000Z
agentTools:
  projectIndex: https://developer.moloco.cloud/llms.txt
---

# Grant the role to the user

Grant the Role to the user.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Moloco Ads Campaign Management API",
    "description": "Moloco Ads Campaign Management API provides functionalities for Moloco Ads Campaigns.",
    "version": "1.10",
    "contact": {
      "name": "Moloco Inc.",
      "url": "https://www.moloco.com"
    }
  },
  "paths": {
    "/cm/v1/auth/roles/grant": {
      "post": {
        "summary": "Grant the role to the user",
        "description": "Grant the Role to the user.",
        "operationId": "DspApi_GrantRole",
        "responses": {
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/messagesGrantRoleResponse"
                }
              }
            }
          },
          "default": {
            "description": "Error. Detailed cause can be found in the `details` field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/messagesGrantRoleError"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/messagesGrantRoleRequest"
              }
            }
          },
          "required": true
        },
        "tags": [
          "Role"
        ]
      }
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ],
  "servers": [
    {
      "url": "https://api.moloco.cloud"
    }
  ],
  "components": {
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    },
    "schemas": {
      "dspRole": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/dspRoleType",
            "description": "The role types users can have."
          },
          "workplace_id": {
            "type": "string",
            "description": "The workplace bound to the role."
          },
          "ad_account_id": {
            "type": "string",
            "description": "The ad account id bound to role."
          },
          "exchange_id": {
            "type": "string",
            "description": "The exchange id bound to role."
          }
        },
        "description": "Role that user can have.\nRole is bound to resource."
      },
      "dspRoleType": {
        "type": "string",
        "enum": [
          "WORKPLACE_OWNER",
          "AD_ACCOUNT_OWNER",
          "AD_ACCOUNT_MEMBER",
          "AD_ACCOUNT_VIEWER"
        ],
        "default": "UNKNOWN_TYPE",
        "description": " - WORKPLACE_OWNER: Workplace owner represents a user who can do anything in a given workplace.\n - AD_ACCOUNT_OWNER: Ad account owner represents a user who can do anything in a given ad account.\n - AD_ACCOUNT_MEMBER: Ad account member can view all users of the Ad Account.\nCan invite new users as Ad Account Member or Ad Account Viewer\nCan edit your own information (ex: name)\nCan create and edit ad campaigns\n - AD_ACCOUNT_VIEWER: Ad account Viewer role offers a limited set of permissions that allows users\nonly to read the basic information of the resources."
      },
      "messagesGrantRoleError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "#/components/schemas/messagesGrantRoleErrorAPIErrorInfo"
            }
          }
        }
      },
      "messagesGrantRoleErrorAPIErrorInfo": {
        "type": "object",
        "properties": {
          "reason": {
            "$ref": "#/components/schemas/messagesGrantRoleErrorAPIErrorInfoErrorReason"
          },
          "error_log_id": {
            "type": "string"
          },
          "context": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "messagesGrantRoleErrorAPIErrorInfoErrorReason": {
        "type": "string",
        "enum": [
          "ERROR_REASON_UNKNOWN",
          "USER_DOES_NOT_HAVE_REQUIRED_ROLE",
          "USER_NOT_REGISTERED_TO_WORKPLACE",
          "USER_ALREADY_HAS_ROLE"
        ],
        "default": "ERROR_REASON_UNKNOWN",
        "description": " - USER_DOES_NOT_HAVE_REQUIRED_ROLE: The user doesn't have role to invite other user.\n - USER_NOT_REGISTERED_TO_WORKPLACE: The user is not registered to workplace.\n - USER_ALREADY_HAS_ROLE: The user has already role bound to the resource."
      },
      "messagesGrantRoleRequest": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "string",
            "description": "The user ID."
          },
          "role": {
            "$ref": "#/components/schemas/dspRole",
            "description": "The role which will be granted to user."
          }
        },
        "required": [
          "user_id",
          "role"
        ]
      },
      "messagesGrantRoleResponse": {
        "type": "object"
      }
    }
  }
}
```