projects.md 66.3 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-ee/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-ee/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) |
vanadium23's avatar
vanadium23 committed
61

62 63 64 65 66 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
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
97 98 99 100 101 102 103 104 105 106
```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",
107
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
vanadium23's avatar
vanadium23 committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    "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,
127
    "resolve_outdated_diff_discussions": false,
vanadium23's avatar
vanadium23 committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
    "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",
146
    "ci_default_git_depth": 50,
vanadium23's avatar
vanadium23 committed
147 148 149 150 151
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "request_access_enabled": false,
152
    "merge_method": "merge",
vanadium23's avatar
vanadium23 committed
153 154 155 156
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
157
      "wiki_size" : 0,
vanadium23's avatar
vanadium23 committed
158
      "lfs_objects_size": 0,
159 160
      "job_artifacts_size": 0,
      "packages_size": 0
161 162 163 164 165 166 167 168 169 170
    },
    "_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
171 172 173 174 175 176 177 178 179
  },
  {
    "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",
180
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
vanadium23's avatar
vanadium23 committed
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
    "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,
200
    "resolve_outdated_diff_discussions": false,
vanadium23's avatar
vanadium23 committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
    "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",
230
    "ci_default_git_depth": 0,
vanadium23's avatar
vanadium23 committed
231 232 233 234 235
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "request_access_enabled": false,
236
    "merge_method": "merge",
vanadium23's avatar
vanadium23 committed
237 238 239 240
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
241
      "wiki_size" : 0,
vanadium23's avatar
vanadium23 committed
242
      "lfs_objects_size": 0,
243 244
      "job_artifacts_size": 0,
      "packages_size": 0
245 246 247 248 249 250 251 252 253
    },
    "_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
254 255 256 257 258
    }
  }
]
```

259 260 261 262 263 264 265 266 267 268 269 270 271 272
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,
    ...
  }
]
```

273 274 275 276 277 278
You can filter by [custom attributes](custom_attributes.md) with:

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

279
## List user projects
vanadium23's avatar
vanadium23 committed
280

Davin Walker's avatar
Davin Walker committed
281
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
282 283 284 285 286 287 288 289 290 291 292 293 294

```
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 |
295
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
296
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
vanadium23's avatar
vanadium23 committed
297 298 299
| `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 |
300
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
301 302
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
303
| `with_programming_language` | string | no | Limit by projects which use the given programming language |
304
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
305

Nihad Abbasov's avatar
Nihad Abbasov committed
306 307 308
```json
[
  {
Marin Jankovski's avatar
Marin Jankovski committed
309
    "id": 4,
Nihad Abbasov's avatar
Nihad Abbasov committed
310 311
    "description": null,
    "default_branch": "master",
312
    "visibility": "private",
Marin Jankovski's avatar
Marin Jankovski committed
313 314 315
    "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",
316
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/master/README.md",
317 318 319 320
    "tag_list": [
      "example",
      "disapora client"
    ],
Nihad Abbasov's avatar
Nihad Abbasov committed
321
    "owner": {
Marin Jankovski's avatar
Marin Jankovski committed
322 323
      "id": 3,
      "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
324
      "created_at": "2013-09-30T13:46:02Z"
Nihad Abbasov's avatar
Nihad Abbasov committed
325
    },
Marin Jankovski's avatar
Marin Jankovski committed
326 327 328 329 330
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
331
    "open_issues_count": 1,
Marin Jankovski's avatar
Marin Jankovski committed
332
    "merge_requests_enabled": true,
333
    "jobs_enabled": true,
Nihad Abbasov's avatar
Nihad Abbasov committed
334
    "wiki_enabled": true,
Marin Jankovski's avatar
Marin Jankovski committed
335
    "snippets_enabled": false,
336
    "resolve_outdated_diff_discussions": false,
337
    "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
338 339
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
340
    "creator_id": 3,
Marin Jankovski's avatar
Marin Jankovski committed
341 342 343 344
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
345 346
      "kind": "group",
      "full_path": "diaspora"
347
    },
348
    "import_status": "none",
sue445's avatar
sue445 committed
349
    "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
350 351 352
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png",
    "shared_runners_enabled": true,
    "forks_count": 0,
353 354
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
355
    "ci_default_git_depth": 50,
356
    "public_jobs": true,
357
    "shared_with_groups": [],
358
    "only_allow_merge_if_pipeline_succeeds": false,
359
    "only_allow_merge_if_all_discussions_are_resolved": false,
360
    "request_access_enabled": false,
361
    "merge_method": "merge",
362 363 364 365
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
366
      "wiki_size" : 0,
367
      "lfs_objects_size": 0,
368 369
      "job_artifacts_size": 0,
      "packages_size": 0
370 371 372 373 374 375 376 377 378
    },
    "_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"
379
    }
Nihad Abbasov's avatar
Nihad Abbasov committed
380 381
  },
  {
Marin Jankovski's avatar
Marin Jankovski committed
382
    "id": 6,
Nihad Abbasov's avatar
Nihad Abbasov committed
383
    "description": null,
Marin Jankovski's avatar
Marin Jankovski committed
384
    "default_branch": "master",
385
    "visibility": "private",
Marin Jankovski's avatar
Marin Jankovski committed
386 387 388
    "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",
389
    "readme_url": "http://example.com/brightbox/puppet/blob/master/README.md",
390 391 392 393
    "tag_list": [
      "example",
      "puppet"
    ],
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
394
    "owner": {
Marin Jankovski's avatar
Marin Jankovski committed
395 396 397
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
Nihad Abbasov's avatar
Nihad Abbasov committed
398
    },
Marin Jankovski's avatar
Marin Jankovski committed
399 400 401 402
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
Nihad Abbasov's avatar
Nihad Abbasov committed
403
    "issues_enabled": true,
404
    "open_issues_count": 1,
Nihad Abbasov's avatar
Nihad Abbasov committed
405
    "merge_requests_enabled": true,
406
    "jobs_enabled": true,
Nihad Abbasov's avatar
Nihad Abbasov committed
407
    "wiki_enabled": true,
Marin Jankovski's avatar
Marin Jankovski committed
408
    "snippets_enabled": false,
409
    "resolve_outdated_diff_discussions": false,
410
    "container_registry_enabled": false,
Marin Jankovski's avatar
Marin Jankovski committed
411 412
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
413
    "creator_id": 3,
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
414
    "namespace": {
Marin Jankovski's avatar
Marin Jankovski committed
415 416 417
      "id": 4,
      "name": "Brightbox",
      "path": "brightbox",
418 419
      "kind": "group",
      "full_path": "brightbox"
420
    },
421 422
    "import_status": "none",
    "import_error": null,
423 424 425 426 427 428 429 430 431 432
    "permissions": {
      "project_access": {
        "access_level": 10,
        "notification_level": 3
      },
      "group_access": {
        "access_level": 50,
        "notification_level": 3
      }
    },
sue445's avatar
sue445 committed
433
    "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
434 435 436 437
    "avatar_url": null,
    "shared_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
438
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
439
    "ci_default_git_depth": 0,
440
    "public_jobs": true,
441
    "shared_with_groups": [],
442
    "only_allow_merge_if_pipeline_succeeds": false,
443
    "only_allow_merge_if_all_discussions_are_resolved": false,
444
    "request_access_enabled": false,
445
    "merge_method": "merge",
446 447 448 449
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
450
      "wiki_size" : 0,
451
      "lfs_objects_size": 0,
452 453
      "job_artifacts_size": 0,
      "packages_size": 0
454 455 456 457 458 459 460 461 462
    },
    "_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"
463
    }
464 465 466 467
  }
]
```

468
## Get single project
Nihad Abbasov's avatar
Nihad Abbasov committed
469

470 471
Get a specific project. This endpoint can be accessed without authentication if
the project is publicly accessible.
Nihad Abbasov's avatar
Nihad Abbasov committed
472 473 474 475 476

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

477 478
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
479
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
480
| `statistics` | boolean | no | Include project statistics |
481
| `license` | boolean | no | Include project license data |
482
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
Nihad Abbasov's avatar
Nihad Abbasov committed
483

484 485
```json
{
Marin Jankovski's avatar
Marin Jankovski committed
486
  "id": 3,
487
  "description": null,
Marin Jankovski's avatar
Marin Jankovski committed
488
  "default_branch": "master",
489
  "visibility": "private",
Marin Jankovski's avatar
Marin Jankovski committed
490 491 492
  "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",
493
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
494 495 496 497
  "tag_list": [
    "example",
    "disapora project"
  ],
498
  "owner": {
Marin Jankovski's avatar
Marin Jankovski committed
499 500
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
501
    "created_at": "2013-09-30T13:46:02Z"
502
  },
Marin Jankovski's avatar
Marin Jankovski committed
503 504 505 506
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
507
  "issues_enabled": true,
508
  "open_issues_count": 1,
509
  "merge_requests_enabled": true,
510
  "jobs_enabled": true,
511
  "wiki_enabled": true,
Marin Jankovski's avatar
Marin Jankovski committed
512
  "snippets_enabled": false,
513
  "resolve_outdated_diff_discussions": false,
514
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
515 516
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
517
  "creator_id": 3,
Marin Jankovski's avatar
Marin Jankovski committed
518 519 520 521
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
522
    "kind": "group",
523 524 525
    "full_path": "diaspora",
    "avatar_url": "http://localhost:3000/uploads/group/avatar/3/foo.jpg",
    "web_url": "http://localhost:3000/groups/diaspora"
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
526
  },
527 528
  "import_status": "none",
  "import_error": null,
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
529 530 531 532 533 534 535 536 537
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
538
  },
sue445's avatar
sue445 committed
539
  "archived": false,
Tomasz Maczukin's avatar
Tomasz Maczukin committed
540
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
541 542 543 544 545 546 547 548
  "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"
  },
Tomasz Maczukin's avatar
Tomasz Maczukin committed
549 550 551
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
552
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
553
  "ci_default_git_depth": 50,
554
  "public_jobs": true,
555 556 557 558
  "shared_with_groups": [
    {
      "group_id": 4,
      "group_name": "Twitter",
559
      "group_full_path": "twitter",
560 561 562 563 564
      "group_access_level": 30
    },
    {
      "group_id": 3,
      "group_name": "Gitlab Org",
565
      "group_full_path": "gitlab-org",
566 567
      "group_access_level": 10
    }
568
  ],
569
  "repository_storage": "default",
570
  "only_allow_merge_if_pipeline_succeeds": false,
571
  "only_allow_merge_if_all_discussions_are_resolved": false,
572
  "printing_merge_requests_link_enabled": true,
573
  "request_access_enabled": false,
574
  "merge_method": "merge",
575 576 577 578
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
579
    "wiki_size" : 0,
580
    "lfs_objects_size": 0,
581 582
    "job_artifacts_size": 0,
    "packages_size": 0
583 584 585 586 587 588 589 590 591
  },
  "_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"
592
  }
593 594 595
}
```

596 597 598 599 600 601 602 603 604 605 606 607
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,
  ...
}
```

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

610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632
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",
      "path":"gitlab-ce",
      "path_with_namespace":"gitlab-org/gitlab-ce",
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"master",
      "tag_list":[],
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-ce.git",
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-ce.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-ce",
      "avatar_url":"https://assets.gitlab-static.net/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
633 634 635 636 637 638 639 640
      "license_url": "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/LICENSE",
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT",
      },
641 642
      "star_count":3812,
      "forks_count":3561,
643 644 645 646 647 648 649 650 651
      "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
      }
652 653 654 655 656 657 658
   }

   ...

}
```

659
## Get project users
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
660

661
Get the users list of a project.
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
662

663 664 665
```
GET /projects/:id/users
```
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
666

667 668
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
669 670
| `search` | string | no | Search for specific users |

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
671
```json
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
672 673
[
  {
674 675 676 677 678 679
    "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
680
  },
Johannes Schleifenbaum's avatar
Johannes Schleifenbaum committed
681
  {
682 683 684 685 686 687
    "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
688 689
  }
]
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
690 691
```

692
## Get project events
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
693

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

696
## Create project
697

698
Creates a new project owned by the authenticated user.
699 700 701 702 703

```
POST /projects
```

704 705
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
706 707
| `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). |
708
| `namespace_id` | integer | no | Namespace for the new project (defaults to the current user's namespace) |
709
| `default_branch` | string | no | `master` by default |
710 711 712
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
713
| `jobs_enabled` | boolean | no | Enable jobs for this project |
714 715
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
716
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
717 718
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
719
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
720
| `import_url` | string | no | URL to import repository from |
721
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
722
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
723
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
724
| `merge_method` | string | no | Set the merge method used |
725 726
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
727
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
728
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
729
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
730
| `ci_config_path` | string | no | The path to CI config file |
731
| `repository_storage` | string | no | Which storage shard the repository is on. Available only to admins |
732 733 734
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
| `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
735
| `initialize_with_readme` | boolean | no | `false` by default |
736

737
NOTE: **Note:** If your HTTP repository is not publicly accessible,
738 739 740
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.

741
## Create project for user
742

743
Creates a new project owned by the specified user. Available only for admins.
744 745 746 747 748

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

749 750 751 752 753 754 755 756 757
| 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 |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
758
| `jobs_enabled` | boolean | no | Enable jobs for this project |
759 760
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
761
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
762 763
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
764
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
765
| `import_url` | string | no | URL to import repository from |
766
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
767
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
768
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
769
| `merge_method` | string | no | Set the merge method used |
770 771
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
772
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
773
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
774
| `printing_merge_request_link_enabled` | boolean | no | Show link to create/view merge request when pushing from the command line |
775
| `ci_config_path` | string | no | The path to CI config file |
776
| `repository_storage` | string | no | Which storage shard the repository is on. Available only to admins |
777 778 779 780
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge requests by default |
| `external_authorization_classification_label` | string | no | **(CORE ONLY)** The classification label for the project |
| `mirror` | boolean | no | **(STARTER)** Enables pull mirroring in a project |
| `mirror_trigger_builds` | boolean | no | **(STARTER)** Pull mirroring triggers builds |
781

782
NOTE: **Note:** If your HTTP repository is not publicly accessible,
783 784
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.
785

786
## Edit project
787

788
Updates an existing project.
789 790 791 792 793

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

794 795
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
796
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
797
| `name` | string | no | The name of the project |
798
| `path` | string | no | Custom repository name for the project. By default generated based on name |
799
| `default_branch` | string | no | `master` by default |
800 801 802
| `description` | string | no | Short project description |
| `issues_enabled` | boolean | no | Enable issues for this project |
| `merge_requests_enabled` | boolean | no | Enable merge requests for this project |
803
| `jobs_enabled` | boolean | no | Enable jobs for this project |
804 805
| `wiki_enabled` | boolean | no | Enable wiki for this project |
| `snippets_enabled` | boolean | no | Enable snippets for this project |
806
| `resolve_outdated_diff_discussions` | boolean | no | Automatically resolve merge request diffs discussions on lines changed with a push |
807 808
| `container_registry_enabled` | boolean | no | Enable container registry for this project |
| `shared_runners_enabled` | boolean | no | Enable shared runners for this project |
809
| `visibility` | string | no | See [project visibility level](#project-visibility-level) |
810
| `import_url` | string | no | URL to import repository from |
811
| `public_builds` | boolean | no | If `true`, jobs can be viewed by non-project-members |
812
| `only_allow_merge_if_pipeline_succeeds` | boolean | no | Set whether merge requests can only be merged with successful jobs |
813
| `only_allow_merge_if_all_discussions_are_resolved` | boolean | no | Set whether merge requests can only be merged when all the discussions are resolved |
814
| `merge_method` | string | no | Set the merge method used |
815 816
| `lfs_enabled` | boolean | no | Enable LFS |
| `request_access_enabled` | boolean | no | Allow users to request member access |
817
| `tag_list`    | array   | no       | The list of tags for a project; put array of tags, that should be finally assigned to a project |
818
| `avatar`    | mixed   | no      | Image file for avatar of the project                |
819
| `ci_config_path` | string | no | The path to CI config file |
820
| `ci_default_git_depth` | integer | no | Default number of revisions for [shallow cloning](../user/project/pipelines/settings.md#git-shallow-clone) |
821
| `repository_storage` | string | no | Which storage shard the repository is on. Available only to admins |
822 823 824 825 826 827 828 829
| `approvals_before_merge` | integer | no | **(STARTER)** How many approvers should approve merge request by default |
| `external_authorization_classification_label` | string | no | **(CORE ONLY)** The classification label for the project |
| `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 |
830

831
NOTE: **Note:** If your HTTP repository is not publicly accessible,
832 833
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.
834

835
## Fork project
836

837
Forks a project into the user namespace of the authenticated user or the one provided.
838

839 840 841
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.
842

843
```
844
POST /projects/:id/fork
845 846
```

847 848
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
849
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
850
| `namespace` | integer/string | yes | The ID or path of the namespace that the project will be forked to |
851 852
| `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 |
853

854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
## 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 |
872
| `simple` | boolean | no | Return only limited fields for each project. This is a no-op without authentication as then _only_ simple fields are returned. |
873
| `owned` | boolean | no | Limit by projects explicitly owned by the current user |
874 875 876
| `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 |
877
| `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only) |
878 879
| `with_issues_enabled` | boolean | no | Limit by enabled issues feature |
| `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature |
880
| `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) |
881 882

```bash
883
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/forks"
884 885 886 887 888 889 890 891 892 893 894 895 896 897
```

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",
898
    "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935
    "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,
    "request_access_enabled": false,
936
    "merge_method": "merge",
937 938 939 940 941 942 943 944 945 946 947 948 949
    "_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"
    }
  }
]
```

950
## Star a project
951

952
Stars a given project. Returns status code `304` if the project is already starred.
953 954 955 956 957 958 959

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

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

```bash
963
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/star"
964 965 966 967 968 969 970 971 972
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
973
  "visibility": "internal",
974 975 976
  "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",
977
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
978 979 980 981 982 983 984 985 986 987 988
  "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,
989
  "jobs_enabled": true,
990 991
  "wiki_enabled": true,
  "snippets_enabled": false,
992
  "resolve_outdated_diff_discussions": false,
993
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
994 995
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
996 997 998 999 1000
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1001 1002
    "kind": "group",
    "full_path": "diaspora"
1003
  },
1004
  "import_status": "none",
1005 1006
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1007 1008 1009 1010 1011 1012 1013 1014
  "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"
  },
1015 1016
  "shared_runners_enabled": true,
  "forks_count": 0,
1017
  "star_count": 1,
1018
  "public_jobs": true,
1019
  "shared_with_groups": [],
1020
  "only_allow_merge_if_pipeline_succeeds": false,
1021
  "only_allow_merge_if_all_discussions_are_resolved": false,
1022
  "request_access_enabled": false,
1023
  "merge_method": "merge",
1024 1025 1026 1027 1028 1029 1030 1031 1032
  "_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"
  }
1033 1034 1035
}
```

1036
## Unstar a project
1037

1038
Unstars a given project. Returns status code `304` if the project is not starred.
1039 1040

```
1041
POST /projects/:id/unstar
1042 1043 1044 1045
```

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

```bash
1049
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unstar"
1050 1051 1052 1053 1054 1055 1056 1057 1058
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1059
  "visibility": "internal",
1060 1061 1062
  "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",
1063
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
  "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,
1075
  "jobs_enabled": true,
1076 1077
  "wiki_enabled": true,
  "snippets_enabled": false,
1078
  "resolve_outdated_diff_discussions": false,
1079
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1080 1081
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1082 1083 1084 1085 1086
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1087 1088
    "kind": "group",
    "full_path": "diaspora"
1089
  },
1090
  "import_status": "none",
1091 1092
  "archived": true,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
1093 1094 1095 1096 1097 1098 1099 1100
  "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"
  },
1101 1102
  "shared_runners_enabled": true,
  "forks_count": 0,
1103
  "star_count": 0,
1104
  "public_jobs": true,
1105
  "shared_with_groups": [],
1106
  "only_allow_merge_if_pipeline_succeeds": false,
1107
  "only_allow_merge_if_all_discussions_are_resolved": false,
1108
  "request_access_enabled": false,
1109
  "merge_method": "merge",
1110 1111 1112 1113 1114 1115 1116 1117 1118
  "_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"
  }
1119 1120 1121
}
```

1122 1123 1124 1125 1126 1127 1128 1129 1130
## Languages

Get languages used in a project with percentage value.

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

```bash
1131
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/languages"
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
```

Example response:

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

1145
## Archive a project
1146

1147
Archives the project if the user is either admin or the project owner of this project. This action is
1148 1149 1150
idempotent, thus archiving an already archived project will not change the project.

```
1151
POST /projects/:id/archive
1152 1153 1154 1155
```

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

```bash
1159
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/archive"
1160 1161 1162 1163 1164 1165 1166 1167 1168
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1169
  "visibility": "private",
1170 1171 1172
  "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",
1173
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1174 1175 1176 1177 1178 1179 1180
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1181
    "created_at": "2013-09-30T13:46:02Z"
1182 1183 1184 1185 1186 1187 1188 1189
  },
  "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,
1190
  "jobs_enabled": true,
1191 1192
  "wiki_enabled": true,
  "snippets_enabled": false,
1193
  "resolve_outdated_diff_discussions": false,
1194
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1195 1196
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1197 1198 1199 1200 1201
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1202 1203
    "kind": "group",
    "full_path": "diaspora"
1204
  },
1205 1206
  "import_status": "none",
  "import_error": null,
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
  "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",
1219 1220 1221 1222 1223 1224 1225 1226
  "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"
  },
1227 1228 1229
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1230
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1231
  "ci_default_git_depth": 50,
1232
  "public_jobs": true,
1233
  "shared_with_groups": [],
1234
  "only_allow_merge_if_pipeline_succeeds": false,
1235
  "only_allow_merge_if_all_discussions_are_resolved": false,
1236
  "request_access_enabled": false,
1237
  "merge_method": "merge",
1238 1239 1240 1241 1242 1243 1244 1245 1246
  "_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"
  }
1247 1248 1249
}
```

1250
## Unarchive a project
1251

1252
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
1253
idempotent, thus unarchiving a non-archived project will not change the project.
1254 1255

```
Sergey Gnuskov's avatar
Sergey Gnuskov committed
1256
POST /projects/:id/unarchive
1257 1258 1259 1260
```

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

```bash
1264
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/unarchive"
1265 1266 1267 1268 1269 1270 1271 1272 1273
```

Example response:

```json
{
  "id": 3,
  "description": null,
  "default_branch": "master",
1274
  "visibility": "private",
1275 1276 1277
  "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",
1278
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/master/README.md",
1279 1280 1281 1282 1283 1284 1285
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
Ben Boeckel's avatar
Ben Boeckel committed
1286
    "created_at": "2013-09-30T13:46:02Z"
1287 1288 1289 1290 1291 1292 1293 1294
  },
  "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,
1295
  "jobs_enabled": true,
1296 1297
  "wiki_enabled": true,
  "snippets_enabled": false,
1298
  "resolve_outdated_diff_discussions": false,
1299
  "container_registry_enabled": false,
Ben Boeckel's avatar
Ben Boeckel committed
1300 1301
  "created_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
1302 1303 1304 1305 1306
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
1307 1308
    "kind": "group",
    "full_path": "diaspora"
1309
  },
1310 1311
  "import_status": "none",
  "import_error": null,
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323
  "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",
1324 1325 1326 1327 1328 1329 1330 1331
  "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"
  },
1332 1333 1334
  "shared_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
1335
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
1336
  "ci_default_git_depth": 50,
1337
  "public_jobs": true,
1338
  "shared_with_groups": [],
1339
  "only_allow_merge_if_pipeline_succeeds": false,
1340
  "only_allow_merge_if_all_discussions_are_resolved": false,
1341
  "request_access_enabled": false,
1342
  "merge_method": "merge",
1343 1344 1345 1346 1347 1348 1349 1350 1351
  "_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"
  }
1352 1353 1354
}
```

1355
## Remove project
1356

1357
Removes a project including all associated resources (issues, merge requests etc).
1358 1359 1360 1361 1362

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

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

1367
## Upload a file
1368 1369 1370 1371 1372 1373 1374

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

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

1375 1376
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1377
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1378
| `file` | string | yes | The file to be uploaded |
1379

1380 1381 1382 1383 1384 1385
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
1386
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads
1387 1388 1389 1390
```

Returned object:

1391 1392 1393 1394 1395 1396 1397 1398
```json
{
  "alt": "dk",
  "url": "/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png",
  "markdown": "![dk](/uploads/66dbcd21ec5d24ed6ea225176098d52b/dk.png)"
}
```

1399
>**Note**: The returned `url` is relative to the project path.
1400 1401
In Markdown contexts, the link is automatically expanded when the format in
`markdown` is used.
1402

1403
## Share project with group
1404 1405 1406 1407 1408 1409 1410

Allow to share project with group.

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

1411 1412
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1413
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1414
| `group_id` | integer | yes | The ID of the group to share with |
1415
| `group_access` | integer | yes | The [permissions level](members.md) to grant the group |
1416
| `expires_at` | string | no | Share expiration date in ISO 8601 format: 2016-09-26 |
1417

1418
## Delete a shared project link within a group
1419 1420 1421 1422 1423 1424 1425 1426 1427

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

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

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

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

1435 1436
## Hooks

1437 1438 1439
Also called Project Hooks and Webhooks.
These are different for [System Hooks](system_hooks.md) that are system wide.

1440 1441
### List project hooks

1442
Get a list of project hooks.
miks's avatar
miks committed
1443 1444 1445 1446 1447

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

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

1452
### Get project hook
1453

1454
Get a specific hook for a project.
1455 1456 1457 1458 1459

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

1460 1461
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1462
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1463
| `hook_id` | integer | yes | The ID of a project hook |
1464

1465 1466 1467 1468
```json
{
  "id": 1,
  "url": "http://example.com/hook",
1469
  "project_id": 3,
Ben Boeckel's avatar
Ben Boeckel committed
1470
  "push_events": true,
1471
  "push_events_branch_filter": "",
Ben Boeckel's avatar
Ben Boeckel committed
1472
  "issues_events": true,
1473
  "confidential_issues_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1474
  "merge_requests_events": true,
1475
  "tag_push_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1476
  "note_events": true,
1477
  "job_events": true,
1478
  "pipeline_events": true,
1479
  "wiki_page_events": true,
Ben Boeckel's avatar
Ben Boeckel committed
1480
  "enable_ssl_verification": true,
1481 1482 1483 1484 1485 1486
  "created_at": "2012-10-12T17:04:47Z"
}
```

### Add project hook

1487
Adds a hook to a specified project.
miks's avatar
miks committed
1488 1489 1490 1491 1492

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

1493 1494
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1495
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1496 1497
| `url` | string | yes | The hook URL |
| `push_events` | boolean | no | Trigger hook on push events |
1498
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1499
| `issues_events` | boolean | no | Trigger hook on issues events |
1500
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1501 1502 1503
| `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 |
1504
| `job_events` | boolean | no | Trigger hook on job events |
1505
| `pipeline_events` | boolean | no | Trigger hook on pipeline events |
1506
| `wiki_page_events` | boolean | no | Trigger hook on wiki events |
1507
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
1508
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1509

1510 1511
### Edit project hook

1512
Edits a hook for a specified project.
1513 1514 1515 1516 1517

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

1518 1519
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1520
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1521 1522 1523
| `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 |
1524
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
1525
| `issues_events` | boolean | no | Trigger hook on issues events |
1526
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
1527 1528 1529
| `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 |
1530
| `job_events` | boolean | no | Trigger hook on job events |
1531 1532 1533
| `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 |
1534
| `token` | string | no | Secret token to validate received payloads; this will not be returned in the response |
1535

1536
### Delete project hook
miks's avatar
miks committed
1537

1538
Removes a hook from a project. This is an idempotent method and can be called multiple times.
1539
Either the hook is available or not.
miks's avatar
miks committed
1540 1541

```
1542
DELETE /projects/:id/hooks/:hook_id
miks's avatar
miks committed
1543 1544
```

1545 1546
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1547
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1548
| `hook_id` | integer | yes | The ID of the project hook |
miks's avatar
miks committed
1549

1550 1551
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.
1552

1553
## Fork relationship
1554

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

1557
### Create a forked from/to relation between existing projects
1558

1559 1560 1561 1562 1563
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.

1564 1565 1566 1567
```
POST /projects/:id/fork/:forked_from_id
```

1568 1569
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1570
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
1571
| `forked_from_id` | ID | yes | The ID of the project that was forked from |
1572 1573 1574 1575 1576 1577 1578

### Delete an existing forked from relationship

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

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

## Search for projects by name

1585 1586 1587
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.
1588 1589

```
1590
GET /projects
1591 1592
```

1593 1594
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
1595
| `search` | string | yes | A string contained in the project name |
1596
| `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields |
1597
| `sort` | string | no | Return requests sorted in `asc` or `desc` order |
1598

1599
```bash
1600
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects?search=test
1601 1602
```

1603 1604
## Start the Housekeeping task for a Project

1605
> Introduced in GitLab 9.0.
1606 1607 1608 1609 1610

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

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

1615
## Push Rules **(STARTER)**
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645

### 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+\..*",
  "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,
  "commit_committer_check": false
}
```

1646 1647
Users on GitLab [Premium, Silver, or higher](https://about.gitlab.com/pricing/) will also see
the `commit_committer_check` parameter:
1648

1649 1650 1651 1652 1653 1654 1655 1656
```json
{
  "id": 1,
  "project_id": 3,
  "commit_committer_check": false
  ...
}
```
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668

### Add project push rule

Adds a push rule to a specified project.

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

| Attribute                              | Type           | Required | Description |
| -------------------------------------- | -------------- | -------- | ----------- |
| `id`                                   | integer/string | yes      | The ID of the project or NAMESPACE/PROJECT_NAME |
1669 1670 1671 1672 1673 1674 1675 1676 1677
| `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+\..*` |
| `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. |
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689

### Edit project push rule

Edits a push rule for a specified project.

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

| Attribute                              | Type           | Required | Description |
| -------------------------------------- | -------------- | -------- | ----------- |
| `id`                                   | integer/string | yes      | The ID of the project or NAMESPACE/PROJECT_NAME |
1690 1691 1692 1693 1694 1695 1696 1697 1698
| `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+\..*` |
| `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. |
1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710

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

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

1715 1716 1717
## Transfer a project to a new namespace

> Introduced in GitLab 11.1.
1718 1719 1720 1721 1722 1723 1724 1725 1726

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

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

1727 1728 1729 1730
## Branches

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

James Lopez's avatar
James Lopez committed
1731 1732
## Project Import/Export

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

1735 1736 1737
## Project members

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

1739
## Start the pull mirroring process for a Project **(STARTER)**
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754

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

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

1755 1756 1757
## Project badges

Read more in the [Project Badges](project_badges.md) documentation.
1758 1759 1760

## Issue and merge request description templates

1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783
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).

## Download snapshot of a git repository

> Introduced in GitLab 10.7

This endpoint may only be accessed by an administrative user.

Download a snapshot of the project (or wiki, if requested) git repository. This
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 |
1784

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