# Update member role or billing status

`PATCH /api/user/{userId}`

URL: https://repsona.com/api/patch-user-userid

Changes either role or billingStatus (not both) along the member state transition table. Owner role changes are rejected here; use the transfer-ownership flow.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `userId` | path | integer | required | ID of the user to update. |

## Request

```sh
curl -X PATCH "https://<space>.repsona.com/api/user/{userId}" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
```

## Responses

- 200: Updated member state
- 400: Transition not allowed for the current member state
- 401: Authentication is required
- 403: Admin only
- 404: User not found in this space
- 409: The member state changed concurrently

## Example response

```json
{
  "userId": 1128,
  "role": "admin",
  "billingStatus": "active"
}
```
