projects.md 85.4 KB
Newer Older
1
# Projects API
2

3
## Project visibility level
4

5 6
Project in GitLab can be either private, internal or public.
This is determined by the `visibility` field in the project.
7

8
Values for the project visibility level are:
9

10
- `private`:
11 12
  Project access must be granted explicitly for each user.

13
- `internal`:
14
  The project can be cloned by any logged in user.
15

16
- `public`:
17
  The project can be accessed without any authentication.
18

19 20 21 22
## Project merge method

There are currently three options for `merge_method` to choose from:

23
- `merge`:
24 25
  A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.

26
- `rebase_merge`:
27 28 29
  A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible.
  This way you could make sure that if this merge request would build, after merging to target branch it would also build.

30
- `ff`:
31 32
  No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.

33
## List all projects
N
Nihad Abbasov 已提交
34

35
Get a list of all visible projects across GitLab for the authenticated user.
36
When accessed without authentication, only public projects with "simple" fields are returned.
N
Nihad Abbasov 已提交
37 38 39 40 41

```
GET /projects
```

42 43
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
44 45 46 47 48 49 50 51 52 53 54 55
| `archived`                    | boolean | no | Limit by archived status |
| `visibility`                  | string  | no | Limit by visibility `public`, `internal`, or `private` |
| `order_by`                    | string  | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at` |
| `sort`                        | string  | no | Return projects sorted in `asc` or `desc` order. Default is `desc` |
| `search`                      | string  | no | Return list of projects matching the search criteria |
| `simple`                      | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
| `owned`                       | boolean | no | Limit by projects explicitly owned by the current user |
| `membership`                  | boolean | no | Limit by projects that the current user is a member of |
| `starred`                     | boolean | no | Limit by projects starred by the current user |
| `statistics`                  | boolean | no | Include project statistics |
| `with_custom_attributes`      | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
| `with_issues_enabled`         | boolean | no | Limit by enabled issues feature |
56
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
57
| `with_programming_language`   | string  | no | Limit by projects which use the given programming language |
58 59
| `wiki_checksum_failed`        | boolean | no | **(PREMIUM)** Limit projects where the wiki checksum calculation has failed ([Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/6137) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.2) |
| `repository_checksum_failed`  | boolean | no | **(PREMIUM)** Limit projects where the repository checksum calculation has failed ([Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/6137) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.2) |
60
| `min_access_level`            | integer | no | Limit by current user minimal [access level](members.md) |
61 62
| `id_after`                    | integer | no | Limit results to projects with IDs greater than the specified ID |
| `id_before`                   | integer | no | Limit results to projects with IDs less than the specified ID |
V
vanadium23 已提交
63

64 65 66
NOTE: **Note:**
This endpoint supports [keyset pagination](README.md#keyset-based-pagination) for selected `order_by` options.

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
When `simple=true` or the user is unauthenticated this returns something like:

```json
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
    "tag_list": [
      "example",
      "disapora client"
    ],
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "forks_count": 0,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "star_count": 0,
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
...
```

When the user is authenticated and `simple` is not set this returns something like:

V
vanadium23 已提交
102 103 104 105 106 107 108 109 110 111
```json
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
I
Imre Farkas 已提交
112
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
V
vanadium23 已提交
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    "tag_list": [
      "example",
      "disapora client"
    ],
    "owner": {
      "id": 3,
      "name": "Diaspora",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
132
    "resolve_outdated_diff_discussions": false,
V
vanadium23 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora"
    },
    "import_status": "none",
    "archived": false,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
151
    "ci_default_git_depth": 50,
V
vanadium23 已提交
152 153 154 155
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
156
    "remove_source_branch_after_merge": false,
V
vanadium23 已提交
157
    "request_access_enabled": false,
158
    "merge_method": "merge",
V
vanadium23 已提交
159 160 161 162
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
163
      "wiki_size" : 0,
V
vanadium23 已提交
164
      "lfs_objects_size": 0,
165 166
      "job_artifacts_size": 0,
      "packages_size": 0
167 168 169 170 171 172 173 174 175 176
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    },
V
vanadium23 已提交
177 178 179 180 181 182 183 184 185
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
I
Imre Farkas 已提交
186
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
V
vanadium23 已提交
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
    "tag_list": [
      "example",
      "puppet"
    ],
    "owner": {
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
206
    "resolve_outdated_diff_discussions": false,
V
vanadium23 已提交
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
      "kind": "group",
      "full_path": "brightbox"
    },
    "import_status": "none",
    "import_error": null,
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
    "archived": false,
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
236
    "ci_default_git_depth": 0,
V
vanadium23 已提交
237 238 239 240
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
241
    "remove_source_branch_after_merge": false,
V
vanadium23 已提交
242
    "request_access_enabled": false,
243
    "merge_method": "merge",
244 245 246 247 248 249 250 251 252 253 254 255 256
    "auto_devops_enabled": true,
    "auto_devops_deploy_strategy": "continuous",
    "repository_storage": "default",
    "approvals_before_merge": 0,
    "mirror": false,
    "mirror_user_id": 45,
    "mirror_trigger_builds": false,
    "only_mirror_protected_branches": false,
    "mirror_overwrites_diverged_branches": false,
    "external_authorization_classification_label": null,
    "packages_enabled": true,
    "service_desk_enabled": false,
    "service_desk_address": null,
V
vanadium23 已提交
257 258 259 260
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
261
      "wiki_size" : 0,
V
vanadium23 已提交
262
      "lfs_objects_size": 0,
263 264
      "job_artifacts_size": 0,
      "packages_size": 0
265 266 267 268 269 270 271 272 273
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
V
vanadium23 已提交
274 275 276 277 278
    }
  }
]
```

279 280 281 282 283 284 285 286 287 288 289 290 291 292
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
the `approvals_before_merge` parameter:

```json
[
  {
    "id": 4,
    "description": null,
    "approvals_before_merge": 0,
    ...
  }
]
```

293 294 295 296 297 298
You can filter by [custom attributes](custom_attributes.md) with:

```
GET /projects?custom_attributes[key]=value&custom_attributes[other_key]=other_value
```

299
## List user projects
V
vanadium23 已提交
300

D
Davin Walker 已提交
301
Get a list of visible projects owned by the given user. When accessed without authentication, only public projects are returned.
V
vanadium23 已提交
302 303 304 305 306 307 308 309 310 311 312 313 314

```
GET /users/:user_id/projects
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `user_id` | string | yes | The ID or username of the user |
| `archived` | boolean | no | Limit by archived status |
| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private` |
| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at` |
| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc` |
| `search` | string | no | Return list of projects matching the search criteria |
315
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
316
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
V
vanadium23 已提交
317 318 319
| `membership` | boolean | no | Limit by projects that the current user is a member of |
| `starred` | boolean | no | Limit by projects starred by the current user |
| `statistics` | boolean | no | Include project statistics |
320
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
321 322
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
323
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
324
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
325 326
| `id_after`                    | integer | no | Limit results to projects with IDs greater than the specified ID |
| `id_before`                   | integer | no | Limit results to projects with IDs less than the specified ID |
327

328 329 330
NOTE: **Note:**
This endpoint supports [keyset pagination](README.md#keyset-based-pagination) for selected `order_by` options.

N
Nihad Abbasov 已提交
331 332 333
```json
[
  {
M
Marin Jankovski 已提交
334
    "id": 4,
N
Nihad Abbasov 已提交
335 336
    "description": null,
    "default_branch": "master",
337
    "visibility": "private",
M
Marin Jankovski 已提交
338 339 340
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
I
Imre Farkas 已提交
341
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
342 343 344 345
    "tag_list": [
      "example",
      "disapora client"
    ],
N
Nihad Abbasov 已提交
346
    "owner": {
M
Marin Jankovski 已提交
347 348
      "id": 3,
      "name": "Diaspora",
B
Ben Boeckel 已提交
349
      "created_at": "2013-09-30T13:46:02Z"
N
Nihad Abbasov 已提交
350
    },
M
Marin Jankovski 已提交
351 352 353 354 355
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
S
Stan Hu 已提交
356
    "open_issues_count": 1,
M
Marin Jankovski 已提交
357
    "merge_requests_enabled": true,
358
    "jobs_enabled": true,
N
Nihad Abbasov 已提交
359
    "wiki_enabled": true,
M
Marin Jankovski 已提交
360
    "snippets_enabled": false,
361
    "resolve_outdated_diff_discussions": false,
362
    "container_registry_enabled": false,
B
Ben Boeckel 已提交
363 364
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
365
    "creator_id": 3,
M
Marin Jankovski 已提交
366 367 368 369
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
370 371
      "kind": "group",
      "full_path": "diaspora"
372
    },
373
    "import_status": "none",
S
sue445 已提交
374
    "archived": false,
T
Tomasz Maczukin 已提交
375 376 377
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
378 379
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
380
    "ci_default_git_depth": 50,
381
    "public_jobs": true,
382
    "shared_with_groups": [],
J
James Lopez 已提交
383
    "only_allow_merge_if_pipeline_succeeds": false,
384
    "only_allow_merge_if_all_discussions_are_resolved": false,
385
    "remove_source_branch_after_merge": false,
386
    "request_access_enabled": false,
387
    "merge_method": "merge",
388 389 390 391
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
392
      "wiki_size" : 0,
393
      "lfs_objects_size": 0,
394 395
      "job_artifacts_size": 0,
      "packages_size": 0
396 397 398 399 400 401 402 403 404
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
405
    }
N
Nihad Abbasov 已提交
406 407
  },
  {
M
Marin Jankovski 已提交
408
    "id": 6,
N
Nihad Abbasov 已提交
409
    "description": null,
M
Marin Jankovski 已提交
410
    "default_branch": "master",
411
    "visibility": "private",
M
Marin Jankovski 已提交
412 413 414
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
I
Imre Farkas 已提交
415
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
416 417 418 419
    "tag_list": [
      "example",
      "puppet"
    ],
J
Johannes Schleifenbaum 已提交
420
    "owner": {
M
Marin Jankovski 已提交
421 422 423
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
N
Nihad Abbasov 已提交
424
    },
M
Marin Jankovski 已提交
425 426 427 428
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
N
Nihad Abbasov 已提交
429
    "issues_enabled": true,
S
Stan Hu 已提交
430
    "open_issues_count": 1,
N
Nihad Abbasov 已提交
431
    "merge_requests_enabled": true,
432
    "jobs_enabled": true,
N
Nihad Abbasov 已提交
433
    "wiki_enabled": true,
M
Marin Jankovski 已提交
434
    "snippets_enabled": false,
435
    "resolve_outdated_diff_discussions": false,
436
    "container_registry_enabled": false,
M
Marin Jankovski 已提交
437 438
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
439
    "creator_id": 3,
J
Johannes Schleifenbaum 已提交
440
    "namespace": {
M
Marin Jankovski 已提交
441 442 443
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
444 445
      "kind": "group",
      "full_path": "brightbox"
446
    },
447 448
    "import_status": "none",
    "import_error": null,
449 450 451 452 453 454 455 456 457 458
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
S
sue445 已提交
459
    "archived": false,
T
Tomasz Maczukin 已提交
460 461 462 463
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
464
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
465
    "ci_default_git_depth": 0,
466
    "public_jobs": true,
467
    "shared_with_groups": [],
J
James Lopez 已提交
468
    "only_allow_merge_if_pipeline_succeeds": false,
469
    "only_allow_merge_if_all_discussions_are_resolved": false,
470
    "remove_source_branch_after_merge": false,
471
    "request_access_enabled": false,
472
    "merge_method": "merge",
473 474 475 476 477 478 479 480 481 482 483 484 485
    "auto_devops_enabled": true,
    "auto_devops_deploy_strategy": "continuous",
    "repository_storage": "default",
    "approvals_before_merge": 0,
    "mirror": false,
    "mirror_user_id": 45,
    "mirror_trigger_builds": false,
    "only_mirror_protected_branches": false,
    "mirror_overwrites_diverged_branches": false,
    "external_authorization_classification_label": null,
    "packages_enabled": true,
    "service_desk_enabled": false,
    "service_desk_address": null,
486 487 488 489
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
490
      "wiki_size" : 0,
491
      "lfs_objects_size": 0,
492 493
      "job_artifacts_size": 0,
      "packages_size": 0
494 495 496 497 498 499 500 501 502
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
503
    }
504 505 506 507
  }
]
```

508 509 510 511 512 513 514 515 516 517
## List projects starred by a user

Get a list of visible projects owned by the given user. When accessed without authentication, only public projects are returned.

```
GET /users/:user_id/starred_projects
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
C
Camil Staps 已提交
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
| `user_id` | string | yes | The ID or username of the user. |
| `archived` | boolean | no | Limit by archived status. |
| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private`. |
| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at`. |
| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc`. |
| `search` | string | no | Return list of projects matching the search criteria. |
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned.. |
| `owned` | boolean | no | Limit by projects explicitly owned by the current user. |
| `membership` | boolean | no | Limit by projects that the current user is a member of. |
| `starred` | boolean | no | Limit by projects starred by the current user. |
| `statistics` | boolean | no | Include project statistics. |
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only). |
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature. |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature. |
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md). |

```bash
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/5/starred_projects"
```

Example response:
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592

```json
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
    "tag_list": [
      "example",
      "disapora client"
    ],
    "owner": {
      "id": 3,
      "name": "Diaspora",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora"
    },
    "import_status": "none",
    "archived": false,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
593
    "remove_source_branch_after_merge": false,
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674
    "request_access_enabled": false,
    "merge_method": "merge",
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    }
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
    "tag_list": [
      "example",
      "puppet"
    ],
    "owner": {
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
      "kind": "group",
      "full_path": "brightbox"
    },
    "import_status": "none",
    "import_error": null,
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
    "archived": false,
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
675
    "remove_source_branch_after_merge": false,
676 677
    "request_access_enabled": false,
    "merge_method": "merge",
678 679 680 681 682 683 684 685 686 687 688 689 690
    "auto_devops_enabled": true,
    "auto_devops_deploy_strategy": "continuous",
    "repository_storage": "default",
    "approvals_before_merge": 0,
    "mirror": false,
    "mirror_user_id": 45,
    "mirror_trigger_builds": false,
    "only_mirror_protected_branches": false,
    "mirror_overwrites_diverged_branches": false,
    "external_authorization_classification_label": null,
    "packages_enabled": true,
    "service_desk_enabled": false,
    "service_desk_address": null,
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0
    },
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    }
  }
]
```

711
## Get single project
N
Nihad Abbasov 已提交
712

713 714
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
N
Nihad Abbasov 已提交
715 716 717 718 719

```
GET /projects/:id
```

720 721
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
722
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
723
| `statistics` | boolean | no | Include project statistics |
J
J.D. Bean 已提交
724
| `license` | boolean | no | Include project license data |
725
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
N
Nihad Abbasov 已提交
726

A
Alex Denisov 已提交
727 728
```json
{
729 730
  "id": 3,
  "description": null,
M
Marin Jankovski 已提交
731
  "default_branch": "master",
732 733 734 735 736
  "visibility": "private",
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
737
  "tag_list": [
738 739
    "example",
    "disapora project"
740
  ],
741 742 743 744
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
745
  },
746 747 748 749
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
750
  "issues_enabled": true,
751
  "open_issues_count": 1,
752 753
  "merge_requests_enabled": true,
  "jobs_enabled": true,
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
  "wiki_enabled": true,
  "snippets_enabled": false,
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": false,
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
    "kind": "group",
    "full_path": "diaspora",
    "avatar_url": "http://localhost:3000/uploads/group/avatar/3/foo.jpg",
    "web_url": "http://localhost:3000/groups/diaspora"
  },
770 771
  "import_status": "none",
  "import_error": null,
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
796
  "ci_default_git_depth": 50,
797
  "public_jobs": true,
798
  "shared_with_groups": [
799 800 801 802 803 804
    {
      "group_id": 4,
      "group_name": "Twitter",
      "group_full_path": "twitter",
      "group_access_level": 30
    },
805 806
    {
      "group_id": 3,
807 808 809
      "group_name": "Gitlab Org",
      "group_full_path": "gitlab-org",
      "group_access_level": 10
810
    }
811
  ],
812
  "repository_storage": "default",
J
James Lopez 已提交
813
  "only_allow_merge_if_pipeline_succeeds": false,
814
  "only_allow_merge_if_all_discussions_are_resolved": false,
815
  "remove_source_branch_after_merge": false,
816 817
  "printing_merge_requests_link_enabled": true,
  "request_access_enabled": false,
818
  "merge_method": "merge",
819 820 821 822 823 824 825 826 827 828 829 830 831
  "auto_devops_enabled": true,
  "auto_devops_deploy_strategy": "continuous",
  "repository_storage": "default",
  "approvals_before_merge": 0,
  "mirror": false,
  "mirror_user_id": 45,
  "mirror_trigger_builds": false,
  "only_mirror_protected_branches": false,
  "mirror_overwrites_diverged_branches": false,
  "external_authorization_classification_label": null,
  "packages_enabled": true,
  "service_desk_enabled": false,
  "service_desk_address": null,
832 833 834 835
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
836
    "wiki_size" : 0,
837
    "lfs_objects_size": 0,
838 839
    "job_artifacts_size": 0,
    "packages_size": 0
840 841 842 843 844 845 846 847 848
  },
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
849
  }
A
Alex Denisov 已提交
850 851 852
}
```

853 854 855 856 857 858 859 860 861 862 863 864
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
the `approvals_before_merge` parameter:

```json
{
  "id": 3,
  "description": null,
  "approvals_before_merge": 0,
  ...
}
```

865 866
**Note**: The `web_url` and `avatar_url` attributes on `namespace` were [introduced][ce-27427] in GitLab 11.11.

867 868 869 870 871 872 873 874 875 876 877 878 879 880
If the project is a fork, and you provide a valid token to authenticate, the
`forked_from_project` field will appear in the response.

```json
{
   "id":3,

   ...

   "forked_from_project":{
      "id":13083,
      "description":"GitLab Community Edition",
      "name":"GitLab Community Edition",
      "name_with_namespace":"GitLab.org / GitLab Community Edition",
881 882
      "path":"gitlab-foss",
      "path_with_namespace":"gitlab-org/gitlab-foss",
883 884 885
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"master",
      "tag_list":[],
886
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git",
887 888
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-foss",
889
      "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
890
      "license_url": "https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE",
J
J.D. Bean 已提交
891 892 893 894 895 896 897
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT",
      },
898 899
      "star_count":3812,
      "forks_count":3561,
900 901 902 903 904 905 906 907 908
      "last_activity_at":"2018-01-02T11:40:26.570Z",
      "namespace": {
            "id": 72,
            "name": "GitLab.org",
            "path": "gitlab-org",
            "kind": "group",
            "full_path": "gitlab-org",
            "parent_id": null
      }
909 910 911 912 913 914 915
   }

   ...

}
```

916
## Get project users
D
Dmitriy Zaporozhets 已提交
917

918
Get the users list of a project.
D
Dmitriy Zaporozhets 已提交
919

920 921 922
```
GET /projects/:id/users
```
D
Dmitriy Zaporozhets 已提交
923

924 925 926 927
| Attribute    | Type          | Required | Description |
| ------------ | ------------- | -------- | ----------- |
| `search`     | string        | no       | Search for specific users |
| `skip_users` | integer array | no       | Filter out users with the specified IDs |
928

D
Dmitriy Zaporozhets 已提交
929
```json
J
Johannes Schleifenbaum 已提交
930 931
[
  {
932 933 934 935 936 937
    "id": 1,
    "username": "john_smith",
    "name": "John Smith",
    "state": "active",
    "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
    "web_url": "http://localhost:3000/john_smith"
D
Dmitriy Zaporozhets 已提交
938
  },
J
Johannes Schleifenbaum 已提交
939
  {
940 941 942 943 944 945
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
    "web_url": "http://localhost:3000/jack_smith"
J
Johannes Schleifenbaum 已提交
946 947
  }
]
D
Dmitriy Zaporozhets 已提交
948 949
```

950
## Get project events
D
Dmitriy Zaporozhets 已提交
951

952
Please refer to the [Events API documentation](events.md#list-a-projects-visible-events).
D
Dmitriy Zaporozhets 已提交
953

954
## Create project
A
Alex Denisov 已提交
955

956
Creates a new project owned by the authenticated user.
A
Alex Denisov 已提交
957 958 959 960 961

```
POST /projects
```

962 963
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
964 965
| `name` | string | yes if path is not provided | The name of the new project. Equals path if not provided. |
| `path` | string | yes if name is not provided | Repository name for new project. Generated based on name if not provided (generated lowercased with dashes). |
966
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
967
| `default_branch` | string | no | `master` by default |
968
| `description` | string | no | Short project description |
969 970 971 972 973 974 975 976 977 978 979
| `issues_enabled` | boolean | no | (deprecated) Enable issues for this project. Use `issues_access_level` instead |
| `merge_requests_enabled` | boolean | no | (deprecated) Enable merge requests for this project. Use `merge_requests_access_level` instead |
| `jobs_enabled` | boolean | no | (deprecated) Enable jobs for this project. Use `builds_access_level` instead |
| `wiki_enabled` | boolean | no | (deprecated) Enable wiki for this project. Use `wiki_access_level` instead |
| `snippets_enabled` | boolean | no | (deprecated) Enable snippets for this project. Use `snippets_access_level` instead |
| `issues_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `repository_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `merge_requests_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `builds_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
980
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
981 982
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
983
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
984
| `import_url` | string | no | URL to import repository from |
985
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
986
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
987
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
988
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
989
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
990 991
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
992
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
993
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
994
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
995
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
996
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
997
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
998
| `build_coverage_regex` | string | no | Test coverage parsing |
999
| `ci_config_path` | string | no | The path to CI config file |
1000 1001
| `auto_devops_enabled` | boolean | no | Enable Auto DevOps for this project |
| `auto_devops_deploy_strategy` | string | no | Auto Deploy strategy (`continuous`, `manual` or `timed_incremental`) |
1002
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1003
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1004
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1005 1006
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
S
Steve 已提交
1007
| `initialize_with_readme` | boolean | no | `false` by default |
1008
| `template_name` | string | no | When used without `use_custom_template`, name of a [built-in project template](../gitlab-basics/create-project.md#built-in-templates). When used with `use_custom_template`, name of a custom project template |
1009
| `template_project_id` | integer | no | **(PREMIUM)** When used with `use_custom_template`, project ID of a custom project template. This is preferable to using `template_name` since `template_name` may be ambiguous. |
1010 1011
| `use_custom_template` | boolean | no | **(PREMIUM)** Use either custom [instance](../user/admin_area/custom_project_templates.md) or [group](../user/group/custom_project_templates.md) (with `group_with_project_templates_id`) project template |
| `group_with_project_templates_id` | integer | no | **(PREMIUM)** For group-level custom templates, specifies ID of group from which all the custom project templates are sourced. Leave empty for instance-level templates. Requires `use_custom_template` to be true |
1012
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1013

1014
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1015 1016 1017
add authentication information to the URL: `https://username:password@gitlab.company.com/group/project.git`
where `password` is a public access key with the `api` scope enabled.

1018
## Create project for user
1019

1020
Creates a new project owned by the specified user. Available only for admins.
1021 1022 1023 1024 1025

```
POST /projects/user/:user_id
```

1026 1027 1028 1029 1030 1031 1032
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `user_id` | integer | yes | The user ID of the project owner |
| `name` | string | yes | The name of the new project |
| `path` | string | no | Custom repository name for new project. By default generated based on name |
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
| `description` | string | no | Short project description |
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
| `issues_enabled` | boolean | no | (deprecated) Enable issues for this project. Use `issues_access_level` instead |
| `merge_requests_enabled` | boolean | no | (deprecated) Enable merge requests for this project. Use `merge_requests_access_level` instead |
| `jobs_enabled` | boolean | no | (deprecated) Enable jobs for this project. Use `builds_access_level` instead |
| `wiki_enabled` | boolean | no | (deprecated) Enable wiki for this project. Use `wiki_access_level` instead |
| `snippets_enabled` | boolean | no | (deprecated) Enable snippets for this project. Use `snippets_access_level` instead |
| `issues_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `repository_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `merge_requests_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `builds_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
1044
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1045 1046
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1047
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1048
| `import_url` | string | no | URL to import repository from |
1049
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1050
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1051
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1052
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1053
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1054 1055
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
1056
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1057
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1058
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
1059
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1060
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1061
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1062
| `build_coverage_regex` | string | no | Test coverage parsing |
1063
| `ci_config_path` | string | no | The path to CI config file |
1064 1065
| `auto_devops_enabled` | boolean | no | Enable Auto DevOps for this project |
| `auto_devops_deploy_strategy` | string | no | Auto Deploy strategy (`continuous`, `manual` or `timed_incremental`) |
1066
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1067
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1068
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1069 1070
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
1071
| `initialize_with_readme` | boolean | no | `false` by default |
1072 1073 1074
| `template_name` | string | no | When used without `use_custom_template`, name of a [built-in project template](../gitlab-basics/create-project.md#built-in-templates). When used with `use_custom_template`, name of a custom project template |
| `use_custom_template` | boolean | no | **(PREMIUM)** Use either custom [instance](../user/admin_area/custom_project_templates.md) or [group](../user/group/custom_project_templates.md) (with `group_with_project_templates_id`) project template |
| `group_with_project_templates_id` | integer | no | **(PREMIUM)** For group-level custom templates, specifies ID of group from which all the custom project templates are sourced. Leave empty for instance-level templates. Requires `use_custom_template` to be true |
1075
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1076

1077
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1078 1079
add authentication information to the URL: `https://username:password@gitlab.company.com/group/project.git`
where `password` is a public access key with the `api` scope enabled.
A
Alex Denisov 已提交
1080

1081
## Edit project
1082

1083
Updates an existing project.
1084 1085 1086 1087 1088

```
PUT /projects/:id
```

1089 1090
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1091
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1092
| `name` | string | no | The name of the project |
1093
| `path` | string | no | Custom repository name for the project. By default generated based on name |
1094
| `default_branch` | string | no | `master` by default |
1095
| `description` | string | no | Short project description |
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
| `issues_enabled` | boolean | no | (deprecated) Enable issues for this project. Use `issues_access_level` instead |
| `merge_requests_enabled` | boolean | no | (deprecated) Enable merge requests for this project. Use `merge_requests_access_level` instead |
| `jobs_enabled` | boolean | no | (deprecated) Enable jobs for this project. Use `builds_access_level` instead |
| `wiki_enabled` | boolean | no | (deprecated) Enable wiki for this project. Use `wiki_access_level` instead |
| `snippets_enabled` | boolean | no | (deprecated) Enable snippets for this project. Use `snippets_access_level` instead |
| `issues_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `repository_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `merge_requests_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `builds_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `wiki_access_level` | string | no | One of `disabled`, `private` or `enabled` |
| `snippets_access_level` | string | no | One of `disabled`, `private` or `enabled` |
1107
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1108 1109
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1110
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1111
| `import_url` | string | no | URL to import repository from |
1112
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1113
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1114
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1115
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1116
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1117 1118
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
1119
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1120
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1121
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1122
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1123
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1124
| `build_coverage_regex` | string | no | Test coverage parsing |
1125
| `ci_config_path` | string | no | The path to CI config file |
1126
| `ci_default_git_depth` | integer | no | Default number of revisions for [shallow cloning](../user/project/pipelines/settings.md#git-shallow-clone) |
1127 1128
| `auto_devops_enabled` | boolean | no | Enable Auto DevOps for this project |
| `auto_devops_deploy_strategy` | string | no | Auto Deploy strategy (`continuous`, `manual` or `timed_incremental`) |
1129
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1130
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge request by default |
1131
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1132 1133 1134 1135 1136 1137
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_user_id` | integer | no | **(STARTER)** User responsible for all the activity surrounding a pull mirror event |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
| `only_mirror_protected_branches` | boolean | no | **(STARTER)** Only mirror protected branches |
| `mirror_overwrites_diverged_branches` | boolean | no | **(STARTER)** Pull mirror overwrites diverged branches |
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1138
| `service_desk_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable service desk feature |
1139

1140
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1141 1142
add authentication information to the URL: `https://username:password@gitlab.company.com/group/project.git`
where `password` is a public access key with the `api` scope enabled.
1143

1144
## Fork project
1145

1146
Forks a project into the user namespace of the authenticated user or the one provided.
1147

1148 1149 1150
The forking operation for a project is asynchronous and is completed in a
background job. The request will return immediately. To determine whether the
fork of the project has completed, query the `import_status` for the new project.
1151

1152
```
1153
POST /projects/:id/fork
1154 1155
```

1156 1157
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1158
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1159
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
1160 1161
| `path` | string | no | The path that will be assigned to the resultant project after forking |
| `name` | string | no | The name that will be assigned to the resultant project after forking |
1162

1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
## List Forks of a project

>**Note:** This feature was introduced in GitLab 10.1

List the projects accessible to the calling user that have an established, forked relationship with the specified project

```
GET /projects/:id/forks
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
| `archived` | boolean | no | Limit by archived status |
| `visibility` | string | no | Limit by visibility `public`, `internal`, or `private` |
| `order_by` | string | no | Return projects ordered by `id`, `name`, `path`, `created_at`, `updated_at`, or `last_activity_at` fields. Default is `created_at` |
| `sort` | string | no | Return projects sorted in `asc` or `desc` order. Default is `desc` |
| `search` | string | no | Return list of projects matching the search criteria |
1181
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
1182
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
1183 1184 1185
| `membership` | boolean | no | Limit by projects that the current user is a member of |
| `starred` | boolean | no | Limit by projects starred by the current user |
| `statistics` | boolean | no | Include project statistics |
1186
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
1187 1188
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
1189
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
1190 1191

```bash
1192
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
```

Example responses:

```json
[
  {
    "id": 3,
    "description": null,
    "default_branch": "master",
    "visibility": "internal",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
    "web_url": "http://example.com/diaspora/diaspora-project-site",
I
Imre Farkas 已提交
1207
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243
    "tag_list": [
      "example",
      "disapora project"
    ],
    "name": "Diaspora Project Site",
    "name_with_namespace": "Diaspora / Diaspora Project Site",
    "path": "diaspora-project-site",
    "path_with_namespace": "diaspora/diaspora-project-site",
    "issues_enabled": true,
    "open_issues_count": 1,
    "merge_requests_enabled": true,
    "jobs_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora"
    },
    "import_status": "none",
    "archived": true,
    "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 1,
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
1244
    "remove_source_branch_after_merge": false,
1245
    "request_access_enabled": false,
1246
    "merge_method": "merge",
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259
    "_links": {
      "self": "http://example.com/api/v4/projects",
      "issues": "http://example.com/api/v4/projects/1/issues",
      "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
      "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
      "labels": "http://example.com/api/v4/projects/1/labels",
      "events": "http://example.com/api/v4/projects/1/events",
      "members": "http://example.com/api/v4/projects/1/members"
    }
  }
]
```

1260
## Star a project
1261

1262
Stars a given project. Returns status code `304` if the project is already starred.
1263 1264 1265 1266 1267 1268 1269

```
POST /projects/:id/star
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1270
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1271 1272

```bash
1273
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
1274 1275 1276 1277 1278 1279 1280 1281 1282
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1283
  "visibility": "internal",
1284 1285 1286
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
I
Imre Farkas 已提交
1287
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298
  "tag_list": [
    "example",
    "disapora project"
  ],
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
1299
  "jobs_enabled": true,
1300 1301
  "wiki_enabled": true,
  "snippets_enabled": false,
1302
  "resolve_outdated_diff_discussions": false,
1303
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1304 1305
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1306 1307 1308 1309 1310
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1311 1312
    "kind": "group",
    "full_path": "diaspora"
1313
  },
1314
  "import_status": "none",
1315 1316
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1317 1318 1319 1320 1321 1322 1323 1324
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1325 1326
  "shared_runners_enabled": true,
  "forks_count": 0,
1327
  "star_count": 1,
1328
  "public_jobs": true,
1329
  "shared_with_groups": [],
J
James Lopez 已提交
1330
  "only_allow_merge_if_pipeline_succeeds": false,
1331
  "only_allow_merge_if_all_discussions_are_resolved": false,
1332
  "remove_source_branch_after_merge": false,
1333
  "request_access_enabled": false,
1334
  "merge_method": "merge",
1335 1336 1337 1338 1339 1340 1341 1342 1343
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1344 1345 1346
}
```

1347
## Unstar a project
1348

1349
Unstars a given project. Returns status code `304` if the project is not starred.
1350 1351

```
1352
POST /projects/:id/unstar
1353 1354 1355 1356
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1357
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1358 1359

```bash
1360
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
1361 1362 1363 1364 1365 1366 1367 1368 1369
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1370
  "visibility": "internal",
1371 1372 1373
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
I
Imre Farkas 已提交
1374
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385
  "tag_list": [
    "example",
    "disapora project"
  ],
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
1386
  "jobs_enabled": true,
1387 1388
  "wiki_enabled": true,
  "snippets_enabled": false,
1389
  "resolve_outdated_diff_discussions": false,
1390
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1391 1392
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1393 1394 1395 1396 1397
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1398 1399
    "kind": "group",
    "full_path": "diaspora"
1400
  },
1401
  "import_status": "none",
1402 1403
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1404 1405 1406 1407 1408 1409 1410 1411
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1412 1413
  "shared_runners_enabled": true,
  "forks_count": 0,
1414
  "star_count": 0,
1415
  "public_jobs": true,
1416
  "shared_with_groups": [],
J
James Lopez 已提交
1417
  "only_allow_merge_if_pipeline_succeeds": false,
1418
  "only_allow_merge_if_all_discussions_are_resolved": false,
1419
  "remove_source_branch_after_merge": false,
1420
  "request_access_enabled": false,
1421
  "merge_method": "merge",
1422 1423 1424 1425 1426 1427 1428 1429 1430
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1431 1432 1433
}
```

1434 1435
## List Starrers of a project

C
Camil Staps 已提交
1436
List the users who starred the specified project.
1437 1438 1439 1440 1441 1442 1443

```
GET /projects/:id/starrers
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
C
Camil Staps 已提交
1444
| `search` | string | no | Search for specific users. |
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454

```bash
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/starrers"
```

Example responses:

```json
[
  {
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464
    "starred_since": "2019-01-28T14:47:30.642Z",
    "user":
      {
        "id": 1,
        "username": "jane_smith",
        "name": "Jane Smith",
        "state": "active",
        "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
        "web_url": "http://localhost:3000/jane_smith"
      }
1465
  },
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
    "starred_since": "2018-01-02T11:40:26.570Z",
    "user":
      {
        "id": 2,
        "username": "janine_smith",
        "name": "Janine Smith",
        "state": "blocked",
        "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
        "web_url": "http://localhost:3000/janine_smith"
      }
1476 1477 1478
]
```

1479 1480 1481 1482 1483 1484 1485 1486 1487
## Languages

Get languages used in a project with percentage value.

```
GET /projects/:id/languages
```

```bash
1488
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
```

Example response:

```json
{
  "Ruby": 66.69,
  "JavaScript": 22.98,
  "HTML": 7.91,
  "CoffeeScript": 2.42
}
```

1502
## Archive a project
1503

1504
Archives the project if the user is either admin or the project owner of this project. This action is
1505 1506 1507
idempotent, thus archiving an already archived project will not change the project.

```
1508
POST /projects/:id/archive
1509 1510 1511 1512
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1513
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1514 1515

```bash
1516
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
1517 1518 1519 1520 1521 1522 1523 1524 1525
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1526
  "visibility": "private",
1527 1528 1529
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
I
Imre Farkas 已提交
1530
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1531 1532 1533 1534 1535 1536 1537
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
1538
    "created_at": "2013-09-30T13:46:02Z"
1539 1540 1541 1542 1543 1544 1545 1546
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
1547
  "jobs_enabled": true,
1548 1549
  "wiki_enabled": true,
  "snippets_enabled": false,
1550
  "resolve_outdated_diff_discussions": false,
1551
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1552 1553
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1554 1555 1556 1557 1558
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1559 1560
    "kind": "group",
    "full_path": "diaspora"
1561
  },
1562 1563
  "import_status": "none",
  "import_error": null,
1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1576 1577 1578 1579 1580 1581 1582 1583
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1584 1585 1586
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1587
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1588
  "ci_default_git_depth": 50,
1589
  "public_jobs": true,
1590
  "shared_with_groups": [],
J
James Lopez 已提交
1591
  "only_allow_merge_if_pipeline_succeeds": false,
1592
  "only_allow_merge_if_all_discussions_are_resolved": false,
1593
  "remove_source_branch_after_merge": false,
1594
  "request_access_enabled": false,
1595
  "merge_method": "merge",
1596 1597 1598 1599 1600 1601 1602 1603 1604
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1605 1606 1607
}
```

1608
## Unarchive a project
1609

1610
Unarchives the project if the user is either admin or the project owner of this project. This action is
V
Ville Skyttä 已提交
1611
idempotent, thus unarchiving a non-archived project will not change the project.
1612 1613

```
S
Sergey Gnuskov 已提交
1614
POST /projects/:id/unarchive
1615 1616 1617 1618
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1619
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1620 1621

```bash
1622
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
1623 1624 1625 1626 1627 1628 1629 1630 1631
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1632
  "visibility": "private",
1633 1634 1635
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
I
Imre Farkas 已提交
1636
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1637 1638 1639 1640 1641 1642 1643
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
1644
    "created_at": "2013-09-30T13:46:02Z"
1645 1646 1647 1648 1649 1650 1651 1652
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
1653
  "jobs_enabled": true,
1654 1655
  "wiki_enabled": true,
  "snippets_enabled": false,
1656
  "resolve_outdated_diff_discussions": false,
1657
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1658 1659
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1660 1661 1662 1663 1664
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1665 1666
    "kind": "group",
    "full_path": "diaspora"
1667
  },
1668 1669
  "import_status": "none",
  "import_error": null,
1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1682 1683 1684 1685 1686 1687 1688 1689
  "license_url": "http://example.com/diaspora/diaspora-client/blob/master/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
1690 1691 1692
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1693
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1694
  "ci_default_git_depth": 50,
1695
  "public_jobs": true,
1696
  "shared_with_groups": [],
J
James Lopez 已提交
1697
  "only_allow_merge_if_pipeline_succeeds": false,
1698
  "only_allow_merge_if_all_discussions_are_resolved": false,
1699
  "remove_source_branch_after_merge": false,
1700
  "request_access_enabled": false,
1701
  "merge_method": "merge",
1702 1703 1704 1705 1706 1707 1708 1709 1710
  "_links": {
    "self": "http://example.com/api/v4/projects",
    "issues": "http://example.com/api/v4/projects/1/issues",
    "merge_requests": "http://example.com/api/v4/projects/1/merge_requests",
    "repo_branches": "http://example.com/api/v4/projects/1/repository_branches",
    "labels": "http://example.com/api/v4/projects/1/labels",
    "events": "http://example.com/api/v4/projects/1/events",
    "members": "http://example.com/api/v4/projects/1/members"
  }
1711 1712 1713
}
```

1714
## Remove project
D
Dmitriy Zaporozhets 已提交
1715

1716 1717 1718 1719 1720 1721
This endpoint either:

- Removes a project including all associated resources (issues, merge requests etc).
- From GitLab 12.6 on Premium or higher tiers, marks a project for deletion. Actual
  deletion happens after number of days specified in
  [instance settings](../user/admin_area/settings/visibility_and_access_controls.md#project-deletion-adjourned-period-premium-only).
D
Dmitriy Zaporozhets 已提交
1722 1723 1724 1725 1726

```
DELETE /projects/:id
```

1727 1728
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1729
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1730

1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742
## Restore project marked for deletion **(PREMIUM)**

Restores project marked for deletion.

```
POST /projects/:id/restore
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |

1743
## Upload a file
D
Douwe Maan 已提交
1744 1745 1746 1747 1748 1749 1750

Uploads a file to the specified project to be used in an issue or merge request description, or a comment.

```
POST /projects/:id/uploads
```

1751 1752
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1753
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1754
| `file` | string | yes | The file to be uploaded |
D
Douwe Maan 已提交
1755

1756 1757 1758 1759 1760 1761
To upload a file from your filesystem, use the `--form` argument. This causes
cURL to post data using the header `Content-Type: multipart/form-data`.
The `file=` parameter must point to a file on your filesystem and be preceded
by `@`. For example:

```bash
1762
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads
1763 1764 1765 1766
```

Returned object:

D
Douwe Maan 已提交
1767 1768 1769 1770 1771 1772 1773 1774
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

1775
>**Note**: The returned `url` is relative to the project path.
1776 1777
In Markdown contexts, the link is automatically expanded when the format in
`markdown` is used.
D
Douwe Maan 已提交
1778

1779
## Share project with group
1780 1781 1782 1783 1784 1785 1786

Allow to share project with group.

```
POST /projects/:id/share
```

1787 1788
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1789
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1790
| `group_id` | integer | yes | The ID of the group to share with |
1791
| `group_access` | integer | yes | The [permissions level](members.md) to grant the group |
1792
| `expires_at` | string | no | Share expiration date in ISO 8601 format: 2016-09-26 |
1793

1794
## Delete a shared project link within a group
1795 1796 1797 1798 1799 1800 1801 1802 1803

Unshare the project from the group. Returns `204` and no content on success.

```
DELETE /projects/:id/share/:group_id
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1804
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1805 1806 1807
| `group_id` | integer | yes | The ID of the group |

```bash
1808
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/share/17
1809 1810
```

1811 1812
## Hooks

1813 1814 1815
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

1816 1817
### List project hooks

1818
Get a list of project hooks.
M
miks 已提交
1819 1820 1821 1822 1823

```
GET /projects/:id/hooks
```

1824 1825
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1826
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
M
miks 已提交
1827

1828
### Get project hook
1829

1830
Get a specific hook for a project.
1831 1832 1833 1834 1835

```
GET /projects/:id/hooks/:hook_id
```

1836 1837
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1838
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1839
| `hook_id` | integer | yes | The ID of a project hook |
1840

1841 1842 1843 1844
```json
{
  "id": 1,
  "url": "http://example.com/hook",
1845
  "project_id": 3,
B
Ben Boeckel 已提交
1846
  "push_events": true,
D
Duana Saskia 已提交
1847
  "push_events_branch_filter": "",
B
Ben Boeckel 已提交
1848
  "issues_events": true,
1849
  "confidential_issues_events": true,
B
Ben Boeckel 已提交
1850
  "merge_requests_events": true,
1851
  "tag_push_events": true,
B
Ben Boeckel 已提交
1852
  "note_events": true,
1853
  "job_events": true,
1854
  "pipeline_events": true,
1855
  "wiki_page_events": true,
B
Ben Boeckel 已提交
1856
  "enable_ssl_verification": true,
1857 1858 1859 1860 1861 1862
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

1863
Adds a hook to a specified project.
M
miks 已提交
1864 1865 1866 1867 1868

```
POST /projects/:id/hooks
```

1869 1870
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1871
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1872 1873
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
D
Duana Saskia 已提交
1874
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1875
| `issues_events` | boolean | no | Trigger hook on issues events |
1876
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1877 1878 1879
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events |
1880
| `job_events` | boolean | no | Trigger hook on job events |
1881
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
1882
| `wiki_page_events` | boolean | no | Trigger hook on wiki events |
1883
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1884
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1885

1886 1887
### Edit project hook

1888
Edits a hook for a specified project.
1889 1890 1891 1892 1893

```
PUT /projects/:id/hooks/:hook_id
```

1894 1895
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1896
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1897 1898 1899
| `hook_id` | integer | yes | The ID of the project hook |
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
D
Duana Saskia 已提交
1900
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1901
| `issues_events` | boolean | no | Trigger hook on issues events |
1902
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1903 1904 1905
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
| `tag_push_events` | boolean | no | Trigger hook on tag push events |
| `note_events` | boolean | no | Trigger hook on note events |
1906
| `job_events` | boolean | no | Trigger hook on job events |
1907 1908 1909
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
| `wiki_events` | boolean | no | Trigger hook on wiki events |
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1910
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1911

1912
### Delete project hook
M
miks 已提交
1913

1914
Removes a hook from a project. This is an idempotent method and can be called multiple times.
1915
Either the hook is available or not.
M
miks 已提交
1916 1917

```
1918
DELETE /projects/:id/hooks/:hook_id
M
miks 已提交
1919 1920
```

1921 1922
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1923
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1924
| `hook_id` | integer | yes | The ID of the project hook |
M
miks 已提交
1925

1926 1927
Note the JSON response differs if the hook is available or not. If the project hook
is available before it is returned in the JSON response or an empty response is returned.
1928

1929
## Fork relationship
1930

1931
Allows modification of the forked relationship between existing projects. Available only for project owners and admins.
1932

1933
### Create a forked from/to relation between existing projects
1934

1935 1936 1937 1938 1939
CAUTION: **Warning:**
This will destroy the LFS objects stored in the fork.
So to retain the LFS objects, make sure you've pulled them **before** creating the fork relation,
and push them again **after** creating the fork relation.

1940 1941 1942 1943
```
POST /projects/:id/fork/:forked_from_id
```

1944 1945
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1946
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1947
| `forked_from_id` | ID | yes | The ID of the project that was forked from |
1948 1949 1950 1951 1952 1953 1954

### Delete an existing forked from relationship

```
DELETE /projects/:id/fork
```

1955 1956
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1957
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
I
Izaak Alpert 已提交
1958 1959 1960

## Search for projects by name

1961 1962 1963
Search for projects by name which are accessible to the authenticated user. This
endpoint can be accessed without authentication if the project is publicly
accessible.
I
Izaak Alpert 已提交
1964 1965

```
1966
GET /projects
I
Izaak Alpert 已提交
1967 1968
```

1969 1970
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1971
| `search` | string | yes | A string contained in the project name |
1972
| `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields |
1973
| `sort` | string | no | Return requests sorted in `asc` or `desc` order |
1974

1975
```bash
1976
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects?search=test
1977 1978
```

1979 1980
## Start the Housekeeping task for a Project

1981
> Introduced in GitLab 9.0.
1982 1983 1984 1985 1986

```
POST /projects/:id/housekeeping
```

1987 1988 1989 1990
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID of the project or NAMESPACE/PROJECT_NAME |

1991
## Push Rules **(STARTER)**
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

### Get project push rules

Get the push rules of a project.

```
GET /projects/:id/push_rule
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID of the project or NAMESPACE/PROJECT_NAME |

```json
{
  "id": 1,
  "project_id": 3,
  "commit_message_regex": "Fixes \d+\..*",
2010
  "commit_message_negative_regex": "ssh\:\/\/",
2011 2012 2013 2014 2015 2016 2017 2018
  "branch_name_regex": "",
  "deny_delete_tag": false,
  "created_at": "2012-10-12T17:04:47Z",
  "member_check": false,
  "prevent_secrets": false,
  "author_email_regex": "",
  "file_name_regex": "",
  "max_file_size": 5,
2019 2020
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2021 2022 2023
}
```

2024
Users on GitLab [Premium, Silver, or higher](https://about.gitlab.com/pricing/) will also see
2025
the `commit_committer_check` and `reject_unsigned_commits` parameters:
2026

2027 2028 2029 2030
```json
{
  "id": 1,
  "project_id": 3,
2031 2032
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2033 2034 2035
  ...
}
```
2036 2037 2038 2039 2040 2041 2042 2043 2044

### Add project push rule

Adds a push rule to a specified project.

```
POST /projects/:id/push_rule
```

2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057
| Attribute                                     | Type           | Required | Description |
| --------------------------------------------- | -------------- | -------- | ----------- |
| `id`                                          | integer/string | yes      | The ID of the project or NAMESPACE/PROJECT_NAME |
| `deny_delete_tag` **(STARTER)**               | boolean        | no       | Deny deleting a tag |
| `member_check` **(STARTER)**                  | boolean        | no       | Restrict commits by author (email) to existing GitLab users |
| `prevent_secrets` **(STARTER)**               | boolean        | no       | GitLab will reject any files that are likely to contain secrets |
| `commit_message_regex` **(STARTER)**          | string         | no       | All commit messages must match this, e.g. `Fixed \d+\..*` |
| `commit_message_negative_regex` **(STARTER)** | string         | no       | No commit message is allowed to match this, e.g. `ssh\:\/\/` |
| `branch_name_regex` **(STARTER)**             | string         | no       | All branch names must match this, e.g. `(feature|hotfix)\/*` |
| `author_email_regex` **(STARTER)**            | string         | no       | All commit author emails must match this, e.g. `@my-company.com$` |
| `file_name_regex` **(STARTER)**               | string         | no       | All commited filenames must **not** match this, e.g. `(jar|exe)$` |
| `max_file_size` **(STARTER)**                 | integer        | no       | Maximum file size (MB) |
| `commit_committer_check` **(PREMIUM)**        | boolean        | no       | Users can only push commits to this repository that were committed with one of their own verified emails. |
2058
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commit when it is not signed through GPG. |
2059 2060 2061 2062 2063 2064 2065 2066 2067

### Edit project push rule

Edits a push rule for a specified project.

```
PUT /projects/:id/push_rule
```

2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080
| Attribute                                     | Type           | Required | Description |
| --------------------------------------------- | -------------- | -------- | ----------- |
| `id`                                          | integer/string | yes      | The ID of the project or NAMESPACE/PROJECT_NAME |
| `deny_delete_tag` **(STARTER)**               | boolean        | no       | Deny deleting a tag |
| `member_check` **(STARTER)**                  | boolean        | no       | Restrict commits by author (email) to existing GitLab users |
| `prevent_secrets` **(STARTER)**               | boolean        | no       | GitLab will reject any files that are likely to contain secrets |
| `commit_message_regex` **(STARTER)**          | string         | no       | All commit messages must match this, e.g. `Fixed \d+\..*` |
| `commit_message_negative_regex` **(STARTER)** | string         | no       | No commit message is allowed to match this, e.g. `ssh\:\/\/` |
| `branch_name_regex` **(STARTER)**             | string         | no       | All branch names must match this, e.g. `(feature|hotfix)\/*` |
| `author_email_regex` **(STARTER)**            | string         | no       | All commit author emails must match this, e.g. `@my-company.com$` |
| `file_name_regex` **(STARTER)**               | string         | no       | All commited filenames must **not** match this, e.g. `(jar|exe)$` |
| `max_file_size` **(STARTER)**                 | integer        | no       | Maximum file size (MB) |
| `commit_committer_check` **(PREMIUM)**        | boolean        | no       | Users can only push commits to this repository that were committed with one of their own verified emails. |
2081
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commits when they are not GPG signed. |
2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093

### Delete project push rule

> Introduced in [GitLab Starter](https://about.gitlab.com/pricing/) 9.0.

Removes a push rule from a project. This is an idempotent method and can be called multiple times.
Either the push rule is available or not.

```
DELETE /projects/:id/push_rule
```

2094 2095
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2096 2097
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |

2098 2099 2100
## Transfer a project to a new namespace

> Introduced in GitLab 11.1.
2101 2102 2103 2104 2105 2106 2107 2108 2109

```
PUT /projects/:id/transfer
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `namespace` | integer/string | yes | The ID or path of the namespace to transfer to project to |

2110 2111 2112 2113
## Branches

Read more in the [Branches](branches.md) documentation.

J
James Lopez 已提交
2114 2115
## Project Import/Export

J
James Lopez 已提交
2116
Read more in the [Project import/export](project_import_export.md) documentation.
J
James Lopez 已提交
2117

2118 2119 2120
## Project members

Read more in the [Project members](members.md) documentation.
2121

2122
## Start the pull mirroring process for a Project **(STARTER)**
2123

2124
> Introduced in [GitLab Starter](https://about.gitlab.com/pricing/) 10.3.
2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137

```
POST /projects/:id/mirror/pull
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |

```bash
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/mirror/pull
```

2138 2139 2140
## Project badges

Read more in the [Project Badges](project_badges.md) documentation.
2141 2142 2143

## Issue and merge request description templates

2144 2145
The non-default [issue and merge request description templates](../user/project/description_templates.md) are managed inside the project's repository. So you can manage them via the API through the [Repositories API](repositories.md) and the [Repository Files API](repository_files.md).

2146
## Download snapshot of a Git repository
2147 2148 2149 2150 2151

> Introduced in GitLab 10.7

This endpoint may only be accessed by an administrative user.

2152
Download a snapshot of the project (or wiki, if requested) Git repository. This
2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166
snapshot is always in uncompressed [tar](https://en.wikipedia.org/wiki/Tar_(computing))
format.

If a repository is corrupted to the point where `git clone` does not work, the
snapshot may allow some of the data to be retrieved.

```
GET /projects/:id/snapshot
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id`      | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
| `wiki`    | boolean | no | Whether to download the wiki, rather than project, repository |
2167

2168
[ce-27427]: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/27427