Skip to main content
PATCH
https://api-dev.weir.ai/
/
org
/
team
/
:teamId
/
member
/
:memberId
curl -X PATCH 'https://api.weir.ai/org/team/team_123456789/member/user_987654321' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "role": "Team_Lead"
  }'
{
  "data": {
    "userId": "user_987654321",
    "teamId": "team_123456789",
    "role": "Team_Lead",
    "updatedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Member role updated successfully",
  "status": "success"
}

Update Team Member Role

Update the role of an existing team member to change their permissions and responsibilities.
curl -X PATCH 'https://api.weir.ai/org/team/team_123456789/member/user_987654321' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "role": "Team_Lead"
  }'
{
  "data": {
    "userId": "user_987654321",
    "teamId": "team_123456789",
    "role": "Team_Lead",
    "updatedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Member role updated successfully",
  "status": "success"
}

Authentication

Requires Console API authentication with bearer token and x-source: console header.

Path Parameters

teamId
string
required
Unique identifier of the team.
memberId
string
required
Unique identifier of the member whose role is being updated.

Request Body

role
string
required
New role to assign to the member. Must be one of: “Organization_Admin”, “Organization_User”, “Team_Lead”, “Team_Member”.

Response Fields

data
object
required
Updated member data object.

Usage Examples

const updateMemberRole = async (teamId, memberId, newRole, accessToken) => {
  try {
    const response = await fetch(
      `https://api.weir.ai/org/team/${teamId}/member/${memberId}`,
      {
        method: 'PATCH',
        headers: {
          'Authorization': `Bearer ${accessToken}`,
          'Content-Type': 'application/json',
          'x-source': 'console'
        },
        body: JSON.stringify({ role: newRole })
      }
    );
    
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    
    const data = await response.json();
    return data.data;
  } catch (error) {
    console.error('Update member role error:', error);
    throw error;
  }
};

// Usage
const updatedMember = await updateMemberRole(
  'team_123456789',
  'user_987654321',
  'Team_Lead',
  'your_access_token'
);
console.log('Role updated to:', updatedMember.role);
Pro Tip: Implement proper authorization checks to ensure only team leads and organization admins can update member roles.