# updateProjectOwner

```graphql
mutation UpdateProjectOwner($projectReference: ID!, $input: UpdateProjectOwnerInput!) {
  updateProjectOwner(projectReference: $projectReference, input: $input) {
    userId
    email
    name
    avatarSrc
    role
    source
    capabilities
  }
}
```

Assigns an existing project member as owner when called by the current project owner or an account administrator, and demotes the previous owner to admin. Requires project.members.manage.

## Arguments

| Name               | Type                     | Required | Description                                                                                              |
| ------------------ | ------------------------ | -------- | -------------------------------------------------------------------------------------------------------- |
| `projectReference` | ID!                      | Yes      | Project UUID, slug or domain. The caller must be the current owner.                                      |
| `input`            | UpdateProjectOwnerInput! | Yes      |                                                                                                          |
| `input.userId`     | ID!                      | Yes      | Existing member who becomes owner; must differ from the current owner. The previous owner becomes admin. |

## Variables

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

## Responses

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

## 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 UpdateProjectOwner($projectReference: ID!, $input: UpdateProjectOwnerInput!) {\n  updateProjectOwner(projectReference: $projectReference, input: $input) {\n    userId\n    email\n    name\n    avatarSrc\n    role\n    source\n    capabilities\n  }\n}",
  "variables": {
    "projectReference": "string",
    "input": {
      "userId": "string"
    }
  }
}'
```

## Example response

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