projects.md 86.2 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",
159
    "autoclose_referenced_issues": true,
V
vanadium23 已提交
160 161 162 163
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
164
      "wiki_size" : 0,
V
vanadium23 已提交
165
      "lfs_objects_size": 0,
166 167
      "job_artifacts_size": 0,
      "packages_size": 0
168 169 170 171 172 173 174 175 176 177
    },
    "_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 已提交
178 179 180 181 182 183 184 185 186
  },
  {
    "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 已提交
187
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
V
vanadium23 已提交
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
    "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,
207
    "resolve_outdated_diff_discussions": false,
V
vanadium23 已提交
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 236
    "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",
237
    "ci_default_git_depth": 0,
V
vanadium23 已提交
238 239 240 241
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
242
    "remove_source_branch_after_merge": false,
V
vanadium23 已提交
243
    "request_access_enabled": false,
244
    "merge_method": "merge",
245 246 247 248 249 250 251 252 253 254 255 256 257
    "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,
258
    "autoclose_referenced_issues": true,
V
vanadium23 已提交
259 260 261 262
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
263
      "wiki_size" : 0,
V
vanadium23 已提交
264
      "lfs_objects_size": 0,
265 266
      "job_artifacts_size": 0,
      "packages_size": 0
267 268 269 270 271 272 273 274 275
    },
    "_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 已提交
276 277 278 279 280
    }
  }
]
```

281 282 283 284 285 286 287 288 289 290 291 292 293 294
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,
    ...
  }
]
```

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

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

301
## List user projects
V
vanadium23 已提交
302

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

```
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 |
317
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
318
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
V
vanadium23 已提交
319 320 321
| `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 |
322
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
323 324
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
325
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
326
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
327 328
| `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 |
329

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

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

512 513 514 515 516 517 518 519 520 521
## 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 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
| `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:
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 593 594 595 596

```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,
597
    "remove_source_branch_after_merge": false,
598 599
    "request_access_enabled": false,
    "merge_method": "merge",
600
    "autoclose_referenced_issues": true,
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 675 676 677 678 679
    "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,
680
    "remove_source_branch_after_merge": false,
681 682
    "request_access_enabled": false,
    "merge_method": "merge",
683 684 685 686 687 688 689 690 691 692 693 694 695
    "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,
696
    "autoclose_referenced_issues": true,
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716
    "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"
    }
  }
]
```

717
## Get single project
N
Nihad Abbasov 已提交
718

719 720
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
N
Nihad Abbasov 已提交
721 722 723 724 725

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

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

A
Alex Denisov 已提交
733 734
```json
{
735 736
  "id": 3,
  "description": null,
M
Marin Jankovski 已提交
737
  "default_branch": "master",
738 739 740 741 742
  "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",
743
  "tag_list": [
744 745
    "example",
    "disapora project"
746
  ],
747 748 749 750
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
751
  },
752 753 754 755
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
756
  "issues_enabled": true,
757
  "open_issues_count": 1,
758 759
  "merge_requests_enabled": true,
  "jobs_enabled": true,
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
  "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"
  },
776 777
  "import_status": "none",
  "import_error": null,
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
  "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",
802
  "ci_default_git_depth": 50,
803
  "public_jobs": true,
804
  "shared_with_groups": [
805 806 807 808 809 810
    {
      "group_id": 4,
      "group_name": "Twitter",
      "group_full_path": "twitter",
      "group_access_level": 30
    },
811 812
    {
      "group_id": 3,
813 814 815
      "group_name": "Gitlab Org",
      "group_full_path": "gitlab-org",
      "group_access_level": 10
816
    }
817
  ],
818
  "repository_storage": "default",
J
James Lopez 已提交
819
  "only_allow_merge_if_pipeline_succeeds": false,
820
  "only_allow_merge_if_all_discussions_are_resolved": false,
821
  "remove_source_branch_after_merge": false,
822 823
  "printing_merge_requests_link_enabled": true,
  "request_access_enabled": false,
824
  "merge_method": "merge",
825 826 827 828 829 830 831 832 833 834 835 836 837
  "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,
838
  "autoclose_referenced_issues": true,
839 840 841 842
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
843
    "wiki_size" : 0,
844
    "lfs_objects_size": 0,
845 846
    "job_artifacts_size": 0,
    "packages_size": 0
847 848 849 850 851 852 853 854 855
  },
  "_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"
856
  }
A
Alex Denisov 已提交
857 858 859
}
```

860 861 862 863 864 865 866 867 868 869 870 871
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,
  ...
}
```

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

874 875 876 877 878 879 880 881 882 883 884 885 886 887
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",
888 889
      "path":"gitlab-foss",
      "path_with_namespace":"gitlab-org/gitlab-foss",
890 891 892
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"master",
      "tag_list":[],
893
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git",
894 895
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-foss",
896
      "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
897
      "license_url": "https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE",
J
J.D. Bean 已提交
898 899 900 901 902 903 904
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT",
      },
905 906
      "star_count":3812,
      "forks_count":3561,
907 908 909 910 911 912 913 914 915
      "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
      }
916 917 918 919 920 921 922
   }

   ...

}
```

923
## Get project users
D
Dmitriy Zaporozhets 已提交
924

925
Get the users list of a project.
D
Dmitriy Zaporozhets 已提交
926

927 928 929
```
GET /projects/:id/users
```
D
Dmitriy Zaporozhets 已提交
930

931 932 933 934
| Attribute    | Type          | Required | Description |
| ------------ | ------------- | -------- | ----------- |
| `search`     | string        | no       | Search for specific users |
| `skip_users` | integer array | no       | Filter out users with the specified IDs |
935

D
Dmitriy Zaporozhets 已提交
936
```json
J
Johannes Schleifenbaum 已提交
937 938
[
  {
939 940 941 942 943 944
    "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 已提交
945
  },
J
Johannes Schleifenbaum 已提交
946
  {
947 948 949 950 951 952
    "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 已提交
953 954
  }
]
D
Dmitriy Zaporozhets 已提交
955 956
```

957
## Get project events
D
Dmitriy Zaporozhets 已提交
958

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

961
## Create project
A
Alex Denisov 已提交
962

963
Creates a new project owned by the authenticated user.
A
Alex Denisov 已提交
964 965 966 967 968

```
POST /projects
```

969 970
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
971 972
| `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). |
973
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
974
| `default_branch` | string | no | `master` by default |
975
| `description` | string | no | Short project description |
976 977 978 979 980 981 982 983 984 985 986
| `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` |
987
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
988 989
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
990
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
991
| `import_url` | string | no | URL to import repository from |
992
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
993
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
994
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
995
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
996
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
997
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
998 999
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
1000
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1001
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1002
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
1003
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1004
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1005
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1006
| `build_coverage_regex` | string | no | Test coverage parsing |
1007
| `ci_config_path` | string | no | The path to CI config file |
1008 1009
| `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`) |
1010
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1011
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1012
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1013 1014
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
S
Steve 已提交
1015
| `initialize_with_readme` | boolean | no | `false` by default |
1016
| `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 |
1017
| `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. |
1018 1019
| `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 |
1020
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1021

1022
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1023 1024 1025
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.

1026
## Create project for user
1027

1028
Creates a new project owned by the specified user. Available only for admins.
1029 1030 1031 1032 1033

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

1034 1035 1036 1037 1038 1039 1040
| 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 |
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
| `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` |
1052
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1053 1054
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1055
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1056
| `import_url` | string | no | URL to import repository from |
1057
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1058
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1059
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1060
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1061
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
1062
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1063 1064
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
1065
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1066
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1067
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
1068
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1069
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1070
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1071
| `build_coverage_regex` | string | no | Test coverage parsing |
1072
| `ci_config_path` | string | no | The path to CI config file |
1073 1074
| `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`) |
1075
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1076
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1077
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1078 1079
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
1080
| `initialize_with_readme` | boolean | no | `false` by default |
1081 1082 1083
| `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 |
1084
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1085

1086
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1087 1088
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 已提交
1089

1090
## Edit project
1091

1092
Updates an existing project.
1093 1094 1095 1096 1097

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

1098 1099
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1100
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1101
| `name` | string | no | The name of the project |
1102
| `path` | string | no | Custom repository name for the project. By default generated based on name |
1103
| `default_branch` | string | no | `master` by default |
1104
| `description` | string | no | Short project description |
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115
| `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` |
1116
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1117 1118
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1119
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1120
| `import_url` | string | no | URL to import repository from |
1121
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1122
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1123
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1124
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1125
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
1126
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1127 1128
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
V
vanadium23 已提交
1129
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1130
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1131
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1132
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1133
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1134
| `build_coverage_regex` | string | no | Test coverage parsing |
1135
| `ci_config_path` | string | no | The path to CI config file |
1136
| `ci_default_git_depth` | integer | no | Default number of revisions for [shallow cloning](../user/project/pipelines/settings.md#git-shallow-clone) |
1137 1138
| `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`) |
1139
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1140
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge request by default |
1141
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1142 1143 1144 1145 1146 1147
| `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 |
1148
| `service_desk_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable service desk feature |
1149

1150
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1151 1152
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.
1153

1154
## Fork project
1155

1156
Forks a project into the user namespace of the authenticated user or the one provided.
1157

1158 1159 1160
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.
1161

1162
```
1163
POST /projects/:id/fork
1164 1165
```

1166 1167
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1168
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1169
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
1170 1171
| `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 |
1172

1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190
## 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 |
1191
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
1192
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
1193 1194 1195
| `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 |
1196
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
1197 1198
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
1199
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
1200 1201

```bash
1202
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216
```

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 已提交
1217
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
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 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
    "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,
1254
    "remove_source_branch_after_merge": false,
1255
    "request_access_enabled": false,
1256
    "merge_method": "merge",
1257
    "autoclose_referenced_issues": true,
1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
    "_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"
    }
  }
]
```

1271
## Star a project
1272

1273
Stars a given project. Returns status code `304` if the project is already starred.
1274 1275 1276 1277 1278 1279 1280

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

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

```bash
1284
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
1285 1286 1287 1288 1289 1290 1291 1292 1293
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1294
  "visibility": "internal",
1295 1296 1297
  "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 已提交
1298
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309
  "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,
1310
  "jobs_enabled": true,
1311 1312
  "wiki_enabled": true,
  "snippets_enabled": false,
1313
  "resolve_outdated_diff_discussions": false,
1314
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1315 1316
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1317 1318 1319 1320 1321
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1322 1323
    "kind": "group",
    "full_path": "diaspora"
1324
  },
1325
  "import_status": "none",
1326 1327
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1328 1329 1330 1331 1332 1333 1334 1335
  "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"
  },
1336 1337
  "shared_runners_enabled": true,
  "forks_count": 0,
1338
  "star_count": 1,
1339
  "public_jobs": true,
1340
  "shared_with_groups": [],
J
James Lopez 已提交
1341
  "only_allow_merge_if_pipeline_succeeds": false,
1342
  "only_allow_merge_if_all_discussions_are_resolved": false,
1343
  "remove_source_branch_after_merge": false,
1344
  "request_access_enabled": false,
1345
  "merge_method": "merge",
1346
  "autoclose_referenced_issues": true,
1347 1348 1349 1350 1351 1352 1353 1354 1355
  "_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"
  }
1356 1357 1358
}
```

1359
## Unstar a project
1360

1361
Unstars a given project. Returns status code `304` if the project is not starred.
1362 1363

```
1364
POST /projects/:id/unstar
1365 1366 1367 1368
```

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

```bash
1372
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
1373 1374 1375 1376 1377 1378 1379 1380 1381
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1382
  "visibility": "internal",
1383 1384 1385
  "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 已提交
1386
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
  "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,
1398
  "jobs_enabled": true,
1399 1400
  "wiki_enabled": true,
  "snippets_enabled": false,
1401
  "resolve_outdated_diff_discussions": false,
1402
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1403 1404
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1405 1406 1407 1408 1409
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1410 1411
    "kind": "group",
    "full_path": "diaspora"
1412
  },
1413
  "import_status": "none",
1414 1415
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
J
J.D. Bean 已提交
1416 1417 1418 1419 1420 1421 1422 1423
  "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"
  },
1424 1425
  "shared_runners_enabled": true,
  "forks_count": 0,
1426
  "star_count": 0,
1427
  "public_jobs": true,
1428
  "shared_with_groups": [],
J
James Lopez 已提交
1429
  "only_allow_merge_if_pipeline_succeeds": false,
1430
  "only_allow_merge_if_all_discussions_are_resolved": false,
1431
  "remove_source_branch_after_merge": false,
1432
  "request_access_enabled": false,
1433
  "merge_method": "merge",
1434
  "autoclose_referenced_issues": true,
1435 1436 1437 1438 1439 1440 1441 1442 1443
  "_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"
  }
1444 1445 1446
}
```

1447 1448
## List Starrers of a project

C
Camil Staps 已提交
1449
List the users who starred the specified project.
1450 1451 1452 1453 1454 1455 1456

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

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
C
Camil Staps 已提交
1457
| `search` | string | no | Search for specific users. |
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467

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

Example responses:

```json
[
  {
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477
    "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"
      }
1478
  },
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488
    "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"
      }
1489 1490 1491
]
```

1492 1493 1494 1495 1496 1497 1498 1499 1500
## Languages

Get languages used in a project with percentage value.

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

```bash
1501
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514
```

Example response:

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

1515
## Archive a project
1516

1517
Archives the project if the user is either admin or the project owner of this project. This action is
1518 1519 1520
idempotent, thus archiving an already archived project will not change the project.

```
1521
POST /projects/:id/archive
1522 1523 1524 1525
```

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

```bash
1529
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
1530 1531 1532 1533 1534 1535 1536 1537 1538
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1539
  "visibility": "private",
1540 1541 1542
  "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 已提交
1543
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1544 1545 1546 1547 1548 1549 1550
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
1551
    "created_at": "2013-09-30T13:46:02Z"
1552 1553 1554 1555 1556 1557 1558 1559
  },
  "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,
1560
  "jobs_enabled": true,
1561 1562
  "wiki_enabled": true,
  "snippets_enabled": false,
1563
  "resolve_outdated_diff_discussions": false,
1564
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1565 1566
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1567 1568 1569 1570 1571
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1572 1573
    "kind": "group",
    "full_path": "diaspora"
1574
  },
1575 1576
  "import_status": "none",
  "import_error": null,
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588
  "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 已提交
1589 1590 1591 1592 1593 1594 1595 1596
  "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"
  },
1597 1598 1599
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1600
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1601
  "ci_default_git_depth": 50,
1602
  "public_jobs": true,
1603
  "shared_with_groups": [],
J
James Lopez 已提交
1604
  "only_allow_merge_if_pipeline_succeeds": false,
1605
  "only_allow_merge_if_all_discussions_are_resolved": false,
1606
  "remove_source_branch_after_merge": false,
1607
  "request_access_enabled": false,
1608
  "merge_method": "merge",
1609
  "autoclose_referenced_issues": true,
1610 1611 1612 1613 1614 1615 1616 1617 1618
  "_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"
  }
1619 1620 1621
}
```

1622
## Unarchive a project
1623

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

```
S
Sergey Gnuskov 已提交
1628
POST /projects/:id/unarchive
1629 1630 1631 1632
```

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

```bash
1636
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
1637 1638 1639 1640 1641 1642 1643 1644 1645
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1646
  "visibility": "private",
1647 1648 1649
  "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 已提交
1650
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1651 1652 1653 1654 1655 1656 1657
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
B
Ben Boeckel 已提交
1658
    "created_at": "2013-09-30T13:46:02Z"
1659 1660 1661 1662 1663 1664 1665 1666
  },
  "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,
1667
  "jobs_enabled": true,
1668 1669
  "wiki_enabled": true,
  "snippets_enabled": false,
1670
  "resolve_outdated_diff_discussions": false,
1671
  "container_registry_enabled": false,
B
Ben Boeckel 已提交
1672 1673
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1674 1675 1676 1677 1678
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1679 1680
    "kind": "group",
    "full_path": "diaspora"
1681
  },
1682 1683
  "import_status": "none",
  "import_error": null,
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695
  "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 已提交
1696 1697 1698 1699 1700 1701 1702 1703
  "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"
  },
1704 1705 1706
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1707
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1708
  "ci_default_git_depth": 50,
1709
  "public_jobs": true,
1710
  "shared_with_groups": [],
J
James Lopez 已提交
1711
  "only_allow_merge_if_pipeline_succeeds": false,
1712
  "only_allow_merge_if_all_discussions_are_resolved": false,
1713
  "remove_source_branch_after_merge": false,
1714
  "request_access_enabled": false,
1715
  "merge_method": "merge",
1716
  "autoclose_referenced_issues": true,
1717 1718 1719 1720 1721 1722 1723 1724 1725
  "_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"
  }
1726 1727 1728
}
```

1729
## Remove project
D
Dmitriy Zaporozhets 已提交
1730

1731 1732 1733 1734 1735 1736
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 已提交
1737 1738 1739 1740 1741

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

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

1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757
## 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) |

1758
## Upload a file
D
Douwe Maan 已提交
1759 1760 1761 1762 1763 1764 1765

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

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

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

1771 1772 1773 1774 1775 1776
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
1777
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads
1778 1779 1780 1781
```

Returned object:

D
Douwe Maan 已提交
1782 1783 1784 1785 1786 1787 1788 1789
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

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

1794
## Share project with group
1795 1796 1797 1798 1799 1800 1801

Allow to share project with group.

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

1802 1803
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1804
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1805
| `group_id` | integer | yes | The ID of the group to share with |
1806
| `group_access` | integer | yes | The [permissions level](members.md) to grant the group |
1807
| `expires_at` | string | no | Share expiration date in ISO 8601 format: 2016-09-26 |
1808

1809
## Delete a shared project link within a group
1810 1811 1812 1813 1814 1815 1816 1817 1818

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

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

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

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

1826 1827
## Hooks

1828 1829 1830
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

1831 1832
### List project hooks

1833
Get a list of project hooks.
M
miks 已提交
1834 1835 1836 1837 1838

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

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

1843
### Get project hook
1844

1845
Get a specific hook for a project.
1846 1847 1848 1849 1850

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

1851 1852
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1853
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1854
| `hook_id` | integer | yes | The ID of a project hook |
1855

1856 1857 1858 1859
```json
{
  "id": 1,
  "url": "http://example.com/hook",
1860
  "project_id": 3,
B
Ben Boeckel 已提交
1861
  "push_events": true,
D
Duana Saskia 已提交
1862
  "push_events_branch_filter": "",
B
Ben Boeckel 已提交
1863
  "issues_events": true,
1864
  "confidential_issues_events": true,
B
Ben Boeckel 已提交
1865
  "merge_requests_events": true,
1866
  "tag_push_events": true,
B
Ben Boeckel 已提交
1867
  "note_events": true,
1868
  "job_events": true,
1869
  "pipeline_events": true,
1870
  "wiki_page_events": true,
B
Ben Boeckel 已提交
1871
  "enable_ssl_verification": true,
1872 1873 1874 1875 1876 1877
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

1878
Adds a hook to a specified project.
M
miks 已提交
1879 1880 1881 1882 1883

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

1884 1885
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1886
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1887 1888
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
D
Duana Saskia 已提交
1889
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1890
| `issues_events` | boolean | no | Trigger hook on issues events |
1891
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1892 1893 1894
| `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 |
1895
| `job_events` | boolean | no | Trigger hook on job events |
1896
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
1897
| `wiki_page_events` | boolean | no | Trigger hook on wiki events |
1898
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1899
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1900

1901 1902
### Edit project hook

1903
Edits a hook for a specified project.
1904 1905 1906 1907 1908

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

1909 1910
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1911
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1912 1913 1914
| `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 已提交
1915
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1916
| `issues_events` | boolean | no | Trigger hook on issues events |
1917
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1918 1919 1920
| `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 |
1921
| `job_events` | boolean | no | Trigger hook on job events |
1922 1923 1924
| `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 |
1925
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1926

1927
### Delete project hook
M
miks 已提交
1928

1929
Removes a hook from a project. This is an idempotent method and can be called multiple times.
1930
Either the hook is available or not.
M
miks 已提交
1931 1932

```
1933
DELETE /projects/:id/hooks/:hook_id
M
miks 已提交
1934 1935
```

1936 1937
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1938
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1939
| `hook_id` | integer | yes | The ID of the project hook |
M
miks 已提交
1940

1941 1942
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.
1943

1944
## Fork relationship
1945

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

1948
### Create a forked from/to relation between existing projects
1949

1950 1951 1952 1953 1954
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.

1955 1956 1957 1958
```
POST /projects/:id/fork/:forked_from_id
```

1959 1960
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1961
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1962
| `forked_from_id` | ID | yes | The ID of the project that was forked from |
1963 1964 1965 1966 1967 1968 1969

### Delete an existing forked from relationship

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

1970 1971
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1972
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
I
Izaak Alpert 已提交
1973 1974 1975

## Search for projects by name

1976 1977 1978
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 已提交
1979 1980

```
1981
GET /projects
I
Izaak Alpert 已提交
1982 1983
```

1984 1985
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1986
| `search` | string | yes | A string contained in the project name |
1987
| `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields |
1988
| `sort` | string | no | Return requests sorted in `asc` or `desc` order |
1989

1990
```bash
1991
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects?search=test
1992 1993
```

1994 1995
## Start the Housekeeping task for a Project

1996
> Introduced in GitLab 9.0.
1997 1998 1999 2000 2001

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

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

2006
## Push Rules **(STARTER)**
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024

### 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+\..*",
2025
  "commit_message_negative_regex": "ssh\:\/\/",
2026 2027 2028 2029 2030 2031 2032 2033
  "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,
2034 2035
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2036 2037 2038
}
```

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

2042 2043 2044 2045
```json
{
  "id": 1,
  "project_id": 3,
2046 2047
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2048 2049 2050
  ...
}
```
2051 2052 2053 2054 2055 2056 2057 2058 2059

### Add project push rule

Adds a push rule to a specified project.

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

2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072
| 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. |
2073
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commit when it is not signed through GPG. |
2074 2075 2076 2077 2078 2079 2080 2081 2082

### Edit project push rule

Edits a push rule for a specified project.

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

2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095
| 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. |
2096
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commits when they are not GPG signed. |
2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108

### 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
```

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

2113 2114 2115
## Transfer a project to a new namespace

> Introduced in GitLab 11.1.
2116 2117 2118 2119 2120 2121 2122 2123 2124

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

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

2125 2126 2127 2128
## Branches

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

J
James Lopez 已提交
2129 2130
## Project Import/Export

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

2133 2134 2135
## Project members

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

2137
## Start the pull mirroring process for a Project **(STARTER)**
2138

2139
> Introduced in [GitLab Starter](https://about.gitlab.com/pricing/) 10.3.
2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152

```
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
```

2153 2154 2155
## Project badges

Read more in the [Project Badges](project_badges.md) documentation.
2156 2157 2158

## Issue and merge request description templates

2159 2160
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).

2161
## Download snapshot of a Git repository
2162 2163 2164 2165 2166

> Introduced in GitLab 10.7

This endpoint may only be accessed by an administrative user.

2167
Download a snapshot of the project (or wiki, if requested) Git repository. This
2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181
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 |
2182

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