> ## Documentation Index
> Fetch the complete documentation index at: https://docs.urban-things.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Team Member Role

## Overview

Update a team member's role within a tenant. This allows you to promote members to admins or demote admins to members.

## Authorization

* User must be authenticated with a valid Bearer token
* User must have ADMIN role in the specified tenant

## Validation Rules

* `role`: Required, must be either "ADMIN" or "MEMBER"

## Example Usage

```bash theme={null}
curl -X POST \
  https://faisalshop.mvp-apps.ae/api/v2/admin/team-members/1/5 \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "role": "ADMIN"
  }'
```

```javascript theme={null}
await axios.post(
  `/api/v2/admin/team-members/${tenantId}/${userId}`,
  { role: 'ADMIN' },
  {
    headers: { Authorization: `Bearer ${token}` }
  }
);
```

## Error Responses

### User Not Found (404)

```json theme={null}
{
  "error": "User not found"
}
```

### Not a Member (400)

```json theme={null}
{
  "error": "User is not a member of this Organization"
}
```

### Validation Error (422)

```json theme={null}
{
  "message": "The role field is required.",
  "errors": {
    "role": ["The role field is required."]
  }
}
```


## OpenAPI

````yaml POST /api/v2/admin/team-members/{tenantId}/{userId}
openapi: 3.1.0
info:
  title: Urban Things API
  description: Multi-tenant e-commerce platform API
  version: 2.0.0
  contact:
    email: info@faisalkc.com
servers:
  - url: https://faisalshop.mvp-apps.ae
    description: Production server
  - url: http://localhost:3000
    description: Development server
security:
  - bearerAuth: []
paths:
  /api/v2/admin/team-members/{tenantId}/{userId}:
    post:
      tags:
        - Team Members
      summary: Update team member role
      parameters:
        - $ref: '#/components/parameters/TenantIdPath'
        - name: userId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - role
              properties:
                role:
                  type: string
                  enum:
                    - ADMIN
                    - MEMBER
      responses:
        '200':
          description: Role updated
components:
  parameters:
    TenantIdPath:
      name: tenantId
      in: path
      required: true
      schema:
        type: integer
      description: Tenant ID
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````