# メンバーの役割・課金状態の変更

`PATCH /api/user/{userId}`

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

役割 (role) か課金状態 (billingStatus) のどちらか一方を変更します。オーナーへの変更はできないため、オーナーの移譲は専用の手順で行ってください。

## パラメーター

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `userId` | path | integer | 必須 | 変更するユーザーの ID です。 |

## リクエスト

```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"
  }'
```

## レスポンス

- 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

## レスポンスの例

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