# `token.list`

<span class="badge">bearer</span>

**List the caller's personal access tokens**

Returns metadata for every active PAT the caller owns (never the hash or plaintext). JWT session only.

## Parameters

_None._

## Result

Returns `listTokensResult`:

| Field | Type | Description |
|---|---|---|
| `tokens *` | `array<apiTokenDTO>` |  |

## Example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "token.list"
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tokens": [
      {
        "id": "018f3a8e-3c9d-7a2b-b5e6-7f8a9b0c1d2e",
        "name": "backup-script",
        "hint": "pnt_3f9a",
        "last_used_at": "2026-03-20T18:02:11Z",
        "created_at": "2026-03-14T09:26:53Z"
      }
    ]
  }
}
```

**curl**

```bash
curl -s https://peinture.gumeniuk.com/rpc \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"token.list"}'
```

**JavaScript**

```js
const res = await fetch("https://peinture.gumeniuk.com/rpc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${token}`,
  },
  body: JSON.stringify({
    jsonrpc: "2.0", id: 1, method: "token.list", params: {},
  }),
});
const { result, error } = await res.json();
```

**Go**

```go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"token.list"}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
```

