# List possession tags

`GET /api/v1/possession-tags` and `QUERY /api/v1/possession-tags`

List every possession tag of your account, sorted by name.

A possession tag belongs to the account, not to a vault, as possession types do.

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://friends.ban.is/docs/api/query-method).

## Query parameters

- `page` (integer, optional, defaults to 1): Which page to answer with.
- `per_page` (integer, optional, defaults to 25): How many tags one page holds, between 1 and 100. A number outside the range is brought back into it.

## Returns

A page of possession tag objects, and how many there are in all. An account with none answers an empty list.

- `data` (array): The possession tags on this page. An empty list rather than an error when there are none.
- `data[]` (object): One possession tag.
- `data[].type` (string): Always possession_tag. 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 tag reads, such as Insured or To sell.
- `data[].attributes.colour` (string): One of the eight vault colours, as a hexadecimal value.
- `data[].attributes.created_at` (timestamp): When the tag was added, as a count of seconds since 1970.
- `data[].attributes.updated_at` (timestamp): When its name or colour last changed, as a count of seconds, or null.
- `data[].links` (object): Where to find this record.
- `data[].links.self` (string): The absolute address this record is read from.
- `data[].links.web` (string): The settings screen where the tags of the account are managed, which opens for somebody signed in rather than for a key. It is the link to give a person.
- `meta` (object): Where you are in the collection.
- `meta.page` (integer): The page this is, counting from 1.
- `meta.per_page` (integer): How many one page holds, which is the size that was asked for once it has been brought into the allowed range.
- `meta.total` (integer): How many possession tags there are in all, not how many are on this page.

## Status codes

| Code | When | Body |
| --- | --- | --- |
| `422` Unprocessable Content | With QUERY, a parameter was sent both in the address and in the body. | A message, and an errors object naming each parameter sent twice. |

## 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://friends.ban.is/api/v1/possession-tags?page=2&per_page=10 \
  -H "Authorization: Bearer $MONICA_TOKEN"
```

```javascript
const response = await fetch('https://friends.ban.is/api/v1/possession-tags?page=2&per_page=10', {
  headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->get('https://friends.ban.is/api/v1/possession-tags?page=2&per_page=10');
```

## Request with QUERY

```sh
curl https://friends.ban.is/api/v1/possession-tags \
  -X QUERY \
  -H "Authorization: Bearer $MONICA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
      "page": 2,
      "per_page": 10
  }'
```

```javascript
const response = await fetch('https://friends.ban.is/api/v1/possession-tags', {
  method: 'QUERY',
  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    page: 2,
    per_page: 10,
  }),
})
const data = await response.json()
```

```php
$response = Http::withToken($token)->query('https://friends.ban.is/api/v1/possession-tags', [
    'page' => 2,
    'per_page' => 10,
]);
```

## Response

`200`

```json
{
    "data": [
        {
            "type": "possession_tag",
            "id": "7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031",
            "attributes": {
                "name": "Insured",
                "colour": "#2f7f86",
                "created_at": 1761436800,
                "updated_at": 1761440400
            },
            "links": {
                "self": "https://friends.ban.is/api/v1/possession-tags/7a3e9c15-2b84-4d60-9f17-c5e8a2d4b031",
                "web": "https://friends.ban.is/settings/account/possession-tags"
            }
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 25,
        "total": 1
    }
}
```
