Source: https://datafa.st/docs/api/account/team
Markdown source: https://datafa.st/docs/api/account/team.md
Description: List team members, invite members, and remove members.

# Team

Team write actions require both `team:write` permission and owner role on the website.

Use the team API when building onboarding or internal admin tools. Invitations are created for an email address and role, then the invited user can accept from DataFast.

Base path: `https://datafa.st/api/v1/admin`

| Endpoint | Method | Path | Permission | Purpose |
|---|---|---|---|---|
| [List team members](/docs/api/account/team/list) | GET | `/websites/{websiteId}/team` | `team:read` | List team members |
| [Invite team member](/docs/api/account/team/invite) | POST | `/websites/{websiteId}/team` | `team:write` + owner role | Invite a team member |
| [Remove team member](/docs/api/account/team/remove) | DELETE | `/websites/{websiteId}/team` | `team:write` + owner role | Remove a team member |

## Invite a team member

```sh
curl -X POST "https://datafa.st/api/v1/admin/websites/YOUR_WEBSITE_ID/team" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{"email":"member@example.com","role":"viewer"}'
```

Roles are `viewer` and `member`. You cannot remove yourself with this endpoint.

Related docs: [permissions and roles](/docs/cli-permissions), [authentication and scopes](/docs/api/authentication), [CLI team commands](/docs/cli-websites#team-management).

## Code examples

### Invite a team member

```bash
curl -X POST "https://datafa.st/api/v1/admin/websites/YOUR_WEBSITE_ID/team" \
  -H "Authorization: Bearer dft_xxx" \
  -H "Content-Type: application/json" \
  -d '{"email":"member@example.com","role":"viewer"}'
```

### Success response

```json
{
  "status": "success",
  "data": [
    {
      "message": "Invitation created. Send the invite link to the user.",
      "invitationId": "665f0b3c4d2e1a0012345678",
      "email": "member@example.com",
      "role": "viewer"
    }
  ]
}
```
