Skip to content

Assign or change an organization member role

patch/v2/organizations/{slug}/members/{user_id}/roles

Assigns an org-wide role when projects is omitted, or creates a project-scoped assignment when projects is provided. Uses an org-level role template id from GET /v2/organizations/{slug}/roles. Stale role assignments are automatically cleaned up: if a role no longer has any projects, it is deleted; overlapping project assignments in other roles are automatically removed to avoid duplication.

OAuth scopes

  • organizations:write

This endpoint is only available on the following plans:

  • Team
  • Enterprise

The fine-grained token must include the following permissions to access this endpoint:

  • organization_admin_write

Path parameters

  • slug
    Required
    string

    Organization slug

  • user_id
    Required
    string

Body

  • data
    Required
    object

Response codes

  • 200
  • 401
  • 402
  • 403
  • 429
  • 500

Response (200)

{
"data": {
"type": "organization_member_role",
"attributes": {
"name": "developer",
"scope": "organization",
"projects": [
{
"ref": "lorem",
"name": "lorem"
}
]
}
}
}
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Resource type.",
"enum": [
"organization_member_role"
]
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Role name. For project-scoped assignments this is the base role name.",
"example": "developer"
},
"scope": {
"type": "string",
"enum": [
"organization",
"project"
],
"description": "Whether this role applies org-wide or is scoped to specific projects for the user."
},
"projects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"ref",
"name"
]
},
"description": "Project refs this role is scoped to. Empty array for org-level roles."
}
},
"required": [
"name",
"scope",
"projects"
]
}
},
"required": [
"type",
"attributes"
]
}
},
"required": [
"data"
]
}