# Get a group

`GET /api/v1/vaults/{vault}/groups/{group}` and `QUERY /api/v1/vaults/{vault}/groups/{group}`

Retrieve one group, with the dates it existed between and how many people are in it today.

A deleted group answers 404.

Groups are not yet available to every account. Until they are available to yours, every endpoint here answers 404.

This endpoint answers GET and QUERY alike, and both return the same answer. GET sends the parameters in the address, QUERY in the request body. [How QUERY works](https://people.hansyeoh.com/docs/api/query-method).

## Path parameters

- `vault` (string, required): The vault the groups live in, named either by the readable name it reports as slug or by its id.
- `group` (uuid, required): The id of the group. One addressed through the wrong vault, or belonging to another account, answers 404.

## Returns

A group object. One of another account or vault answers 404.

- `data` (object): The group.
- `data.type` (string): Always group. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.
- `data.id` (string): The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.
- `data.attributes` (object): Everything the record holds.
- `data.attributes.name` (string): What the group is called.
- `data.attributes.description` (string): What was written about it, or null.
- `data.attributes.started_on` (string): When it started, written as a year, a month and a day, or null.
- `data.attributes.started_precision` (string): How much of the date is known: day, month, year or decade. Always unknown when there is no date.
- `data.attributes.ended_on` (string): When it ended, written as a year, a month and a day, or null while it still exists.
- `data.attributes.ended_precision` (string): How much of the date is known: day, month, year or decade. Always unknown when there is no date.
- `data.attributes.current_member_count` (integer): How many people are in it today. Those who left are not counted.
- `data.attributes.created_at` (timestamp): When it was created, as a count of seconds since 1970.
- `data.attributes.updated_at` (timestamp): When it last changed, as a count of seconds since 1970, or null.
- `data.attributes.deleted_at` (timestamp): When it was deleted, as a count of seconds since 1970, or null.
- `data.links` (object): Where to find this record.
- `data.links.self` (string): The absolute address this record is read from.

## Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in `X-RateLimit-Remaining`.

## Request

```sh
curl https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7 \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7');
```

## Request with QUERY

```sh
curl https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7 \
  -X QUERY \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7', {
  method: 'QUERY',
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->query('https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7');
```

## Response

`200`

```json
{
    "data": {
        "type": "group",
        "id": "5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7",
        "attributes": {
            "name": "Party planning committee",
            "description": "Plans every birthday, retirement and holiday party of the Scranton branch.",
            "started_on": "2005-01-01",
            "started_precision": "year",
            "ended_on": null,
            "ended_precision": "unknown",
            "current_member_count": 3,
            "created_at": 1791547200,
            "updated_at": 1791547200,
            "deleted_at": null
        },
        "links": {
            "self": "https://people.hansyeoh.com/api/v1/vaults/dunder-mifflin/groups/5d2a7c91-3e48-4b06-9f1d-a83c60e2b4f7"
        }
    }
}
```
