# Change a member's role

`PATCH /v1/orgs/{org_id}/members/{member_id}`

Requires role owner or higher.

## Authentication

A session token: `Authorization: Bearer <session token>`, or the session cookie in the browser. Requires role `owner` or higher.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `org_id` | path | string | yes |  |
| `member_id` | path | string | yes |  |

## Request body

`application/json`

```json
{
  "additionalProperties": false,
  "properties": {
    "role": {
      "anyOf": [
        {
          "enum": [
            "owner"
          ],
          "type": "string"
        },
        {
          "enum": [
            "admin"
          ],
          "type": "string"
        },
        {
          "enum": [
            "member"
          ],
          "type": "string"
        }
      ]
    }
  },
  "required": [
    "role"
  ],
  "type": "object"
}
```

## Responses

### 200

A member of an organization.

`application/json`

```json
{
  "additionalProperties": false,
  "description": "A member of an organization.",
  "properties": {
    "created_at": {
      "format": "date-time",
      "type": "string"
    },
    "deactivated": {
      "type": "boolean"
    },
    "email": {
      "type": "string"
    },
    "id": {
      "pattern": "^mem_[0-7][0-9a-hjkmnp-tv-z]{25}$",
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "role": {
      "anyOf": [
        {
          "enum": [
            "owner"
          ],
          "type": "string"
        },
        {
          "enum": [
            "admin"
          ],
          "type": "string"
        },
        {
          "enum": [
            "member"
          ],
          "type": "string"
        }
      ]
    },
    "user_id": {
      "pattern": "^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$",
      "type": "string"
    }
  },
  "required": [
    "id",
    "user_id",
    "email",
    "name",
    "role",
    "deactivated",
    "created_at"
  ],
  "type": "object"
}
```

### 401

unauthorized: no valid session, or the email is not verified.

Problem type: [unauthorized](https://docs.dlogify.com/errors/unauthorized.md).

### 403

csrf-origin-rejected: a cookie-authenticated change from an origin outside the web app. forbidden: the action requires the owner role.

Problem type: [csrf-origin-rejected](https://docs.dlogify.com/errors/csrf-origin-rejected.md).

### 404

not-found: the resource does not exist, or the caller is not a member of its organization.

Problem type: [not-found](https://docs.dlogify.com/errors/not-found.md).

### 409

conflict: an organization must keep at least one owner.

Problem type: [conflict](https://docs.dlogify.com/errors/conflict.md).

### 422

validation-failed: the request does not match the schema.

Problem type: [validation-failed](https://docs.dlogify.com/errors/validation-failed.md).

### 429

rate-limited: per-user management request limit.

Problem type: [rate-limited](https://docs.dlogify.com/errors/rate-limited.md).

## Example

```bash
curl -X PATCH "https://api.dlogify.com/v1/orgs/{org_id}/members/{member_id}" \
  -H "Authorization: Bearer $DLOGIFY_SESSION" \
  -H "Content-Type: application/json" \
  --data-binary @body
```

Source: https://docs.dlogify.com/api/members/changeMemberRole
