summaryrefslogtreecommitdiff
path: root/doc/api/personal_access_tokens.md
blob: ea156d92dc849cda7e126bb6f62211e3efa2f26d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Personal Access Token

## List

This function takes pagination parameters `page` and `per_page` to restrict the list of personal access tokens.

```
GET /personal_access_tokens
```

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `state`   | string | no | filter tokens based on state (all, active, inactive) |

Example response:
```json
[
  {
    "id": 1,
    "name": "mytoken",
    "revoked": false,
    "expires_at": "2017-01-04",
    "scopes": ["api"],
    "active": true
  }
]
```

## Show

```
GET /personal_access_tokens/:personal_access_token_id
```

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personal_access_token_id` | integer | yes | The ID of the personal access token |

## Create

```
POST /personal_access_tokens
```

It responds with the new personal access token for the current user.

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `name` | string | yes | The name of the personal access token |
| `expires_at` | date | no | The expiration date of the personal access token |
| `scopes` | array | no | The array of scopes of the personal access token |

## Revoke

```
DELETE /personal_access_tokens/:personal_access_token_id
```

Parameters:

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personal_access_token_id` | integer | yes | The ID of the personal access token |