projects.md 87.9 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
Nihad Abbasov's avatar
Nihad Abbasov committed
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.
Nihad Abbasov's avatar
Nihad Abbasov committed
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 |
vanadium23's avatar
vanadium23 committed
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:

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

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

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

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

303 304 305 306 307 308 309 310 311
### Pagination limits

From GitLab 12.10, [offset-based pagination](README.md#offset-based-pagination) will be
[limited to 10,000 records](https://gitlab.com/gitlab-org/gitlab/issues/34565).
[Keyset pagination](README.md#keyset-based-pagination) will be required to retrieve projects
beyond this limit.

Note that keyset pagination only supports `order_by=id`. Other sorting options are not available.

312
## List user projects
vanadium23's avatar
vanadium23 committed
313

Davin Walker's avatar
Davin Walker committed
314
Get a list of visible projects owned by the given user. When accessed without authentication, only public projects are returned.
vanadium23's avatar
vanadium23 committed
315 316 317 318 319 320 321 322 323 324 325 326 327

```
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 |
328
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
329
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
vanadium23's avatar
vanadium23 committed
330 331 332
| `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 |
333
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
334 335
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
336
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
337
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
338 339
| `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 |
340

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

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

525 526 527 528 529 530 531 532 533 534
## 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 |
| --------- | ---- | -------- | ----------- |
Camil Staps's avatar
Camil Staps committed
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
| `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:
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 597 598 599 600 601 602 603 604 605 606 607 608 609

```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,
610
    "remove_source_branch_after_merge": false,
611 612
    "request_access_enabled": false,
    "merge_method": "merge",
613
    "autoclose_referenced_issues": true,
614
    "suggestion_commit_message": null,
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 680 681 682 683 684 685 686 687 688 689 690 691 692 693
    "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,
694
    "remove_source_branch_after_merge": false,
695 696
    "request_access_enabled": false,
    "merge_method": "merge",
697 698 699 700 701 702 703 704 705 706 707 708 709
    "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,
710
    "autoclose_referenced_issues": true,
711
    "suggestion_commit_message": null,
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731
    "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"
    }
  }
]
```

732
## Get single project
Nihad Abbasov's avatar
Nihad Abbasov committed
733

734 735
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
Nihad Abbasov's avatar
Nihad Abbasov committed
736 737 738 739 740

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

741 742
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
743
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
744
| `statistics` | boolean | no | Include project statistics |
745
| `license` | boolean | no | Include project license data |
746
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
Nihad Abbasov's avatar
Nihad Abbasov committed
747

748 749
```json
{
750 751
  "id": 3,
  "description": null,
Marin Jankovski's avatar
Marin Jankovski committed
752
  "default_branch": "master",
753 754 755 756 757
  "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",
758
  "tag_list": [
759 760
    "example",
    "disapora project"
761
  ],
762 763 764 765
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
766
  },
767 768 769 770
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
771
  "issues_enabled": true,
772
  "open_issues_count": 1,
773 774
  "merge_requests_enabled": true,
  "jobs_enabled": true,
775 776 777 778
  "wiki_enabled": true,
  "snippets_enabled": false,
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": false,
779 780 781 782 783 784 785 786
  "container_expiration_policy": {
    "cadence": "7d",
    "enabled": false,
    "keep_n": null,
    "older_than": null,
    "name_regex": null,
    "next_run_at": "2020-01-07T21:42:58.658Z"
  },
787 788 789 790 791 792 793 794 795 796 797 798
  "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"
  },
799 800
  "import_status": "none",
  "import_error": null,
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
  "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",
825
  "ci_default_git_depth": 50,
826
  "public_jobs": true,
827
  "shared_with_groups": [
828 829 830 831 832 833
    {
      "group_id": 4,
      "group_name": "Twitter",
      "group_full_path": "twitter",
      "group_access_level": 30
    },
834 835
    {
      "group_id": 3,
836 837 838
      "group_name": "Gitlab Org",
      "group_full_path": "gitlab-org",
      "group_access_level": 10
839
    }
840
  ],
841
  "repository_storage": "default",
842
  "only_allow_merge_if_pipeline_succeeds": false,
843
  "only_allow_merge_if_all_discussions_are_resolved": false,
844
  "remove_source_branch_after_merge": false,
845 846
  "printing_merge_requests_link_enabled": true,
  "request_access_enabled": false,
847
  "merge_method": "merge",
848 849 850 851 852 853 854 855 856 857 858 859 860
  "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,
861
  "autoclose_referenced_issues": true,
862
  "suggestion_commit_message": null,
863 864 865 866
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
867
    "wiki_size" : 0,
868
    "lfs_objects_size": 0,
869 870
    "job_artifacts_size": 0,
    "packages_size": 0
871 872 873 874 875 876 877 878 879
  },
  "_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"
880
  }
881 882 883
}
```

884 885 886 887 888 889 890 891 892 893 894 895
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,
  ...
}
```

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

898 899 900 901 902 903 904 905 906 907 908 909 910 911
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",
912 913
      "path":"gitlab-foss",
      "path_with_namespace":"gitlab-org/gitlab-foss",
914 915 916
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"master",
      "tag_list":[],
917
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git",
918 919
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-foss",
920
      "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
921
      "license_url": "https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE",
922 923 924 925 926 927 928
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT",
      },
929 930
      "star_count":3812,
      "forks_count":3561,
931 932 933 934 935 936 937 938 939
      "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
      }
940 941 942 943 944 945 946
   }

   ...

}
```

947
## Get project users
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
948

949
Get the users list of a project.
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
950

951 952 953
```
GET /projects/:id/users
```
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
954

955 956 957 958
| Attribute    | Type          | Required | Description |
| ------------ | ------------- | -------- | ----------- |
| `search`     | string        | no       | Search for specific users |
| `skip_users` | integer array | no       | Filter out users with the specified IDs |
959

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
960
```json
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
961 962
[
  {
963 964 965 966 967 968
    "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"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
969
  },
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
970
  {
971 972 973 974 975 976
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
    "web_url": "http://localhost:3000/jack_smith"
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
977 978
  }
]
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
979 980
```

981
## Get project events
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
982

983
Please refer to the [Events API documentation](events.md#list-a-projects-visible-events).
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
984

985
## Create project
986

987
Creates a new project owned by the authenticated user.
988 989 990 991 992

```
POST /projects
```

993 994
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
995 996
| `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). |
997
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
998
| `default_branch` | string | no | `master` by default |
999
| `description` | string | no | Short project description |
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
| `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` |
1011
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1012
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
1013
| `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) |
1014
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1015
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1016
| `import_url` | string | no | URL to import repository from |
1017
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1018
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1019
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1020
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1021
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
1022
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1023 1024
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
1025
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1026
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1027
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
1028
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1029
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1030
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1031
| `build_coverage_regex` | string | no | Test coverage parsing |
1032
| `ci_config_path` | string | no | The path to CI config file |
1033 1034
| `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`) |
1035
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1036
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1037
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1038 1039
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
Steve's avatar
Steve committed
1040
| `initialize_with_readme` | boolean | no | `false` by default |
1041
| `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 |
1042
| `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. |
1043 1044
| `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 |
Mitar's avatar
Mitar committed
1045
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1046

1047
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1048 1049 1050
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.

1051
## Create project for user
1052

1053
Creates a new project owned by the specified user. Available only for admins.
1054 1055 1056 1057 1058

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

1059 1060 1061 1062 1063 1064 1065
| 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 |
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
| `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` |
1077
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1078 1079
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1080
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1081
| `import_url` | string | no | URL to import repository from |
1082
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1083
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1084
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1085
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1086
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
1087
| `suggestion_commit_message` | string | no | The commit message used to apply merge request suggestions |
1088
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1089 1090
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
1091
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1092
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1093
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
1094
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1095
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1096
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1097
| `build_coverage_regex` | string | no | Test coverage parsing |
1098
| `ci_config_path` | string | no | The path to CI config file |
1099 1100
| `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`) |
1101
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1102
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
1103
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1104 1105
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
1106
| `initialize_with_readme` | boolean | no | `false` by default |
1107 1108 1109
| `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 |
Mitar's avatar
Mitar committed
1110
| `packages_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable packages repository feature |
1111

1112
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1113 1114
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.
1115

1116
## Edit project
1117

1118
Updates an existing project.
1119 1120 1121 1122 1123

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

1124 1125
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1126
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1127
| `name` | string | no | The name of the project |
1128
| `path` | string | no | Custom repository name for the project. By default generated based on name |
1129
| `default_branch` | string | no | `master` by default |
1130
| `description` | string | no | Short project description |
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
| `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` |
1142
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
1143
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
1144
| `container_expiration_policy_attributes` | hash | no | Update the container expiration policy for this project. Accepts: `cadence` (string), `keep_n` (string), `older_than` (string), `name_regex` (string), `enabled` (boolean) |
1145
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
1146
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
1147
| `import_url` | string | no | URL to import repository from |
1148
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
1149
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
1150
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
1151
| `merge_method` | string | no | Set the [merge method](#project-merge-method) used |
1152
| `autoclose_referenced_issues` | boolean | no | Set whether auto-closing referenced issues on default branch |
1153
| `suggestion_commit_message` | string | no | The commit message used to apply merge request suggestions |
1154
| `remove_source_branch_after_merge` | boolean | no | Enable `Delete source branch` option by default for all new merge requests |
1155 1156
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
1157
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
1158
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
1159
| `build_git_strategy` | string | no | The Git strategy. Defaults to `fetch` |
1160
| `build_timeout` | integer | no | The maximum amount of time in minutes that a job is able run (in seconds) |
1161
| `auto_cancel_pending_pipelines` | string | no | Auto-cancel pending pipelines (Note: this is not a boolean, but enabled/disabled |
1162
| `build_coverage_regex` | string | no | Test coverage parsing |
1163
| `ci_config_path` | string | no | The path to CI config file |
1164
| `ci_default_git_depth` | integer | no | Default number of revisions for [shallow cloning](../user/project/pipelines/settings.md#git-shallow-clone) |
1165 1166
| `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`) |
1167
| `repository_storage` | string | no | **(STARTER ONLY)** Which storage shard the repository is on. Available only to admins |
1168
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge request by default |
1169
| `external_authorization_classification_label` | string | no | **(PREMIUM)** The classification label for the project |
1170 1171 1172 1173 1174 1175
| `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 |
1176
| `service_desk_enabled` | boolean | no | **(PREMIUM ONLY)** Enable or disable service desk feature |
1177

1178
NOTE: **Note:** If your HTTP repository is not publicly accessible,
1179 1180
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.
1181

1182
## Fork project
1183

1184
Forks a project into the user namespace of the authenticated user or the one provided.
1185

1186 1187 1188
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.
1189

1190
```
1191
POST /projects/:id/fork
1192 1193
```

1194 1195
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1196
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1197
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
1198 1199
| `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 |
1200

1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
## 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 |
1219
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
1220
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
1221 1222 1223
| `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 |
1224
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
1225 1226
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
1227
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
1228 1229

```bash
1230
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244
```

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",
1245
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
    "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,
1282
    "remove_source_branch_after_merge": false,
1283
    "request_access_enabled": false,
1284
    "merge_method": "merge",
1285
    "autoclose_referenced_issues": true,
1286
    "suggestion_commit_message": null,
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
    "_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"
    }
  }
]
```

1300
## Star a project
1301

1302
Stars a given project. Returns status code `304` if the project is already starred.
1303 1304 1305 1306 1307 1308 1309

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

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

```bash
1313
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
1314 1315 1316 1317 1318 1319 1320 1321 1322
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1323
  "visibility": "internal",
1324 1325 1326
  "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",
1327
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
  "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,
1339
  "jobs_enabled": true,
1340 1341
  "wiki_enabled": true,
  "snippets_enabled": false,
1342
  "resolve_outdated_diff_discussions": false,
1343
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1344 1345
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1346 1347 1348 1349 1350
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1351 1352
    "kind": "group",
    "full_path": "diaspora"
1353
  },
1354
  "import_status": "none",
1355 1356
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1357 1358 1359 1360 1361 1362 1363 1364
  "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"
  },
1365 1366
  "shared_runners_enabled": true,
  "forks_count": 0,
1367
  "star_count": 1,
1368
  "public_jobs": true,
1369
  "shared_with_groups": [],
1370
  "only_allow_merge_if_pipeline_succeeds": false,
1371
  "only_allow_merge_if_all_discussions_are_resolved": false,
1372
  "remove_source_branch_after_merge": false,
1373
  "request_access_enabled": false,
1374
  "merge_method": "merge",
1375
  "autoclose_referenced_issues": true,
1376
  "suggestion_commit_message": null,
1377 1378 1379 1380 1381 1382 1383 1384 1385
  "_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"
  }
1386 1387 1388
}
```

1389
## Unstar a project
1390

1391
Unstars a given project. Returns status code `304` if the project is not starred.
1392 1393

```
1394
POST /projects/:id/unstar
1395 1396 1397 1398
```

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

```bash
1402
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
1403 1404 1405 1406 1407 1408 1409 1410 1411
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1412
  "visibility": "internal",
1413 1414 1415
  "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",
1416
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427
  "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,
1428
  "jobs_enabled": true,
1429 1430
  "wiki_enabled": true,
  "snippets_enabled": false,
1431
  "resolve_outdated_diff_discussions": false,
1432
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1433 1434
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1435 1436 1437 1438 1439
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1440 1441
    "kind": "group",
    "full_path": "diaspora"
1442
  },
1443
  "import_status": "none",
1444 1445
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1446 1447 1448 1449 1450 1451 1452 1453
  "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"
  },
1454 1455
  "shared_runners_enabled": true,
  "forks_count": 0,
1456
  "star_count": 0,
1457
  "public_jobs": true,
1458
  "shared_with_groups": [],
1459
  "only_allow_merge_if_pipeline_succeeds": false,
1460
  "only_allow_merge_if_all_discussions_are_resolved": false,
1461
  "remove_source_branch_after_merge": false,
1462
  "request_access_enabled": false,
1463
  "merge_method": "merge",
1464
  "autoclose_referenced_issues": true,
1465
  "suggestion_commit_message": null,
1466 1467 1468 1469 1470 1471 1472 1473 1474
  "_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"
  }
1475 1476 1477
}
```

1478 1479
## List Starrers of a project

Camil Staps's avatar
Camil Staps committed
1480
List the users who starred the specified project.
1481 1482 1483 1484 1485 1486 1487

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

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
Camil Staps's avatar
Camil Staps committed
1488
| `search` | string | no | Search for specific users. |
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498

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

Example responses:

```json
[
  {
1499 1500 1501 1502 1503 1504 1505 1506 1507 1508
    "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"
      }
1509
  },
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519
    "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"
      }
1520 1521 1522
]
```

1523 1524 1525 1526 1527 1528 1529 1530 1531
## Languages

Get languages used in a project with percentage value.

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

```bash
1532
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545
```

Example response:

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

1546
## Archive a project
1547

1548
Archives the project if the user is either admin or the project owner of this project. This action is
1549 1550 1551
idempotent, thus archiving an already archived project will not change the project.

```
1552
POST /projects/:id/archive
1553 1554 1555 1556
```

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

```bash
1560
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
1561 1562 1563 1564 1565 1566 1567 1568 1569
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1570
  "visibility": "private",
1571 1572 1573
  "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",
1574
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1575 1576 1577 1578 1579 1580 1581
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1582
    "created_at": "2013-09-30T13:46:02Z"
1583 1584 1585 1586 1587 1588 1589 1590
  },
  "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,
1591
  "jobs_enabled": true,
1592 1593
  "wiki_enabled": true,
  "snippets_enabled": false,
1594
  "resolve_outdated_diff_discussions": false,
1595
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1596 1597
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1598 1599 1600 1601 1602
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1603 1604
    "kind": "group",
    "full_path": "diaspora"
1605
  },
1606 1607
  "import_status": "none",
  "import_error": null,
1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619
  "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",
1620 1621 1622 1623 1624 1625 1626 1627
  "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"
  },
1628 1629 1630
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1631
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1632
  "ci_default_git_depth": 50,
1633
  "public_jobs": true,
1634
  "shared_with_groups": [],
1635
  "only_allow_merge_if_pipeline_succeeds": false,
1636
  "only_allow_merge_if_all_discussions_are_resolved": false,
1637
  "remove_source_branch_after_merge": false,
1638
  "request_access_enabled": false,
1639
  "merge_method": "merge",
1640
  "autoclose_referenced_issues": true,
1641
  "suggestion_commit_message": null,
1642 1643 1644 1645 1646 1647 1648 1649 1650
  "_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"
  }
1651 1652 1653
}
```

1654
## Unarchive a project
1655

1656
Unarchives the project if the user is either admin or the project owner of this project. This action is
Ville Skyttä's avatar
Ville Skyttä committed
1657
idempotent, thus unarchiving a non-archived project will not change the project.
1658 1659

```
Sergey Gnuskov's avatar
Sergey Gnuskov committed
1660
POST /projects/:id/unarchive
1661 1662 1663 1664
```

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

```bash
1668
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
1669 1670 1671 1672 1673 1674 1675 1676 1677
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1678
  "visibility": "private",
1679 1680 1681
  "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",
1682
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1683 1684 1685 1686 1687 1688 1689
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1690
    "created_at": "2013-09-30T13:46:02Z"
1691 1692 1693 1694 1695 1696 1697 1698
  },
  "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,
1699
  "jobs_enabled": true,
1700 1701
  "wiki_enabled": true,
  "snippets_enabled": false,
1702
  "resolve_outdated_diff_discussions": false,
1703
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1704 1705
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1706 1707 1708 1709 1710
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1711 1712
    "kind": "group",
    "full_path": "diaspora"
1713
  },
1714 1715
  "import_status": "none",
  "import_error": null,
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727
  "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",
1728 1729 1730 1731 1732 1733 1734 1735
  "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"
  },
1736 1737 1738
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1739
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1740
  "ci_default_git_depth": 50,
1741
  "public_jobs": true,
1742
  "shared_with_groups": [],
1743
  "only_allow_merge_if_pipeline_succeeds": false,
1744
  "only_allow_merge_if_all_discussions_are_resolved": false,
1745
  "remove_source_branch_after_merge": false,
1746
  "request_access_enabled": false,
1747
  "merge_method": "merge",
1748
  "autoclose_referenced_issues": true,
1749
  "suggestion_commit_message": null,
1750 1751 1752 1753 1754 1755 1756 1757 1758
  "_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"
  }
1759 1760 1761
}
```

1762
## Remove project
1763

Gosia Ksionek's avatar
Gosia Ksionek committed
1764 1765 1766 1767 1768 1769
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).
1770 1771 1772 1773 1774

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

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

Gosia Ksionek's avatar
Gosia Ksionek committed
1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790
## 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) |

1791
## Upload a file
1792 1793 1794 1795 1796 1797 1798

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

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

1799 1800
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1801
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1802
| `file` | string | yes | The file to be uploaded |
1803

1804 1805 1806 1807 1808 1809
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
1810
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads
1811 1812 1813 1814
```

Returned object:

1815 1816 1817 1818 1819 1820 1821 1822
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

1823
>**Note**: The returned `url` is relative to the project path.
1824 1825
In Markdown contexts, the link is automatically expanded when the format in
`markdown` is used.
1826

1827
## Share project with group
1828 1829 1830 1831 1832 1833 1834

Allow to share project with group.

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

1835 1836
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1837
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1838
| `group_id` | integer | yes | The ID of the group to share with |
1839
| `group_access` | integer | yes | The [permissions level](members.md) to grant the group |
1840
| `expires_at` | string | no | Share expiration date in ISO 8601 format: 2016-09-26 |
1841

1842
## Delete a shared project link within a group
1843 1844 1845 1846 1847 1848 1849 1850 1851

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

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

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

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

1859 1860
## Hooks

1861 1862 1863
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

1864 1865
### List project hooks

1866
Get a list of project hooks.
miks's avatar
miks committed
1867 1868 1869 1870 1871

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

1872 1873
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1874
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
miks's avatar
miks committed
1875

1876
### Get project hook
1877

1878
Get a specific hook for a project.
1879 1880 1881 1882 1883

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

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
| `hook_id` | integer | yes | The ID of a project hook |
1888

1889 1890 1891 1892
```json
{
  "id": 1,
  "url": "http://example.com/hook",
1893
  "project_id": 3,
Ben Boeckel's avatar
Ben Boeckel committed
1894
  "push_events": true,
1895
  "push_events_branch_filter": "",
Ben Boeckel's avatar
Ben Boeckel committed
1896
  "issues_events": true,
1897
  "confidential_issues_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1898
  "merge_requests_events": true,
1899
  "tag_push_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1900
  "note_events": true,
1901
  "job_events": true,
1902
  "pipeline_events": true,
1903
  "wiki_page_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1904
  "enable_ssl_verification": true,
1905 1906 1907 1908 1909 1910
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

1911
Adds a hook to a specified project.
miks's avatar
miks committed
1912 1913 1914 1915 1916

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

1917 1918
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1919
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1920 1921
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
1922
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1923
| `issues_events` | boolean | no | Trigger hook on issues events |
1924
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1925 1926 1927
| `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 |
1928
| `job_events` | boolean | no | Trigger hook on job events |
1929
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
1930
| `wiki_page_events` | boolean | no | Trigger hook on wiki events |
1931
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1932
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1933

1934 1935
### Edit project hook

1936
Edits a hook for a specified project.
1937 1938 1939 1940 1941

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

1942 1943
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1944
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1945 1946 1947
| `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 |
1948
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1949
| `issues_events` | boolean | no | Trigger hook on issues events |
1950
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1951 1952 1953
| `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 |
1954
| `job_events` | boolean | no | Trigger hook on job events |
1955 1956 1957
| `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 |
1958
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1959

1960
### Delete project hook
miks's avatar
miks committed
1961

1962
Removes a hook from a project. This is an idempotent method and can be called multiple times.
1963
Either the hook is available or not.
miks's avatar
miks committed
1964 1965

```
1966
DELETE /projects/:id/hooks/:hook_id
miks's avatar
miks committed
1967 1968
```

1969 1970
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1971
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1972
| `hook_id` | integer | yes | The ID of the project hook |
miks's avatar
miks committed
1973

1974 1975
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.
1976

1977
## Fork relationship
1978

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

1981
### Create a forked from/to relation between existing projects
1982

1983 1984 1985 1986 1987
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.

1988 1989 1990 1991
```
POST /projects/:id/fork/:forked_from_id
```

1992 1993
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1994
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1995
| `forked_from_id` | ID | yes | The ID of the project that was forked from |
1996 1997 1998 1999 2000 2001 2002

### Delete an existing forked from relationship

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

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

## Search for projects by name

2009 2010 2011
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.
2012 2013

```
2014
GET /projects
2015 2016
```

2017 2018
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
2019
| `search` | string | yes | A string contained in the project name |
2020
| `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields |
2021
| `sort` | string | no | Return requests sorted in `asc` or `desc` order |
2022

2023
```bash
2024
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects?search=test
2025 2026
```

2027 2028
## Start the Housekeeping task for a Project

2029
> Introduced in GitLab 9.0.
2030 2031 2032 2033 2034

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

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

2039
## Push Rules **(STARTER)**
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057

### 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+\..*",
2058
  "commit_message_negative_regex": "ssh\:\/\/",
2059 2060 2061 2062 2063 2064 2065 2066
  "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,
2067 2068
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2069 2070 2071
}
```

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

2075 2076 2077 2078
```json
{
  "id": 1,
  "project_id": 3,
2079 2080
  "commit_committer_check": false,
  "reject_unsigned_commits": false
2081 2082 2083
  ...
}
```
2084 2085 2086 2087 2088 2089 2090 2091 2092

### Add project push rule

Adds a push rule to a specified project.

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

2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105
| 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. |
2106
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commit when it is not signed through GPG. |
2107 2108 2109 2110 2111 2112 2113 2114 2115

### Edit project push rule

Edits a push rule for a specified project.

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

2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128
| 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. |
2129
| `reject_unsigned_commits` **(PREMIUM)**        | boolean        | no       | Reject commits when they are not GPG signed. |
2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141

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

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

2146 2147 2148
## Transfer a project to a new namespace

> Introduced in GitLab 11.1.
2149 2150 2151 2152 2153 2154 2155 2156 2157

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

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

2158 2159 2160 2161
## Branches

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

James Lopez's avatar
James Lopez committed
2162 2163
## Project Import/Export

James Lopez's avatar
James Lopez committed
2164
Read more in the [Project import/export](project_import_export.md) documentation.
James Lopez's avatar
James Lopez committed
2165

2166 2167 2168
## Project members

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

2170
## Start the pull mirroring process for a Project **(STARTER)**
2171

2172
> Introduced in [GitLab Starter](https://about.gitlab.com/pricing/) 10.3.
2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185

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

2186 2187 2188
## Project badges

Read more in the [Project Badges](project_badges.md) documentation.
2189 2190 2191

## Issue and merge request description templates

2192 2193
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).

2194
## Download snapshot of a Git repository
2195 2196 2197 2198 2199

> Introduced in GitLab 10.7

This endpoint may only be accessed by an administrative user.

2200
Download a snapshot of the project (or wiki, if requested) Git repository. This
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214
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 |
2215

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