# updateProjectMember

```graphql
mutation UpdateProjectMember($projectReference: ID!, $userId: ID!, $input: UpdateProjectMemberInput!) {
  updateProjectMember(projectReference: $projectReference, userId: $userId, input: $input) {
    userId
    email
    name
    avatarSrc
    role
    source
    capabilities
  }
}
```

Changes a non-owner member's role to admin, editor or viewer; the owner changes only through updateProjectOwner. Requires project.members.manage.

## Arguments

| Name               | Type                      | Required | Description                                                                                                                        |
| ------------------ | ------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `projectReference` | ID!                       | Yes      | Project UUID, slug or domain.                                                                                                      |
| `userId`           | ID!                       | Yes      | User ID of an existing non-owner member.                                                                                           |
| `input`            | UpdateProjectMemberInput! | Yes      |                                                                                                                                    |
| `input.role`       | AssignableProjectRole!    | Yes      | New role. Owner promotion and changing the current owner are rejected; use updateProjectOwner. One of `admin`, `editor`, `viewer`. |

## Variables

```json
{
  "projectReference": "string",
  "userId": "string",
  "input": {
    "role": "admin"
  }
}
```

## Responses

| Status | Description                                     |
| ------ | ----------------------------------------------- |
| 200    | The ProjectMember! in data.updateProjectMember. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateProjectMember($projectReference: ID!, $userId: ID!, $input: UpdateProjectMemberInput!) {\n  updateProjectMember(projectReference: $projectReference, userId: $userId, input: $input) {\n    userId\n    email\n    name\n    avatarSrc\n    role\n    source\n    capabilities\n  }\n}",
  "variables": {
    "projectReference": "string",
    "userId": "string",
    "input": {
      "role": "admin"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateProjectMember": {
      "userId": "string",
      "email": "user@example.com",
      "name": "string",
      "avatarSrc": "string",
      "role": "owner",
      "source": "project",
      "capabilities": [
        "string"
      ]
    }
  }
}
```
