Create Pull Request
POST/api/v5/repos/:owner/:repo/pulls
Request
Path Parameters
Repository space address (organization or individual's address path)
Repository path (path)
Query Parameters
User authorization code
- application/json
Body
Required. Pull Request title
Required. The source branch of the Pull Request submission. Format: branch. If cross-repository PR, pass: username:branch
Required. The name of the target branch for the Pull Request submission.
Optional. Content of the Pull Request
Optional. Milestone sequence number (id)
A comma-separated list of labels, where the name must be between 2-20 characters long and cannot contain special characters. For example: bug,performance
Optional. Approvers' usernames, multiple can be specified, separated by half-width commas, e.g., (username1,username2). Note: This option is invalid when 【Assign Approvers】 has already been set in the repository code approval settings.
Optional. Testers' usernames, multiple can be specified, separated by half-width commas, e.g., (username1,username2). Note: This option is invalid when 【Assign Testers】 has already been set in the repository code approval settings.
Optional. Whether to delete the source branch after merging the PR. Defaults to false (do not delete).
Whether to set as draft Default false
When using flat (squash) merging while accepting a Pull Request, defaults to false.
squash commit messages
fork project path 【owner/repo】, required for cross-repository PRs.
Optional, whether to close associated Issues after merging, default is set according to the repository configuration
;
Responses
- 200
Successful Response
Response Headers
- application/json
- Schema
- Example (auto)
- Example
Schema
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
author object
labels object[]
label added time
time_stats object
approval_merge_request_reviewers object[]
approval_merge_request_approvers object[]
approval_merge_request_testers object[]
source_project object
tag_list object[]
license object
namespace object
creator object
target_project object
tag_list object[]
license object
namespace object
creator object
diff_refs object
merge_request_assignee_list object[]
merge_request_reviewer_list object[]
user object
e2e_issues object[]
required_reviewers object[]
{
"id": 0,
"url": "string",
"html_url": "string",
"diff_url": "string",
"patch_url": "string",
"issue_url": "string",
"commits_url": "string",
"review_comments_url": "string",
"review_comment_url": "string",
"comments_url": "string",
"number": 0,
"title": "string",
"description": "string",
"state": "string",
"created_at": "string",
"updated_at": "string",
"target_branch": "string",
"source_branch": "string",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 0,
"name": "string",
"username": "string",
"iam_id": "string",
"nick_name": "string",
"state": "string",
"avatar_url": "string",
"email": "string",
"name_cn": "string",
"web_url": "string"
},
"source_project_id": 0,
"target_project_id": 0,
"labels": [
{
"id": 0,
"name": "string",
"color": "string",
"created_at": "string",
"updated_at": "string"
}
],
"work_in_progress": 0,
"merge_when_pipeline_succeeds": 0,
"merge_status": "string",
"sha": "string",
"should_remove_source_branch": 0,
"force_remove_source_branch": 0,
"web_url": "string",
"time_stats": {
"total_time_spent": 0
},
"squash": 0,
"merge_request_type": "string",
"has_pre_merge_ref": 0,
"review_mode": "string",
"is_source_branch_exist": 0,
"approval_merge_request_reviewers": [
{
"id": 0,
"username": "string",
"name": "string",
"name_cn": "string",
"state": "string",
"is_codeowner": 0,
"updated_at": "string",
"avatar_url": "string"
}
],
"approval_merge_request_approvers": [
{
"id": 0,
"username": "string",
"name": "string",
"name_cn": "string",
"state": "string",
"is_codeowner": 0,
"updated_at": "string",
"avatar_url": "string"
}
],
"approval_merge_request_testers": [
{
"id": 0,
"username": "string",
"name": "string",
"name_cn": "string",
"state": "string",
"is_codeowner": 0,
"updated_at": "string",
"avatar_url": "string"
}
],
"source_project": {
"id": 0,
"description": "string",
"name": "string",
"name_with_namespace": "string",
"path": "string",
"path_with_namespace": "string",
"develop_mode": "string",
"created_at": "string",
"updated_at": "string",
"archived": 0,
"is_kia": 0,
"ssh_url_to_repo": "string",
"http_url_to_repo": "string",
"web_url": "string",
"readme_url": "string",
"product_id": "string",
"member_mgnt_mode": 0,
"default_branch": "string",
"tag_list": [
{}
],
"license": {
"key": "string"
},
"star_count": 0,
"forks_count": 0,
"open_issues_count": 0,
"open_merge_requests_count": 0,
"watch_count": 0,
"last_activity_at": "string",
"namespace": {
"id": 0,
"name": "string",
"path": "string",
"develop_mode": "string",
"cell": "string",
"kind": "string",
"full_path": "string",
"full_name": "string",
"visibility_level": 0
},
"empty_repo": 0,
"starred": 0,
"visibility": "string",
"security": "string",
"has_updated_kia": 0,
"network_type": "string",
"creator": {
"id": 0,
"name": "string",
"username": "string",
"iam_id": "string",
"nick_name": "string",
"state": "string",
"avatar_url": "string",
"email": "string",
"name_cn": "string",
"web_url": "string"
},
"creator_id": 0,
"item_type": "string",
"main_repository_language": [
"string"
],
"open_external_wiki": 0
},
"target_project": {
"id": 0,
"description": "string",
"name": "string",
"name_with_namespace": "string",
"path": "string",
"path_with_namespace": "string",
"develop_mode": "string",
"created_at": "string",
"updated_at": "string",
"archived": 0,
"is_kia": 0,
"ssh_url_to_repo": "string",
"http_url_to_repo": "string",
"web_url": "string",
"readme_url": "string",
"product_id": "string",
"member_mgnt_mode": 0,
"default_branch": "string",
"tag_list": [
{}
],
"license": {
"key": "string"
},
"star_count": 0,
"forks_count": 0,
"open_issues_count": 0,
"open_merge_requests_count": 0,
"watch_count": 0,
"last_activity_at": "string",
"namespace": {
"id": 0,
"name": "string",
"path": "string",
"develop_mode": "string",
"cell": "string",
"kind": "string",
"full_path": "string",
"full_name": "string",
"visibility_level": 0
},
"empty_repo": 0,
"starred": 0,
"visibility": "string",
"security": "string",
"has_updated_kia": 0,
"network_type": "string",
"creator": {
"id": 0,
"name": "string",
"username": "string",
"iam_id": "string",
"nick_name": "string",
"state": "string",
"avatar_url": "string",
"email": "string",
"name_cn": "string",
"web_url": "string"
},
"creator_id": 0,
"item_type": "string",
"main_repository_language": [
"string"
],
"open_external_wiki": 0
},
"added_lines": 0,
"removed_lines": 0,
"subscribed": 0,
"changes_count": "string",
"diff_refs": {
"base_sha": "string",
"head_sha": "string",
"start_sha": "string"
},
"merge_request_assignee_list": [
{}
],
"merge_request_reviewer_list": [
{}
],
"user": {
"can_merge": 0
},
"merge_request_review_count": 0,
"merge_request_reviewers_count": 0,
"notes": 0,
"unresolved_discussions_count": 0,
"e2e_issues": [
{
"id": 0,
"issue_type": 0,
"issue_num": "string",
"merge_request_id": 0,
"check_fail_reason": "string",
"check_result": 0,
"issue_link": "string",
"created_at": "string",
"issue_project_id": 0,
"title": "string",
"auto_c_when_mr_merged": 0
}
],
"gate_check": 0,
"pipeline_status": "string",
"codequality_status": "string",
"pipeline_status_with_code_quality": "string",
"from_forked_project": 0,
"can_delete_source_branch": 0,
"required_reviewers": [
{}
],
"omega_mode": 0,
"source_git_url": "string"
}
{
"id": 11264998,
"url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/6",
"html_url": "https://gitcode.com/zzero/demo/pulls/6",
"diff_url": "https://gitcode.com/zzero/demo/pulls/6.diff",
"patch_url": "https://gitcode.com/zzero/demo/pulls/6.patch",
"issue_url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/6/issues",
"commits_url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/6/commits",
"review_comments_url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/comments/{/number}",
"review_comment_url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/comments",
"comments_url": "https://gitcode.com/api/v5/repos/zzero/demo/pulls/6/comments",
"number": 6,
"title": "testing creating PR",
"description": "update: Update file dev_001.txt \nupdate: Update file dev_001.txt",
"state": "opened",
"created_at": "2024-04-14T20:53:13.185+08:00",
"updated_at": "2024-04-14T20:53:22.634+08:00",
"merged_by": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"title_html": null,
"description_html": null,
"target_branch": "test_b5",
"source_branch": "dev",
"squash_commit_message": null,
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 494,
"name": "csdntest13",
"username": "csdntest13",
"iam_id": "d8b3e018b2364546b946886a669d50fc",
"nick_name": "csdntest13_gitcode",
"state": "active",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/ec/ba/4e7c4661b6154a7dd088d9fe64b4893383a2e318bf362350ce18d44df6ac7e37.png?time=1711533165876",
"avatar_path": null,
"email": "csdntest13@noreply.gitcode.com",
"name_cn": "csdntest13",
"web_url": "https://gitcode.com/csdntest13",
"tenant_name": null,
"is_member": null
},
"assignee": null,
"source_project_id": 243377,
"target_project_id": 243377,
"labels": [
{
"color": "#008672",
"name": "help wanted",
"id": 381445,
"title": "help wanted",
"type": null,
"textColor": "#FFFFFF"
},
{
"color": "#CFD240",
"name": "invalid",
"id": 381446,
"title": "invalid",
"type": null,
"textColor": "#FFFFFF"
},
{
"color": "#D876E3",
"name": "question",
"id": 381447,
"title": "question",
"type": null,
"textColor": "#333333"
}
],
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "unchecked",
"sha": "8da7a5c35e71deeb0bf1d9ecae70449c574749f2",
"merge_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": false,
"force_remove_source_branch": false,
"allow_collaboration": null,
"allow_maintainer_to_push": null,
"web_url": "https://gitcode.com/One/One/merge_requests/53",
"time_stats": {
"time_estimate": null,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"merge_request_type": "MergeRequest",
"has_pre_merge_ref": false,
"review_mode": "approval",
"is_source_branch_exist": true,
"approval_merge_request_reviewers": [
{
"id": 43,
"username": "green",
"name": "green",
"nick_name": null,
"name_cn": "green",
"email": null,
"state": "optional",
"is_codeowner": false,
"updated_at": "2024-04-14T20:53:23.021+08:00",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/be/fb/7b9e393fbd80ca315dec249f2be6e6a7378f591609b6525798bc6d95abedc992.png?time=1712128581171"
}
],
"approval_merge_request_approvers": [
{
"id": 277,
"username": "renww",
"name": "renww",
"nick_name": null,
"name_cn": "renww",
"email": null,
"state": "optional",
"is_codeowner": false,
"updated_at": "2024-04-14T20:53:23.751+08:00",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/ee/dc/7602704ee7dcf13f4383a72d492b1813823afba729ae6e9115877a4a0128d990.jpg?time=1711447395118"
}
],
"approval_merge_request_testers": [
{
"id": 43,
"username": "green",
"name": "green",
"nick_name": null,
"name_cn": "green",
"email": null,
"state": "optional",
"is_codeowner": false,
"updated_at": "2024-04-14T20:53:23.755+08:00",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/be/fb/7b9e393fbd80ca315dec249f2be6e6a7378f591609b6525798bc6d95abedc992.png?time=1712128581171"
},
{
"id": 277,
"username": "renww",
"name": "renww",
"nick_name": null,
"name_cn": "renww",
"email": null,
"state": "optional",
"is_codeowner": false,
"updated_at": "2024-04-14T20:53:23.755+08:00",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/ee/dc/7602704ee7dcf13f4383a72d492b1813823afba729ae6e9115877a4a0128d990.jpg?time=1711447395118"
}
],
"source_project": {
"id": 243377,
"description": "csdntest13's first project (public)",
"name": "One",
"name_with_namespace": "One / One",
"path": "One",
"path_with_namespace": "One/One",
"develop_mode": "normal",
"created_at": "2024-03-19T16:24:01.197+08:00",
"updated_at": "2024-03-19T16:42:34.834+08:00",
"archived": false,
"is_kia": false,
"ssh_url_to_repo": "ssh://git@gitcode.com:2222/One/One.git",
"http_url_to_repo": "https://gitcode.com/One/One.git",
"web_url": "https://gitcode.com/One/One",
"readme_url": "https://gitcode.com/One/One/blob/main/README.md",
"product_id": "28f96caf52004e81ab0bc38d60d11940",
"product_name": null,
"member_mgnt_mode": 3,
"default_branch": "main",
"tag_list": [],
"license_url": null,
"license": {
"key": "Apache_License_v2.0",
"name": null,
"nickname": null,
"html_url": null,
"source_url": null
},
"avatar_url": null,
"star_count": 1,
"forks_count": 0,
"open_issues_count": 108,
"open_merge_requests_count": 32,
"open_change_requests_count": null,
"watch_count": 1,
"last_activity_at": "2024-04-14T20:43:58.602+08:00",
"namespace": {
"id": 136909,
"name": "One",
"path": "One",
"develop_mode": "normal",
"region": null,
"cell": "default",
"kind": "group",
"full_path": "One",
"full_name": "One ",
"parent_id": null,
"visibility_level": 20,
"enable_file_control": null,
"owner_id": null
},
"empty_repo": false,
"starred": false,
"visibility": "public",
"security": "internal",
"has_updated_kia": false,
"network_type": "green",
"owner": null,
"creator": {
"id": 494,
"name": "csdntest13",
"username": "csdntest13",
"iam_id": "d8b3e018b2364546b946886a669d50fc",
"nick_name": "csdntest13_gitcode",
"state": "active",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/ec/ba/4e7c4661b6154a7dd088d9fe64b4893383a2e318bf362350ce18d44df6ac7e37.png?time=1711533165876",
"avatar_path": null,
"email": "csdntest13@noreply.gitcode.com",
"name_cn": "csdntest13",
"web_url": "https://gitcode.com/csdntest13",
"tenant_name": null,
"is_member": null
},
"creator_id": 494,
"forked_from_project": null,
"item_type": "Project",
"main_repository_language": [
"Text",
"#cccccc"
],
"mirror_project_data": null,
"statistics": null,
"branch_count": null,
"tag_count": null,
"member_count": null,
"repo_replica_urls": null,
"open_external_wiki": true,
"release_count": null
},
"target_project": {
"id": 243377,
"description": "csdntest13's first project (public)",
"name": "One",
"name_with_namespace": "One / One",
"path": "One",
"path_with_namespace": "One/One",
"develop_mode": "normal",
"created_at": "2024-03-19T16:24:01.197+08:00",
"updated_at": "2024-03-19T16:42:34.834+08:00",
"archived": false,
"is_kia": false,
"ssh_url_to_repo": "ssh://git@gitcode.com:2222/One/One.git",
"http_url_to_repo": "https://gitcode.com/One/One.git",
"web_url": "https://gitcode.com/One/One",
"readme_url": "https://gitcode.com/One/One/blob/main/README.md",
"product_id": "28f96caf52004e81ab0bc38d60d11940",
"product_name": null,
"member_mgnt_mode": 3,
"default_branch": "main",
"tag_list": [],
"license_url": null,
"license": {
"key": "Apache_License_v2.0",
"name": null,
"nickname": null,
"html_url": null,
"source_url": null
},
"avatar_url": null,
"star_count": 1,
"forks_count": 0,
"open_issues_count": 108,
"open_merge_requests_count": 32,
"open_change_requests_count": null,
"watch_count": 1,
"last_activity_at": "2024-04-14T20:43:58.602+08:00",
"namespace": {
"id": 136909,
"name": "One",
"path": "One",
"develop_mode": "normal",
"region": null,
"cell": "default",
"kind": "group",
"full_path": "One",
"full_name": "One ",
"parent_id": null,
"visibility_level": 20,
"enable_file_control": null,
"owner_id": null
},
"empty_repo": false,
"starred": false,
"visibility": "public",
"security": "internal",
"has_updated_kia": false,
"network_type": "green",
"owner": null,
"creator": {
"id": 494,
"name": "csdntest13",
"username": "csdntest13",
"iam_id": "d8b3e018b2364546b946886a669d50fc",
"nick_name": "csdntest13_gitcode",
"state": "active",
"avatar_url": "https://gitcode-img.obs.cn-south-1.myhuaweicloud.com:443/ec/ba/4e7c4661b6154a7dd088d9fe64b4893383a2e318bf362350ce18d44df6ac7e37.png?time=1711533165876",
"avatar_path": null,
"email": "csdntest13@noreply.gitcode.com",
"name_cn": "csdntest13",
"web_url": "https://gitcode.com/csdntest13",
"tenant_name": null,
"is_member": null
},
"creator_id": 494,
"forked_from_project": null,
"item_type": "Project",
"main_repository_language": [
"Text",
"#cccccc"
],
"mirror_project_data": null,
"statistics": null,
"branch_count": null,
"tag_count": null,
"member_count": null,
"repo_replica_urls": null,
"open_external_wiki": true,
"release_count": null
},
"added_lines": 19860,
"removed_lines": 1,
"subscribed": true,
"changes_count": "6",
"latest_build_started_at": null,
"latest_build_finished_at": null,
"first_deployed_to_production_at": null,
"pipeline": null,
"diff_refs": {
"base_sha": "0c02dd57f8945791460a141f155dd2f4bd5dea86",
"head_sha": "8da7a5c35e71deeb0bf1d9ecae70449c574749f2",
"start_sha": "fb6495834d1bf7a39dfdb44ad25e6f83c7136310"
},
"merge_error": null,
"json_merge_error": null,
"rebase_in_progress": null,
"diverged_commits_count": null,
"merge_request_assignee_list": [],
"merge_request_reviewer_list": [],
"user": {
"can_merge": true
},
"merge_request_review_count": 0,
"merge_request_reviewers_count": 0,
"notes": 0,
"unresolved_discussions_count": 0,
"e2e_issues": [
{
"id": 13588,
"issue_type": 7,
"linked_issue_type": null,
"issue_num": "issue100",
"commit_id": null,
"merge_request_id": 68253,
"check_fail_reason": "",
"check_result": true,
"issue_link": "https://gitcode.com/One/One/issues/100",
"created_at": "2024-04-14T20:53:23.772+08:00",
"mks_id": null,
"pbi_id": null,
"pbi_name": null,
"source": null,
"issue_project_id": 243377,
"title": "The boudoir ripenings issue-45",
"issue_project": null,
"auto_c_when_mr_merged": false
}
],
"gate_check": true,
"head_pipeline_id": null,
"pipeline_status": "",
"codequality_status": "success",
"pipeline_status_with_code_quality": "",
"from_forked_project": false,
"forked_project_name": null,
"can_delete_source_branch": true,
"required_reviewers": [],
"omega_mode": false,
"root_mr_locked_detail": null,
"source_git_url": "ssh://git@gitcode.com:2222/One/One.git",
"auto_merge": null
}