# Give someone project access

A project member works in one project, as an **Admin**, **Editor** or **Viewer** ([access](/docs/authentication.md)).

## Before you start

You need a project where you are an owner or **Admin** ([Create a project](/docs/projects/create-project.md)).

Inviting someone new takes a free seat ([Buy more seats](/docs/account/add-ons.md)).

The API needs a key from your personal account's **Settings** > **API keys**, with **Read**, **Write** and **Delete** ticked.

## Invite someone

**Studio**

1. In your project, open **Settings** > **Members**.
2. Click **Invite member**.
3. Enter `maya@example.com` as the **Email**.
4. Pick **Editor** as the **Role**.
5. Click **Invite**. You should now see <maya@example.com> under **Pending invitations**, as Project editor. If she already uses Veryfront, you see "Added to project" and her under **Members**.

### Troubleshooting

**If Studio says "You have used up all your seats. Upgrade to continue."**, click **Upgrade plan**.

**API**

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. Invite someone as an `admin`, `editor` or `viewer`; a current member's role changes. You should now see `"outcome": "invitation_created"`, or `"member_added"` with her `user_id` if she already uses Veryfront:

```bash
curl -X POST https://api.veryfront.com/projects/$PROJECT/invitations \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "maya@example.com", "role": "editor"}'
```

3. For `invitation_created`, list the invitations. You should now see `maya@example.com` with the role `editor`:

```bash
curl https://api.veryfront.com/projects/$PROJECT/invitations \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

### Troubleshooting

**If you see `"invitation_created"` with `"email_sent": false`**, no email went out. Resend it with `invitation.id`:

```bash
curl -X POST https://api.veryfront.com/projects/$PROJECT/invitations/<id>/resend \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

## Revoke an invitation

Her invitation stays pending until she accepts.

**Studio**

1. Under **Pending invitations**, open the **⋯** menu on the invitation's row.
2. Click **Revoke invitation**.
3. Click **Revoke invitation** to confirm. You should now see **Invitation revoked**.

**API**

1. Set `INVITATION_ID` to the invitation's `id` from the list: `export INVITATION_ID=<id>`.
2. Delete it:

```bash
curl -X DELETE https://api.veryfront.com/projects/$PROJECT/invitations/$INVITATION_ID \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

3. List the invitations again. You should now see a list without `maya@example.com`:

```bash
curl https://api.veryfront.com/projects/$PROJECT/invitations \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

## Change their role

Maya must be a member: she accepted, or already used Veryfront.

**Studio**

1. Open the **⋯** menu on Maya's row.
2. Click **Update role**.
3. Pick **Viewer** as the **Role**.
4. Click **Update role**. You should now see her role read Project viewer.

**API**

1. Set `USER_ID` to Maya's `user_id`, from step 2 or the members list (add `&cursor=<page_info.next>` for more): `export USER_ID=<user_id>`.

```bash
curl "https://api.veryfront.com/projects/$PROJECT/members?limit=100" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

2. Set her role. You should now see `"role": "viewer"`:

```bash
curl -X PATCH https://api.veryfront.com/projects/$PROJECT/members/$USER_ID \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"role": "viewer"}'
```

## Remove someone

**Studio**

1. Open the **⋯** menu on Maya's row.
2. Click **Remove user**.
3. Click **Remove member**. You should now see Maya gone from **Members**.

**API**

1. Remove her. You should now see `{"ok": true}`:

```bash
curl -X DELETE https://api.veryfront.com/projects/$PROJECT/members/$USER_ID \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

## With MCP

`project_reference` is your project's slug or `id` (from `veryfront__list_projects`, or the `id` `veryfront__create_project` returns).

1. Call `veryfront__create_project_invitation` with `{ "project_reference": "<your project>", "email": "maya@example.com", "role": "editor" }`. If it answers `invitation_created` with `email_sent` false, call `veryfront__resend_project_invitation` with the invitation's `id` as `invitation_id`.
2. For `invitation_created`, call `veryfront__list_project_invitations` with the same `project_reference`. It worked when Maya is listed with the role `editor`.
3. To revoke it, call `veryfront__delete_project_invitation` with the same `project_reference`, the invitation's `id` as `invitation_id` and `"confirm": true`, then list again: it worked when Maya is no longer listed.
4. Once she is a member, call `veryfront__update_project_member` with the same `project_reference`, her `user_id` (from `member_added`, or `veryfront__list_project_members`, passing `page_info.next` as `cursor` until she is listed) and `"role": "viewer"`. It worked when the answer's `role` is `viewer`.
5. To remove her, call `veryfront__delete_project_member` with the same `project_reference`, her `user_id` and `"confirm": true`. It worked when it answers `{"ok": true}`.

## Next steps

* [Set spend limits](/docs/account/spend-limits.md)
* [Set roles](/docs/account/roles.md)
