Every token belongs to one team, and every request acts on that team. Read the team to find its plan, how many monitors it may have and the shortest check interval it allows, before creating monitors.

## The team object
Limits that are unlimited on the plan are null.

| Field | Type | Description |
|---|---|---|
| `id` | integer | The team's ID. |
| `name` | string | The team's name. |
| `plan` | string | The plan's key, such as `free`, `starter`, `pro` or `business`. |
| `monitors_used` | integer | How many monitors the team has. |
| `max_monitors` | integer or null | How many monitors the plan allows, or null for unlimited. |
| `min_interval_minutes` | integer | The shortest `check_interval_minutes` the plan allows. |
| `min_interval_seconds` | integer | The shortest `check_interval_seconds` the plan allows. |
| `history_days` | integer or null | How many days of checks are kept, or null for all. |
| `can_add_monitor` | boolean | Whether another monitor fits in the plan. |

## Get the team
`GET /api/v1/team`

Returns the team the token belongs to, its plan, and how much of the plan is used. Call it before creating monitors: `can_add_monitor` says whether there is room, and `min_interval_minutes` and `min_interval_seconds` are the shortest intervals the plan allows.

| | |
|---|---|
| Authentication | Bearer token. Any member of the team |
| Rate limit | 60 requests per minute per user, shared by all of that user's tokens |

### Example request

```bash
curl https://monitor.agilepixel.io/api/v1/team \
  -H "Authorization: Bearer $AGILEMONITOR_TOKEN" \
  -H "Accept: application/json"
```

### Responses

| Status | When | Body |
|---|---|---|
| `200` | The team. | The [team](#team-object), in `data` |
| `401` | There is no token, or it is invalid or revoked. | [Problem](https://monitor.agilepixel.io/docs/api/errors) |
| `403` | The token is valid but may not do this: a Viewer tried to change something, the token isn't pinned to a team, or its creator has left the team. | [Problem](https://monitor.agilepixel.io/docs/api/errors) |
| `429` | The rate limit is used up. Wait for `Retry-After` seconds. | [Problem](https://monitor.agilepixel.io/docs/api/errors) |
| `500` | Something went wrong on our side. Try again; if it persists, contact support. | [Problem](https://monitor.agilepixel.io/docs/api/errors) |

#### 200

```json
{
  "data": {
    "id": 4821,
    "name": "Northwind Coffee",
    "plan": "starter",
    "monitors_used": 2,
    "max_monitors": 20,
    "min_interval_minutes": 1,
    "min_interval_seconds": 60,
    "history_days": 30,
    "can_add_monitor": true
  }
}
```

#### 401

```json
{"type": "about:blank", "title": "Unauthorized", "status": 401}
```

#### 403

```json
{"type": "about:blank", "title": "Forbidden", "status": 403}
```

#### 429

```json
{"type": "about:blank", "title": "Too Many Requests", "status": 429}
```

#### 500

```json
{"type": "about:blank", "title": "Internal Server Error", "status": 500}
```
