projects

Create a fork of a project

Creates a fork of a project.

post/api/v4/projects/{id}/fork

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project

Request body

namespacestring

(deprecated) The ID or name of the namespace that the project will be forked into

namespace_idinteger

The ID of the namespace that the project will be forked into

namespace_pathstring

The path of the namespace that the project will be forked into

pathstring

The path that will be assigned to the fork

namestring

The name that will be assigned to the fork

descriptionstring

The description that will be assigned to the fork

visibility'private' | 'internal' | 'public'

The visibility of the fork

mr_default_target_selfboolean

Merge requests of this forked project targets itself by default

branchesstring

Branches to fork

Example request

{
  "namespace": "gitlab",
  "namespace_id": 1,
  "namespace_path": "new_path/gitlab",
  "path": "fork",
  "name": "Fork",
  "description": "Description"
}

Response

Create a fork of a project

idinteger required
descriptionstring required
namestring required
name_with_namespacestring required
pathstring required
path_with_namespacestring required
created_atstring date-time required
default_branchstring
tag_liststring[] required
topicsstring[] required
ssh_url_to_repostring required
http_url_to_repostring required
web_urlstring required
readme_urlstring
forks_countinteger
license_urlstring
avatar_urlstring required
star_countinteger required
last_activity_atstring date-time required
visibilitystring required
repository_storagestring
container_registry_image_prefixstring
marked_for_deletion_atstring date-time required
marked_for_deletion_onstring date-time required
packages_enabledboolean required
empty_repoboolean required
archivedboolean required
resolve_outdated_diff_discussionsboolean required
repository_object_formatstring required
issues_enabledboolean required
merge_requests_enabledboolean required
wiki_enabledboolean required
jobs_enabledboolean required
snippets_enabledboolean required
container_registry_enabledboolean required
service_desk_enabledboolean required
service_desk_addressstring
can_create_merge_request_inboolean required
issues_access_levelstring required
repository_access_levelstring required
merge_requests_access_levelstring required
forking_access_levelstring required
wiki_access_levelstring required
builds_access_levelstring required
snippets_access_levelstring required
pages_access_levelstring required
analytics_access_levelstring required
container_registry_access_levelstring required
security_and_compliance_access_levelstring required
releases_access_levelstring required
environments_access_levelstring required
feature_flags_access_levelstring required
infrastructure_access_levelstring required
monitor_access_levelstring required
model_experiments_access_levelstring required
model_registry_access_levelstring required
package_registry_access_levelstring required
emails_disabledboolean required
emails_enabledboolean required
show_diff_preview_in_emailboolean required
shared_runners_enabledboolean required
lfs_enabledboolean required
creator_idinteger required
mr_default_target_selfboolean
import_urlstring
import_typestring
import_statusstring required
import_errorstring
open_issues_countinteger
description_htmlstring required
updated_atstring date-time required
ci_default_git_depthinteger
ci_delete_pipelines_in_secondsinteger
ci_forward_deployment_enabledboolean
ci_forward_deployment_rollback_allowedboolean
ci_job_token_scope_enabledboolean
ci_separated_cachesboolean
ci_allow_fork_pipelines_to_run_in_parent_projectboolean
ci_id_token_sub_claim_componentsstring[]
build_git_strategystring
keep_latest_artifactboolean
restrict_user_defined_variablesboolean
ci_pipeline_variables_minimum_override_rolestring
runner_token_expiration_intervalinteger
group_runners_enabledboolean
resource_group_default_process_modestring
auto_cancel_pending_pipelinesstring
build_timeoutinteger
auto_devops_enabledboolean
auto_devops_deploy_strategystring
ci_push_repository_for_job_token_allowedboolean
protect_merge_request_pipelinesboolean
ci_display_pipeline_variablesboolean
runners_tokenstring
ci_config_pathstring
public_jobsboolean required
shared_with_groupsobject[] required
only_allow_merge_if_pipeline_succeedsboolean required
allow_merge_on_skipped_pipelineboolean required
request_access_enabledboolean required
only_allow_merge_if_all_discussions_are_resolvedboolean required
remove_source_branch_after_mergeboolean required
printing_merge_request_link_enabledboolean required
merge_methodstring required
squash_optionstring required
enforce_auth_checks_on_uploadsboolean required
suggestion_commit_messagestring required
merge_commit_templatestring required
squash_commit_templatestring required
mr_default_title_templatestring required
issue_branch_templatestring required
warn_about_potentially_unwanted_charactersboolean required
autoclose_referenced_issuesboolean required
max_artifacts_sizeinteger required
approvals_before_mergestring
mirrorstring
mirror_user_idstring
mirror_trigger_buildsstring
only_mirror_protected_branchesstring
mirror_overwrites_diverged_branchesstring
external_authorization_classification_labelstring
requirements_enabledstring required
requirements_access_levelstring required
security_and_compliance_enabledstring required
secret_push_protection_enabledboolean
pre_receive_secret_detection_enabledboolean
compliance_frameworksstring required
issues_templatestring
merge_requests_templatestring
ci_restrict_pipeline_cancellation_rolestring
merge_pipelines_enabledstring
merge_trains_enabledstring
merge_trains_skip_train_allowedstring
merge_train_enforcementstring
max_pipelines_per_merge_trainstring
only_allow_merge_if_all_status_checks_passedstring
allow_pipeline_trigger_approve_deploymentboolean
prevent_merge_without_jira_issuestring
auto_duo_code_review_enabledstring
reviewer_assignment_strategystring
duo_remote_flows_enabledstring
duo_foundational_flows_enabledstring
duo_sast_fp_detection_enabledstring
duo_secret_detection_fp_enabledstring
duo_dependency_bump_breaking_changes_enabledstring
duo_sast_vr_workflow_enabledstring
web_based_commit_signing_enabledstring
spp_repository_pipeline_accessboolean

The spp_repository_pipeline_access setting is only visible if the security_orchestration_policies feature is available.

security_policy_pipeline_must_succeedboolean

Require all security policy pipelines to succeed before merge requests can be merged.

merge_request_title_regexstring
merge_request_title_regex_descriptionstring

Example response

{
  "id": 1,
  "description": "desc",
  "name": "project1",
  "name_with_namespace": "John Doe / project1",
  "path": "project1",
  "path_with_namespace": "namespace1/project1",
  "created_at": "2020-05-07T04:27:17.016Z",
  "default_branch": "main",
  "tag_list": [
    "tag"
  ],
  "topics": [
    "topic"
  ],
  "ssh_url_to_repo": "git@gitlab.example.com:gitlab/gitlab.git",
  "http_url_to_repo": "https://gitlab.example.com/gitlab/gitlab.git",
  "web_url": "https://gitlab.example.com/gitlab/gitlab",
  "readme_url": "https://gitlab.example.com/gitlab/gitlab/blob/master/README.md",
  "forks_count": 1,
  "license_url": "https://gitlab.example.com/gitlab/gitlab/blob/master/LICENCE",
  "license": {
    "key": "gpl-3.0",
    "name": "GNU General Public License v3.0",
    "nickname": "GNU GPLv3",
    "html_url": "http://choosealicense.com/licenses/gpl-3.0"
  },
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "star_count": 1,
  "last_activity_at": "2013-09-30T13:46:02Z",
  "visibility": "public",
  "namespace": {
    "id": 2,
    "name": "project",
    "path": "my_project",
    "kind": "project",
    "full_path": "group/my_project",
    "parent_id": 1,
    "avatar_url": "https://example.com/avatar/12345",
    "web_url": "https://example.com/group/my_project"
  },
  "custom_attributes": {
    "key": "foo",
    "value": "bar"
  },
  "repository_storage": "default",
  "forked_from_project": {
    "id": 1,
    "description": "desc",
    "name": "project1",
    "name_with_namespace": "John Doe / project1",
    "path": "project1",
    "path_with_namespace": "namespace1/project1",
    "created_at": "2020-05-07T04:27:17.016Z",
    "default_branch": "main",
    "tag_list": [
      "tag"
    ],
    "topics": [
      "topic"
    ],
    "ssh_url_to_repo": "git@gitlab.example.com:gitlab/gitlab.git",
    "http_url_to_repo": "https://gitlab.example.com/gitlab/gitlab.git",
    "web_url": "https://gitlab.example.com/gitlab/gitlab",
    "readme_url": "https://gitlab.example.com/gitlab/gitlab/blob/master/README.md",
    "forks_count": 1,
    "license_url": "https://gitlab.example.com/gitlab/gitlab/blob/master/LICENCE",
    "license": {
      "key": "gpl-3.0",
      "name": "GNU General Public License v3.0",
      "nickname": "GNU GPLv3",
      "html_url": "http://choosealicense.com/licenses/gpl-3.0"
    },
    "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
    "star_count": 1,
    "last_activity_at": "2013-09-30T13:46:02Z",
    "visibility": "public",
    "namespace": {
      "id": 2,
      "name": "project",
      "path": "my_project",
      "kind": "project",
      "full_path": "group/my_project",
      "parent_id": 1,
      "avatar_url": "https://example.com/avatar/12345",
      "web_url": "https://example.com/group/my_project"
    },
    "custom_attributes": {
      "key": "foo",
      "value": "bar"
    },
    "repository_storage": "default"
  },
  "container_registry_image_prefix": "registry.gitlab.example.com/gitlab/gitlab-client",
  "_links": {
    "self": "https://gitlab.example.com/api/v4/projects/4",
    "issues": "https://gitlab.example.com/api/v4/projects/4/issues",
    "merge_requests": "https://gitlab.example.com/api/v4/projects/4/merge_requests",
    "repo_branches": "https://gitlab.example.com/api/v4/projects/4/repository/branches",
    "labels": "https://gitlab.example.com/api/v4/projects/4/labels",
    "events": "https://gitlab.example.com/api/v4/projects/4/events",
    "members": "https://gitlab.example.com/api/v4/projects/4/members",
    "cluster_agents": "https://gitlab.example.com/api/v4/projects/4/cluster_agents"
  },
  "marked_for_deletion_at": "2020-05-07T04:27:17.016Z",
  "marked_for_deletion_on": "2020-05-07T04:27:17.016Z",
  "owner": {
    "id": 1,
    "username": "admin",
    "public_email": "john@example.com",
    "name": "Administrator",
    "state": "active",
    "avatar_url": "https://gravatar.com/avatar/1",
    "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
    "custom_attributes": [
      {
        "key": "foo",
        "value": "bar"
      }
    ],
    "web_url": "https://gitlab.example.com/root"
  },
  "repository_object_format": "sha1",
  "service_desk_address": "address@example.com",
  "issues_access_level": "enabled",
  "repository_access_level": "enabled",
  "merge_requests_access_level": "enabled",
  "forking_access_level": "enabled",
  "wiki_access_level": "enabled",
  "builds_access_level": "enabled",
  "snippets_access_level": "enabled",
  "pages_access_level": "enabled",
  "analytics_access_level": "enabled",
  "container_registry_access_level": "enabled",
  "security_and_compliance_access_level": "enabled",
  "releases_access_level": "enabled",
  "environments_access_level": "enabled",
  "feature_flags_access_level": "enabled",
  "infrastructure_access_level": "enabled",
  "monitor_access_level": "enabled",
  "model_experiments_access_level": "enabled",
  "model_registry_access_level": "enabled",
  "package_registry_access_level": "enabled",
  "creator_id": 1,
  "import_url": "https://gitlab.com/gitlab/gitlab.git",
  "import_type": "git",
  "import_status": "none",
  "import_error": "Import error",
  "open_issues_count": 1,
  "updated_at": "2020-05-07T04:27:17.016Z",
  "ci_default_git_depth": 20,
  "ci_delete_pipelines_in_seconds": 86400,
  "build_git_strategy": "fetch",
  "runner_token_expiration_interval": 3600,
  "resource_group_default_process_mode": "unordered",
  "auto_cancel_pending_pipelines": "enabled",
  "build_timeout": 3600,
  "auto_devops_deploy_strategy": "continuous",
  "runners_token": "b8547b1dc37721d05889db52fa2f02",
  "merge_method": "merge",
  "squash_option": "default_off",
  "suggestion_commit_message": "Suggestion message",
  "merge_commit_template": "%(title)",
  "squash_commit_template": "%(source_branch)",
  "mr_default_title_template": "%(source_branch)",
  "issue_branch_template": "%(title)",
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090
  },
  "reviewer_assignment_strategy": "code_owners",
  "merge_request_title_regex": "/Title of merge request/",
  "merge_request_title_regex_description": "This requires the title to include a Jira label"
}

Changes

No recorded changes to this operation across all 5 revisions of this API.