issues.md 55.1 KB
Newer Older
1
# Issues API
2

3 4 5 6 7 8 9 10 11 12 13 14
Every API call to issues must be authenticated.

If a user is not a member of a project and the project is private, a `GET`
request on that project will result to a `404` status code.

## Issues pagination

By default, `GET` requests return 20 results at a time because the API results
are paginated.

Read more on [pagination](README.md#pagination).

Nihad Abbasov's avatar
Nihad Abbasov committed
15 16
## List issues

17 18 19
Get all issues the authenticated user has access to. By default it
returns only issues created by the current user. To get all issues,
use parameter `scope=all`.
Nihad Abbasov's avatar
Nihad Abbasov committed
20 21 22

```
GET /issues
23 24
GET /issues?state=opened
GET /issues?state=closed
25 26 27
GET /issues?labels=foo
GET /issues?labels=foo,bar
GET /issues?labels=foo,bar&state=opened
28 29
GET /issues?milestone=1.0.0
GET /issues?milestone=1.0.0&state=opened
30
GET /issues?iids[]=42&iids[]=43
31 32
GET /issues?author_id=5
GET /issues?assignee_id=5
33
GET /issues?my_reaction_emoji=star
34
GET /issues?search=foo&in=title
Nihad Abbasov's avatar
Nihad Abbasov committed
35 36
```

37 38 39
| Attribute           | Type             | Required   | Description                                                                                                                                         |
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                                       |
40
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
41
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.                             |
42 43
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me`<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
| `author_id`         | integer          | no         | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_          |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
44
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
45
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
46 47 48 49
| `iids[]`            | Array[integer]   | no         | Return only the issues having the given `iid`                                                                                                       |
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                                               |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                                                    |
| `search`            | string           | no         | Search issues against their `title` and `description`                                                                                               |
Hiroyuki Sato's avatar
Hiroyuki Sato committed
50
| `in`                | string           | no         | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description`              |
51 52 53 54
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                                                    |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                                                   |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                                                    |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                                                   |
55 56

```bash
57
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/issues
58
```
59

60
Example response:
61

Nihad Abbasov's avatar
Nihad Abbasov committed
62 63
```json
[
64 65 66 67 68 69
   {
      "state" : "opened",
      "description" : "Ratione dolores corrupti mollitia soluta quia.",
      "author" : {
         "state" : "active",
         "id" : 18,
70
         "web_url" : "https://gitlab.example.com/eileen.lowe",
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
         "name" : "Alexandra Bashirian",
         "avatar_url" : null,
         "username" : "eileen.lowe"
      },
      "milestone" : {
         "project_id" : 1,
         "description" : "Ducimus nam enim ex consequatur cumque ratione.",
         "state" : "closed",
         "due_date" : null,
         "iid" : 2,
         "created_at" : "2016-01-04T15:31:39.996Z",
         "title" : "v4.0",
         "id" : 17,
         "updated_at" : "2016-01-04T15:31:39.996Z"
      },
      "project_id" : 1,
87 88 89 90 91 92 93 94
      "assignees" : [{
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root"
      }],
95 96 97 98
      "assignee" : {
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
99
         "web_url" : "https://gitlab.example.com/root",
100 101 102 103
         "avatar_url" : null,
         "username" : "root"
      },
      "updated_at" : "2016-01-04T15:31:51.081Z",
104
      "closed_at" : null,
haseeb's avatar
haseeb committed
105
      "closed_by" : null,
106 107 108 109
      "id" : 76,
      "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
      "created_at" : "2016-01-04T15:31:51.081Z",
      "iid" : 6,
110
      "labels" : [],
111 112
      "upvotes": 4,
      "downvotes": 0,
113
      "user_notes_count": 1,
114
      "due_date": "2016-07-22",
115
      "web_url": "http://example.com/example/example/issues/6",
116 117 118 119 120 121
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
122 123
      "confidential": false,
      "discussion_locked": false
124
   }
Nihad Abbasov's avatar
Nihad Abbasov committed
125 126 127
]
```

128
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
129

haseeb's avatar
haseeb committed
130 131
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

132 133 134 135 136 137 138 139 140 141 142 143 144
## List group issues

Get a list of a group's issues.

```
GET /groups/:id/issues
GET /groups/:id/issues?state=opened
GET /groups/:id/issues?state=closed
GET /groups/:id/issues?labels=foo
GET /groups/:id/issues?labels=foo,bar
GET /groups/:id/issues?labels=foo,bar&state=opened
GET /groups/:id/issues?milestone=1.0.0
GET /groups/:id/issues?milestone=1.0.0&state=opened
145
GET /groups/:id/issues?iids[]=42&iids[]=43
146
GET /groups/:id/issues?search=issue+title+or+description
147 148
GET /groups/:id/issues?author_id=5
GET /groups/:id/issues?assignee_id=5
149
GET /groups/:id/issues?my_reaction_emoji=star
150 151
```

152 153 154 155
| Attribute           | Type             | Required   | Description                                                                                                                   |
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `id`                | integer/string   | yes        | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user                 |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                 |
156
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
157
| `iids[]`            | Array[integer]   | no         | Return only the issues having the given `iid`                                                                                 |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
158
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
159
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
160
| `author_id`         | integer          | no         | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_                                         |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
161
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
162
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
163 164 165
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                         |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                              |
| `search`            | string           | no         | Search group issues against their `title` and `description`                                                                   |
166 167 168 169
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                              |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                             |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                              |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                             |
170 171 172


```bash
173
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/4/issues
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
```

Example response:

```json
[
   {
      "project_id" : 4,
      "milestone" : {
         "due_date" : null,
         "project_id" : 4,
         "state" : "closed",
         "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
         "iid" : 3,
         "id" : 11,
         "title" : "v3.0",
         "created_at" : "2016-01-04T15:31:39.788Z",
         "updated_at" : "2016-01-04T15:31:39.788Z"
      },
      "author" : {
         "state" : "active",
195
         "web_url" : "https://gitlab.example.com/root",
196 197 198 199 200 201 202 203
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
204 205 206 207 208 209 210 211
      "assignees" : [{
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      }],
212 213
      "assignee" : {
         "avatar_url" : null,
214
         "web_url" : "https://gitlab.example.com/lennie",
215 216 217 218 219 220
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
      "labels" : [],
221 222
      "upvotes": 4,
      "downvotes": 0,
223 224 225 226
      "id" : 41,
      "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
      "updated_at" : "2016-01-04T15:31:46.176Z",
      "created_at" : "2016-01-04T15:31:46.176Z",
227
      "closed_at" : null,
haseeb's avatar
haseeb committed
228
      "closed_by" : null,
229
      "user_notes_count": 1,
230
      "due_date": null,
231
      "web_url": "http://example.com/example/example/issues/1",
232 233 234 235 236 237
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
238 239
      "confidential": false,
      "discussion_locked": false
240 241 242 243
   }
]
```

244
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
245

haseeb's avatar
haseeb committed
246 247
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
248 249
## List project issues

250
Get a list of a project's issues.
Nihad Abbasov's avatar
Nihad Abbasov committed
251 252 253

```
GET /projects/:id/issues
254 255
GET /projects/:id/issues?state=opened
GET /projects/:id/issues?state=closed
256 257 258
GET /projects/:id/issues?labels=foo
GET /projects/:id/issues?labels=foo,bar
GET /projects/:id/issues?labels=foo,bar&state=opened
259 260
GET /projects/:id/issues?milestone=1.0.0
GET /projects/:id/issues?milestone=1.0.0&state=opened
261
GET /projects/:id/issues?iids[]=42&iids[]=43
262
GET /projects/:id/issues?search=issue+title+or+description
263 264
GET /projects/:id/issues?author_id=5
GET /projects/:id/issues?assignee_id=5
265
GET /projects/:id/issues?my_reaction_emoji=star
Nihad Abbasov's avatar
Nihad Abbasov committed
266 267
```

268 269 270 271 272
| Attribute           | Type             | Required   | Description                                                                                                                   |
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `id`                | integer/string   | yes        | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user               |
| `iids[]`            | Array[integer]   | no         | Return only the milestone having the given `iid`                                                                              |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                 |
273
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
274
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
275
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
276
| `author_id`         | integer          | no         | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_                                         |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
277
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
278
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
279 280 281
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                         |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                              |
| `search`            | string           | no         | Search project issues against their `title` and `description`                                                                 |
282 283 284 285
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                              |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                             |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                              |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                             |
286 287

```bash
288
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues
289 290 291
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
292

293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
```json
[
   {
      "project_id" : 4,
      "milestone" : {
         "due_date" : null,
         "project_id" : 4,
         "state" : "closed",
         "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
         "iid" : 3,
         "id" : 11,
         "title" : "v3.0",
         "created_at" : "2016-01-04T15:31:39.788Z",
         "updated_at" : "2016-01-04T15:31:39.788Z"
      },
      "author" : {
         "state" : "active",
310
         "web_url" : "https://gitlab.example.com/root",
311 312 313 314 315 316 317 318
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
319 320 321 322 323 324 325 326
      "assignees" : [{
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      }],
327 328
      "assignee" : {
         "avatar_url" : null,
329
         "web_url" : "https://gitlab.example.com/lennie",
330 331 332 333 334 335
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
      "labels" : [],
336 337
      "upvotes": 4,
      "downvotes": 0,
338 339 340
      "id" : 41,
      "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
      "updated_at" : "2016-01-04T15:31:46.176Z",
341
      "created_at" : "2016-01-04T15:31:46.176Z",
342
      "closed_at" : "2016-01-05T15:31:46.176Z",
haseeb's avatar
haseeb committed
343 344 345 346 347 348 349 350
      "closed_by" : {
         "state" : "active",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
351
      "user_notes_count": 1,
352
      "due_date": "2016-07-22",
353
      "web_url": "http://example.com/example/example/issues/1",
354 355 356 357 358 359
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
360 361
      "confidential": false,
      "discussion_locked": false
362 363 364
   }
]
```
365

366
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
367

haseeb's avatar
haseeb committed
368 369
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
370 371
## Single issue

372
Get a single project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
373 374

```
375
GET /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
376 377
```

378
| Attribute   | Type    | Required | Description                          |
379
|-------------|---------|----------|--------------------------------------|
380
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
381
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
Nihad Abbasov's avatar
Nihad Abbasov committed
382

383
```bash
384
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/41
385 386 387
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
388 389 390

```json
{
391 392 393 394 395 396 397 398 399 400
   "project_id" : 4,
   "milestone" : {
      "due_date" : null,
      "project_id" : 4,
      "state" : "closed",
      "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
      "iid" : 3,
      "id" : 11,
      "title" : "v3.0",
      "created_at" : "2016-01-04T15:31:39.788Z",
401 402
      "updated_at" : "2016-01-04T15:31:39.788Z",
      "closed_at" : "2016-01-05T15:31:46.176Z"
403 404 405
   },
   "author" : {
      "state" : "active",
406
      "web_url" : "https://gitlab.example.com/root",
407 408 409 410 411 412 413 414
      "avatar_url" : null,
      "username" : "root",
      "id" : 1,
      "name" : "Administrator"
   },
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "state" : "closed",
   "iid" : 1,
415 416 417 418 419 420 421 422
   "assignees" : [{
      "avatar_url" : null,
      "web_url" : "https://gitlab.example.com/lennie",
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
   }],
423 424
   "assignee" : {
      "avatar_url" : null,
425
      "web_url" : "https://gitlab.example.com/lennie",
426 427 428 429 430 431
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
   },
   "labels" : [],
432 433
   "upvotes": 4,
   "downvotes": 0,
434 435 436
   "id" : 41,
   "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
   "updated_at" : "2016-01-04T15:31:46.176Z",
437
   "created_at" : "2016-01-04T15:31:46.176Z",
haseeb's avatar
haseeb committed
438 439
   "closed_at" : null,
   "closed_by" : null,
440
   "subscribed": false,
441
   "user_notes_count": 1,
442
   "due_date": null,
443
   "web_url": "http://example.com/example/example/issues/1",
444 445 446 447 448 449
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
450
   "confidential": false,
451
   "discussion_locked": false,
452 453 454 455 456 457
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
Nihad Abbasov's avatar
Nihad Abbasov committed
458 459 460
}
```

461
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
462

haseeb's avatar
haseeb committed
463 464
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
465 466
## New issue

467
Creates a new project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
468 469 470 471 472

```
POST /projects/:id/issues
```

473 474
| Attribute                                 | Type           | Required | Description  |
|-------------------------------------------|----------------|----------|--------------|
475
| `id`                                      | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
476
| `iid`                                     | integer/string | no       | The internal ID of the project's issue (requires admin or project owner rights) |
477 478 479
| `title`                                   | string  | yes      | The title of an issue |
| `description`                             | string  | no       | The description of an issue  |
| `confidential`                            | boolean | no       | Set an issue to be confidential. Default is `false`.  |
480
| `assignee_ids`                            | Array[integer] | no       | The ID of the users to assign issue |
481
| `milestone_id`                            | integer | no       | The global ID of a milestone to assign issue  |
482
| `labels`                                  | string  | no       | Comma-separated label names for an issue  |
483
| `created_at`                              | string  | no       | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project/group owner rights) |
484 485 486
| `due_date`                                | string  | no       | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11` |
| `merge_request_to_resolve_discussions_of` | integer | no       | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values.|
| `discussion_to_resolve`                   | string  | no       | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
487 488

```bash
489
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug
490
```
Nihad Abbasov's avatar
Nihad Abbasov committed
491

492
Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
493

494 495 496 497 498 499 500 501
```json
{
   "project_id" : 4,
   "id" : 84,
   "created_at" : "2016-01-07T12:44:33.959Z",
   "iid" : 14,
   "title" : "Issues with auth",
   "state" : "opened",
502
   "assignees" : [],
503 504 505 506
   "assignee" : null,
   "labels" : [
      "bug"
   ],
507 508
   "upvotes": 4,
   "downvotes": 0,
509 510 511 512
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "state" : "active",
513
      "web_url" : "https://gitlab.example.com/eileen.lowe",
514 515 516 517 518
      "id" : 18,
      "username" : "eileen.lowe"
   },
   "description" : null,
   "updated_at" : "2016-01-07T12:44:33.959Z",
519
   "closed_at" : null,
haseeb's avatar
haseeb committed
520
   "closed_by" : null,
521
   "milestone" : null,
522
   "subscribed" : true,
523
   "user_notes_count": 0,
524
   "due_date": null,
525
   "web_url": "http://example.com/example/example/issues/14",
526 527 528 529 530 531
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
532
   "confidential": false,
533
   "discussion_locked": false,
534 535 536 537 538 539
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
540 541
}
```
542

543
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
544

haseeb's avatar
haseeb committed
545 546
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
547 548
## Edit issue

549 550 551
Updates an existing project issue. This call is also used to mark an issue as
closed.

Nihad Abbasov's avatar
Nihad Abbasov committed
552
```
553
PUT /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
554 555
```

556
| Attribute      | Type    | Required | Description                                                                                                |
557
|----------------|---------|----------|------------------------------------------------------------------------------------------------------------|
558
| `id`           | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
559 560 561 562
| `issue_iid`    | integer | yes      | The internal ID of a project's issue                                                                       |
| `title`        | string  | no       | The title of an issue                                                                                      |
| `description`  | string  | no       | The description of an issue                                                                                |
| `confidential` | boolean | no       | Updates an issue to be confidential                                                                        |
563
| `assignee_ids`  | Array[integer] | no  | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees.  |
564
| `milestone_id` | integer | no       | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.|
565
| `labels`       | string  | no       | Comma-separated label names for an issue. Set to an empty string to unassign all labels.                   |
566 567 568
| `state_event`  | string  | no       | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it                      |
| `updated_at`   | string  | no       | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date`     | string  | no       | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11`                                           |
569
| `discussion_locked` | boolean | no  | Flag indicating if the issue's discussion is locked. If the discussion is locked only project members can add or edit comments. |
570

571 572

```bash
573
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close
574
```
Nihad Abbasov's avatar
Nihad Abbasov committed
575

576
Example response:
577

578 579 580 581 582 583 584 585 586
```json
{
   "created_at" : "2016-01-07T12:46:01.410Z",
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "username" : "eileen.lowe",
      "id" : 18,
      "state" : "active",
587
      "web_url" : "https://gitlab.example.com/eileen.lowe"
588 589 590 591 592 593
   },
   "state" : "closed",
   "title" : "Issues with auth",
   "project_id" : 4,
   "description" : null,
   "updated_at" : "2016-01-07T12:55:16.213Z",
594
   "closed_at" : "2016-01-08T12:55:16.213Z",
haseeb's avatar
haseeb committed
595 596 597 598 599 600 601 602
   "closed_by" : {
      "state" : "active",
      "web_url" : "https://gitlab.example.com/root",
      "avatar_url" : null,
      "username" : "root",
      "id" : 1,
      "name" : "Administrator"
    },
603 604 605 606
   "iid" : 15,
   "labels" : [
      "bug"
   ],
607 608
   "upvotes": 4,
   "downvotes": 0,
609
   "id" : 85,
610
   "assignees" : [],
611
   "assignee" : null,
612
   "milestone" : null,
613
   "subscribed" : true,
614
   "user_notes_count": 0,
615
   "due_date": "2016-07-22",
616
   "web_url": "http://example.com/example/example/issues/15",
617 618 619 620 621 622
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
623
   "confidential": false,
624
   "discussion_locked": false,
625 626 627 628 629 630
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
631 632
}
```
633

634
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
635

haseeb's avatar
haseeb committed
636 637
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

638
## Delete an issue
639

640
Only for admins and project owners. Soft deletes the issue in question.
641 642

```
643
DELETE /projects/:id/issues/:issue_iid
644 645
```

646
| Attribute   | Type    | Required | Description                          |
647
|-------------|---------|----------|--------------------------------------|
648
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
649
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
650 651

```bash
652
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/85
653 654
```

655 656
## Move an issue

657
Moves an issue to a different project. If the target project
658 659
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
660

661 662 663
If a given label and/or milestone with the same name also exists in the target
project, it will then be assigned to the issue that is being moved.

664
```
665
POST /projects/:id/issues/:issue_iid/move
666 667
```

668
| Attribute       | Type    | Required | Description                          |
669
|-----------------|---------|----------|--------------------------------------|
670
| `id`            | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
671 672
| `issue_iid`     | integer | yes      | The internal ID of a project's issue |
| `to_project_id` | integer | yes      | The ID of the new project            |
673 674

```bash
675
curl --header "PRIVATE-TOKEN: <your_access_token>" --form to_project_id=5 https://gitlab.example.com/api/v4/projects/4/issues/85/move
676 677 678 679 680 681 682 683 684 685 686 687 688 689
```

Example response:

```json
{
  "id": 92,
  "iid": 11,
  "project_id": 5,
  "title": "Sit voluptas tempora quisquam aut doloribus et.",
  "description": "Repellat voluptas quibusdam voluptatem exercitationem.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.652Z",
  "updated_at": "2016-04-07T12:20:17.596Z",
690
  "closed_at": null,
haseeb's avatar
haseeb committed
691
  "closed_by": null,
692
  "labels": [],
693 694
  "upvotes": 4,
  "downvotes": 0,
695
  "milestone": null,
696 697 698 699 700 701 702 703
  "assignees": [{
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/axel.block"
  }],
704 705 706 707 708 709
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
710
    "web_url": "https://gitlab.example.com/axel.block"
711 712 713 714 715 716 717
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
718
    "web_url": "https://gitlab.example.com/solon.cremin"
719
  },
720
  "due_date": null,
721
  "web_url": "http://example.com/example/example/issues/11",
722 723 724 725 726 727
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
728
  "confidential": false,
729
  "discussion_locked": false,
730 731 732 733 734 735
  "_links": {
    "self": "http://example.com/api/v4/projects/1/issues/2",
    "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://example.com/api/v4/projects/1"
  }
736 737 738
}
```

739
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
740

haseeb's avatar
haseeb committed
741 742
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

743 744
## Subscribe to an issue

745
Subscribes the authenticated user to an issue to receive notifications.
746 747
If the user is already subscribed to the issue, the status code `304`
is returned.
748 749

```
750
POST /projects/:id/issues/:issue_iid/subscribe
751 752
```

753
| Attribute   | Type    | Required | Description                          |
754
|-------------|---------|----------|--------------------------------------|
755
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
756
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
757 758

```bash
759
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe
760 761 762 763 764 765 766 767 768 769 770 771 772 773
```

Example response:

```json
{
  "id": 92,
  "iid": 11,
  "project_id": 5,
  "title": "Sit voluptas tempora quisquam aut doloribus et.",
  "description": "Repellat voluptas quibusdam voluptatem exercitationem.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.652Z",
  "updated_at": "2016-04-07T12:20:17.596Z",
774
  "closed_at": null,
haseeb's avatar
haseeb committed
775
  "closed_by": null,
776
  "labels": [],
777 778
  "upvotes": 4,
  "downvotes": 0,
779
  "milestone": null,
780 781 782 783 784 785 786 787
  "assignees": [{
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/axel.block"
  }],
788 789 790 791 792 793
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
794
    "web_url": "https://gitlab.example.com/axel.block"
795 796 797 798 799 800 801
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
802
    "web_url": "https://gitlab.example.com/solon.cremin"
803
  },
804
  "due_date": null,
805
  "web_url": "http://example.com/example/example/issues/11",
806 807 808 809 810 811
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
812
  "confidential": false,
813
  "discussion_locked": false,
814 815 816 817 818 819
  "_links": {
    "self": "http://example.com/api/v4/projects/1/issues/2",
    "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://example.com/api/v4/projects/1"
  }
820 821 822
}
```

823
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
824

haseeb's avatar
haseeb committed
825 826 827

**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

828 829
## Unsubscribe from an issue

830
Unsubscribes the authenticated user from the issue to not receive notifications
831 832
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
833 834

```
835
POST /projects/:id/issues/:issue_iid/unsubscribe
836 837
```

838
| Attribute   | Type    | Required | Description                          |
839
|-------------|---------|----------|--------------------------------------|
840
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
841
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
842 843

```bash
844
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe
845 846
```

847 848 849 850 851 852 853 854 855 856 857 858 859
Example response:

```json
{
  "id": 93,
  "iid": 12,
  "project_id": 5,
  "title": "Incidunt et rerum ea expedita iure quibusdam.",
  "description": "Et cumque architecto sed aut ipsam.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.217Z",
  "updated_at": "2016-04-07T13:02:37.905Z",
  "labels": [],
860 861
  "upvotes": 4,
  "downvotes": 0,
862 863 864 865 866 867 868 869 870
  "milestone": null,
  "assignee": {
    "name": "Edwardo Grady",
    "username": "keyon",
    "id": 21,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/keyon"
  },
871 872
  "closed_at": null,
  "closed_by": null,
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
  "author": {
    "name": "Vivian Hermann",
    "username": "orville",
    "id": 11,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/5224fd70153710e92fb8bcf79ac29d67?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/orville"
  },
  "subscribed": false,
  "due_date": null,
  "web_url": "http://example.com/example/example/issues/12",
  "confidential": false,
  "discussion_locked": false
}
```

889 890
## Create a todo

891
Manually creates a todo for the current user on an issue. If
892 893 894 895
there already exists a todo for the user on that issue, status code `304` is
returned.

```
896
POST /projects/:id/issues/:issue_iid/todo
897 898
```

899
| Attribute   | Type    | Required | Description                          |
900
|-------------|---------|----------|--------------------------------------|
901
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
902
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
903 904

```bash
905
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/todo
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925
```

Example response:

```json
{
  "id": 112,
  "project": {
    "id": 5,
    "name": "Gitlab Ci",
    "name_with_namespace": "Gitlab Org / Gitlab Ci",
    "path": "gitlab-ci",
    "path_with_namespace": "gitlab-org/gitlab-ci"
  },
  "author": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
926
    "web_url": "https://gitlab.example.com/root"
927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950
  },
  "action_name": "marked",
  "target_type": "Issue",
  "target": {
    "id": 93,
    "iid": 10,
    "project_id": 5,
    "title": "Vel voluptas atque dicta mollitia adipisci qui at.",
    "description": "Tempora laboriosam sint magni sed voluptas similique.",
    "state": "closed",
    "created_at": "2016-06-17T07:47:39.486Z",
    "updated_at": "2016-07-01T11:09:13.998Z",
    "labels": [],
    "milestone": {
      "id": 26,
      "iid": 1,
      "project_id": 5,
      "title": "v0.0",
      "description": "Accusantium nostrum rerum quae quia quis nesciunt suscipit id.",
      "state": "closed",
      "created_at": "2016-06-17T07:47:33.832Z",
      "updated_at": "2016-06-17T07:47:33.832Z",
      "due_date": null
    },
951 952 953 954 955 956 957 958
    "assignees": [{
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/francisca"
    }],
959 960 961 962 963 964
    "assignee": {
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
965
      "web_url": "https://gitlab.example.com/francisca"
966 967 968 969 970 971 972
    },
    "author": {
      "name": "Maxie Medhurst",
      "username": "craig_rutherford",
      "id": 12,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
973
      "web_url": "https://gitlab.example.com/craig_rutherford"
974 975 976 977
    },
    "subscribed": true,
    "user_notes_count": 7,
    "upvotes": 0,
978 979
    "downvotes": 0,
    "due_date": null,
980
    "web_url": "http://example.com/example/example/issues/110",
981 982
    "confidential": false,
    "discussion_locked": false
983 984 985 986 987 988 989 990
  },
  "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/issues/10",
  "body": "Vel voluptas atque dicta mollitia adipisci qui at.",
  "state": "pending",
  "created_at": "2016-07-01T11:09:13.992Z"
}
```

991
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
992

haseeb's avatar
haseeb committed
993 994 995

**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

996 997 998 999 1000
## Set a time estimate for an issue

Sets an estimated time of work for this issue.

```
1001
POST /projects/:id/issues/:issue_iid/time_estimate
1002 1003
```

1004
| Attribute   | Type    | Required | Description                              |
1005
|-------------|---------|----------|------------------------------------------|
1006
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1007 1008
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1009 1010

```bash
1011
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029
```

Example response:

```json
{
  "human_time_estimate": "3h 30m",
  "human_total_time_spent": null,
  "time_estimate": 12600,
  "total_time_spent": 0
}
```

## Reset the time estimate for an issue

Resets the estimated time for this issue to 0 seconds.

```
1030
POST /projects/:id/issues/:issue_iid/reset_time_estimate
1031 1032
```

1033
| Attribute   | Type    | Required | Description                          |
1034
|-------------|---------|----------|--------------------------------------|
1035
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1036
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1037 1038

```bash
1039
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": null,
  "time_estimate": 0,
  "total_time_spent": 0
}
```

## Add spent time for an issue

Adds spent time for this issue

```
1058
POST /projects/:id/issues/:issue_iid/add_spent_time
1059 1060
```

1061
| Attribute   | Type    | Required | Description                              |
1062
|-------------|---------|----------|------------------------------------------|
1063
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1064 1065
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1066 1067

```bash
1068
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": "1h",
  "time_estimate": 0,
  "total_time_spent": 3600
}
```

## Reset spent time for an issue

Resets the total spent time for this issue to 0 seconds.

```
1087
POST /projects/:id/issues/:issue_iid/reset_spent_time
1088 1089
```

1090
| Attribute   | Type    | Required | Description                          |
1091
|-------------|---------|----------|--------------------------------------|
1092
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
1093
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1094 1095

```bash
1096
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": null,
  "time_estimate": 0,
  "total_time_spent": 0
}
```

## Get time tracking stats

```
1113
GET /projects/:id/issues/:issue_iid/time_stats
1114 1115
```

1116
| Attribute   | Type    | Required | Description                          |
1117
|-------------|---------|----------|--------------------------------------|
1118
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1119
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1120 1121

```bash
1122
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats
1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
```

Example response:

```json
{
  "human_time_estimate": "2h",
  "human_total_time_spent": "1h",
  "time_estimate": 7200,
  "total_time_spent": 3600
}
```

1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
## List merge requests related to issue

Get all the merge requests that are related to the issue.

```
GET /projects/:id/issues/:issue_id/related_merge_requests
```

| Attribute   | Type    | Required | Description                          |
|-------------|---------|----------|--------------------------------------|
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
| `issue_iid` | integer | yes      | The internal ID of a project's issue |

```sh
1150
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222
```

Example response:

```json
[
  {
    "id": 29,
    "iid": 11,
    "project_id": 1,
    "title": "Provident eius eos blanditiis consequatur neque odit.",
    "description": "Ut consequatur ipsa aspernatur quisquam voluptatum fugit. Qui harum corporis quo fuga ut incidunt veritatis. Autem necessitatibus et harum occaecati nihil ea.\r\n\r\ntwitter/flight#8",
    "state": "opened",
    "created_at": "2018-09-18T14:36:15.510Z",
    "updated_at": "2018-09-19T07:45:13.089Z",
    "target_branch": "v2.x",
    "source_branch": "so_long_jquery",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "id": 14,
      "name": "Verna Hills",
      "username": "lawanda_reinger",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/de68a91aeab1cff563795fb98a0c2cc0?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/lawanda_reinger"
    },
    "assignee": {
      "id": 19,
      "name": "Jody Baumbach",
      "username": "felipa.kuvalis",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/felipa.kuvalis"
    },
    "source_project_id": 1,
    "target_project_id": 1,
    "labels": [],
    "work_in_progress": false,
    "milestone": {
      "id": 27,
      "iid": 2,
      "project_id": 1,
      "title": "v1.0",
      "description": "Et tenetur voluptatem minima doloribus vero dignissimos vitae.",
      "state": "active",
      "created_at": "2018-09-18T14:35:44.353Z",
      "updated_at": "2018-09-18T14:35:44.353Z",
      "due_date": null,
      "start_date": null,
      "web_url": "https://gitlab.example.com/twitter/flight/milestones/2"
    },
    "merge_when_pipeline_succeeds": false,
    "merge_status": "cannot_be_merged",
    "sha": "3b7b528e9353295c1c125dad281ac5b5deae5f12",
    "merge_commit_sha": null,
    "user_notes_count": 9,
    "discussion_locked": null,
    "should_remove_source_branch": null,
    "force_remove_source_branch": false,
    "web_url": "https://gitlab.example.com/twitter/flight/merge_requests/4",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    },
    "squash": false
  }
]
```

1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
## List merge requests that will close issue on merge

Get all the merge requests that will close issue when merged.

```
GET /projects/:id/issues/:issue_iid/closed_by
```

| Attribute   | Type    | Required | Description                          |
| ---------   | ----    | -------- | -----------                          |
| `id`        | integer | yes      | The ID of a project                  |
| `issue_iid` | integer | yes      | The internal ID of a project issue   |

```bash
1237
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267
```

Example response:

```json
[
  {
    "id": 6471,
    "iid": 6432,
    "project_id": 1,
    "title": "add a test for cgi lexer options",
    "description": "closes #11",
    "state": "opened",
    "created_at": "2017-04-06T18:33:34.168Z",
    "updated_at": "2017-04-09T20:10:24.983Z",
    "target_branch": "master",
    "source_branch": "feature.custom-highlighting",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "name": "Administrator",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/root"
    },
    "assignee": null,
    "source_project_id": 1,
    "target_project_id": 1,
haseeb's avatar
haseeb committed
1268 1269
    "closed_at": null,
    "closed_by": null,
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
    "labels": [],
    "work_in_progress": false,
    "milestone": null,
    "merge_when_pipeline_succeeds": false,
    "merge_status": "unchecked",
    "sha": "5a62481d563af92b8e32d735f2fa63b94e806835",
    "merge_commit_sha": null,
    "user_notes_count": 1,
    "should_remove_source_branch": null,
    "force_remove_source_branch": false,
1280 1281 1282 1283 1284 1285 1286
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/merge_requests/6432",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
1287
  }
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303
]
```


## Participants on issues

```
GET /projects/:id/issues/:issue_iid/participants
```

| Attribute   | Type    | Required | Description                          |
|-------------|---------|----------|--------------------------------------|
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
| `issue_iid` | integer | yes      | The internal ID of a project's issue |

```bash
1304
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/participants
1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326
```

Example response:

```json
[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://localhost/user1"
  },
  {
    "id": 5,
    "name": "John Doe5",
    "username": "user5",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon",
    "web_url": "http://localhost/user5"
  }
1327 1328 1329 1330
]
```


1331 1332
## Comments on issues

1333
Comments are done via the [notes](notes.md) resource.
James Lopez's avatar
James Lopez committed
1334 1335 1336

## Get user agent details

James Lopez's avatar
James Lopez committed
1337 1338
Available only for admins.

James Lopez's avatar
James Lopez committed
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
```
GET /projects/:id/issues/:issue_iid/user_agent_detail
```

| Attribute   | Type    | Required | Description                          |
|-------------|---------|----------|--------------------------------------|
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
| `issue_iid` | integer | yes      | The internal ID of a project's issue |

```bash
1349
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail
James Lopez's avatar
James Lopez committed
1350 1351 1352 1353 1354 1355 1356 1357
```

Example response:

```json
{
  "user_agent": "AppleWebKit/537.36",
  "ip_address": "127.0.0.1",
1358
  "akismet_submitted": false
James Lopez's avatar
James Lopez committed
1359 1360
}
```
1361 1362

[ce-13004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13004
Hiroyuki Sato's avatar
Hiroyuki Sato committed
1363
[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016
haseeb's avatar
haseeb committed
1364
[ce-17042]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042
1365
[ce-18935]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18935