# Teams

## Get list of your teams

<mark style="color:blue;">`GET`</mark> `https://app.zencal.io/api/v1/teams`

This method will return a list of all teams to which your user has administrator privileges.

#### Headers

| Name                                               | Type   | Description      |
| -------------------------------------------------- | ------ | ---------------- |
| X-Zencal-Api-Key<mark style="color:red;">\*</mark> | String | Zencal Api key   |
| Accept<mark style="color:red;">\*</mark>           | String | application/json |
| Content-Type<mark style="color:red;">\*</mark>     | String | application/json |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "teams": [
        {
            "uuid": "2174ccfc-eb20-11ed-a05b-0242ac120003",
            "name": "Power Rangers"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get list of users in your team

<mark style="color:blue;">`GET`</mark> `https://app.zencal.io/api/v1/teams/{teamUuid}/users`

This method will return list of team members

#### Path Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| teamUuid<mark style="color:red;">\*</mark> | String | Team's uuid |

#### Headers

| Name                                               | Type   | Description      |
| -------------------------------------------------- | ------ | ---------------- |
| X-Zencal-Api-Key<mark style="color:red;">\*</mark> | String | application/json |
| Accept<mark style="color:red;">\*</mark>           | String | application/json |
| Content-Type<mark style="color:red;">\*</mark>     | String | application/json |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "users": [
        {
            "uuid": "86f2e210-f168-45d2-81a2-7e220cc20dca",
            "username": "joe-smith",
            "firstName": "Joe",
            "lastName": "Smith",
            "email": "joe.smith@hotmail.com",
            "phone": "+31100200300",
            "avatar": "https://cdn.zencal.io/avatar.png",
            "tags": [
                {
                    "uuid": "dd3107a3-0a48-4c31-a48e-2fc500e416da",
                    "name": "Kraków",
                    "color": "#3b82f6"
                }
            ]
        },
        {
            "uuid": "12f2exx0-f8168-45d2-81a2-7e220cc20dca",
            "username": "barbra-streisand",
            "firstName": "Barbra",
            "lastName": "Streisand",
            "email": "barbra.streisand@hotmail.com",
            "phone": "+23300500700",
            "avatar": "https://cdn.zencal.io/avatar.png",
            "tags": []
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Create a new user in your team

<mark style="color:green;">`POST`</mark> `https://app.zencal.io/api/v1/teams/{teamUuid}/users`

Remember to check if your subscription plan allows you to add more users before adding them. You can check this in the "Billing" tab of your Zencal account.

#### Path Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| teamUuid<mark style="color:red;">\*</mark> | String | Team's uuid |

#### Headers

| Name                                               | Type   | Description      |
| -------------------------------------------------- | ------ | ---------------- |
| X-Zencal-Api-Key<mark style="color:red;">\*</mark> | String | Zencal Api key   |
| Content-Type<mark style="color:red;">\*</mark>     | String | application/json |
| Accept<mark style="color:red;">\*</mark>           | String | application/json |

#### Request Body

| Name                                        | Type    | Description                                           |
| ------------------------------------------- | ------- | ----------------------------------------------------- |
| firstName<mark style="color:red;">\*</mark> | String  | Team member's first name                              |
| lastName<mark style="color:red;">\*</mark>  | String  | Team member's last name                               |
| email<mark style="color:red;">\*</mark>     | String  | Team member's email                                   |
| admin                                       | Boolean | Set to true if this user should have admin privileges |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": "User has been created",
    "teamUser": {
        "uuid": "d371bcf0-ca3c-4c7f-a24c-ddb35c8b5c7f"
    }
}
```

{% endtab %}

{% tab title="402: Payment Required " %}

```json
{
    "error": "Your team has reached the maximum number of users in the current subscription plan"
}
```

{% endtab %}
{% endtabs %}

## Delete user from your team

<mark style="color:red;">`DELETE`</mark> `https://app.zencal.io/api/v1/teams/{teamUuid}/users/{userUuid}`

#### Path Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| teamUuid<mark style="color:red;">\*</mark> | String | Team's uuid |
| userUuid<mark style="color:red;">\*</mark> | String | User's uuid |

#### Headers

| Name                                               | Type   | Description      |
| -------------------------------------------------- | ------ | ---------------- |
| X-Zencal-Api-Key<mark style="color:red;">\*</mark> | String | Zencal Api key   |
| Accept<mark style="color:red;">\*</mark>           | String | application/json |
| Content-Type<mark style="color:red;">\*</mark>     | String | application/json |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "success": "User has been deleted from your team"
}
```

{% endtab %}
{% endtabs %}
