正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

プロジェクトAPI

  • プラン: Free、Premium、Ultimate
  • 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated

このAPIを使用して、GitLabプロジェクトとそれに関連する設定を管理します。プロジェクトは、コードを保存し、イシューを追跡し、チームのアクティビティーを編成できる、コラボレーションの中心的なハブです。詳細については、プロジェクトを作成するを参照してください。

プロジェクトAPIには、次のエンドポイントが含まれています:

  • プロジェクトの情報とメタデータを取得する
  • プロジェクトを作成、編集、削除する
  • プロジェクトの表示レベル、アクセス権限、セキュリティ設定を制御する
  • イシュートラッキング、マージリクエスト、CI/CDなどのプロジェクト機能を管理する
  • プロジェクトをアーカイブおよびアーカイブ解除する
  • ネームスペース間でプロジェクトを転送する
  • デプロイとコンテナレジストリの設定を管理する

権限

次のロールを持つユーザーは以下の操作を行うことができます:

  • プロジェクトの任意のデフォルトロールを持つユーザーは、プロジェクトのプロパティを読み取ることができます。
  • プロジェクトのオーナーまたはメンテナーのロールを持つユーザーは、プロジェクトのプロパティを編集することもできます。

プロジェクトの表示レベル

GitLabのプロジェクトには、次のいずれかの表示レベルを設定できます:

  • 非公開
  • 内部
  • 公開

表示レベルは、プロジェクトのvisibilityフィールドによって決まります。

詳細については、プロジェクトの表示レベルを参照してください。

応答で返されるフィールドは、認証済みユーザーの権限によって異なります。

非推奨の属性

以下の属性は非推奨であり、REST APIの将来のバージョンで削除される可能性があります。代わりに代替属性を使用してください。

非推奨の属性代替
tag_listtopics属性
marked_for_deletion_atmarked_for_deletion_on。PremiumおよびUltimateのみ。
approvals_before_mergeマージリクエスト承認API。PremiumおよびUltimateのみ。

単一プロジェクトを取得する

特定のプロジェクトを取得します。プロジェクトが公開されている場合、このエンドポイントには認証なしでアクセスできます。

GET /projects/:id

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
licenseブール値いいえプロジェクトのライセンスデータを含めます。
statisticsブール値いいえプロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。
with_custom_attributesブール値いいえ応答にカスタム属性を含めます。(管理者のみ)

応答には、コンテナレジストリのストレージサイズに関連する属性が含まれています:

  • container_registry_size: プロジェクト内のすべてのコンテナリポジトリで使用されるストレージサイズの合計(バイト単位)。コンテナイメージがプッシュまたは削除されるたびに更新されます。GitLab Self-Managedインスタンスでは、コンテナレジストリメタデータデータベースを有効にする必要があります。

レスポンス例:

{
  "id": 3,
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
  "default_branch": "main",
  "visibility": "private",
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/main/README.md",
  "tag_list": [ //deprecated, use `topics` instead
    "example",
    "disapora project"
  ],
  "topics": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
  },
  "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,
  "can_create_merge_request_in": true,
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
  "container_registry_access_level": "disabled",
  "security_and_compliance_access_level": "disabled",
  "container_expiration_policy": {
    "cadence": "7d",
    "enabled": false,
    "keep_n": null,
    "older_than": null,
    "name_regex": null, // to be deprecated in GitLab 13.0 in favor of `name_regex_delete`
    "name_regex_delete": null,
    "name_regex_keep": null,
    "next_run_at": "2020-01-07T21:42:58.658Z"
  },
  "created_at": "2013-09-30T13:46:02Z",
  "updated_at": "2013-09-30T13:46:02Z",
  "last_activity_at": "2013-09-30T13:46:02Z",
  "creator_id": 3,
  "namespace": {
    "id": 3,
    "name": "Diaspora",
    "path": "diaspora",
    "kind": "group",
    "full_path": "diaspora",
    "avatar_url": "http://localhost:3000/uploads/group/avatar/3/foo.jpg",
    "web_url": "http://localhost:3000/groups/diaspora"
  },
  "import_url": null,
  "import_type": null,
  "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": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "license_url": "http://example.com/diaspora/diaspora-client/blob/main/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
  "shared_runners_enabled": true,
  "group_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
  "ci_default_git_depth": 50,
  "ci_forward_deployment_enabled": true,
  "ci_forward_deployment_rollback_allowed": true,
  "ci_allow_fork_pipelines_to_run_in_parent_project": true,
  "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
  "ci_separated_caches": true,
  "ci_restrict_pipeline_cancellation_role": "developer",
  "ci_pipeline_variables_minimum_override_role": "maintainer",
  "ci_push_repository_for_job_token_allowed": false,
  "public_jobs": true,
  "shared_with_groups": [
    {
      "group_id": 4,
      "group_name": "Twitter",
      "group_full_path": "twitter",
      "group_access_level": 30
    },
    {
      "group_id": 3,
      "group_name": "Gitlab Org",
      "group_full_path": "gitlab-org",
      "group_access_level": 10
    }
  ],
  "repository_storage": "default",
  "only_allow_merge_if_pipeline_succeeds": false,
  "allow_merge_on_skipped_pipeline": false,
  "allow_pipeline_trigger_approve_deployment": false,
  "restrict_user_defined_variables": false,
  "only_allow_merge_if_all_discussions_are_resolved": false,
  "remove_source_branch_after_merge": false,
  "printing_merge_requests_link_enabled": true,
  "request_access_enabled": false,
  "merge_method": "merge",
  "squash_option": "default_on",
  "auto_devops_enabled": true,
  "auto_devops_deploy_strategy": "continuous",
  "approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
  "mirror": false,
  "mirror_user_id": 45,
  "mirror_trigger_builds": false,
  "only_mirror_protected_branches": false,
  "mirror_overwrites_diverged_branches": false,
  "external_authorization_classification_label": null,
  "packages_enabled": true,
  "service_desk_enabled": false,
  "service_desk_address": null,
  "autoclose_referenced_issues": true,
  "suggestion_commit_message": null,
  "enforce_auth_checks_on_uploads": true,
  "merge_commit_template": null,
  "squash_commit_template": null,
  "issue_branch_template": "gitlab/%{id}-%{title}",
  "marked_for_deletion_at": "2020-04-03", // Deprecated in favor of marked_for_deletion_on. Planned for removal in a future version of the REST API.
  "marked_for_deletion_on": "2020-04-03",
  "compliance_frameworks": [ "sox" ],
  "warn_about_potentially_unwanted_characters": true,
  "secret_push_protection_enabled": false,
  "statistics": {
    "commit_count": 37,
    "storage_size": 1038090,
    "repository_size": 1038090,
    "wiki_size" : 0,
    "lfs_objects_size": 0,
    "job_artifacts_size": 0,
    "pipeline_artifacts_size": 0,
    "packages_size": 0,
    "snippets_size": 0,
    "uploads_size": 0,
    "container_registry_size": 0
  },
  "container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
  "_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",
    "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
  },
  "spp_repository_pipeline_access": false // Only visible if the security_orchestration_policies feature is available
}

GitLab Ultimateのユーザーは、GitLab 15.5以降を使用してonly_allow_merge_if_all_status_checks_passedパラメータを表示することもできます:

{
  "id": 1,
  "project_id": 3,
  "only_allow_merge_if_all_status_checks_passed": false,
  ...
}

プロジェクトがフォークの場合、forked_from_projectフィールドが応答に表示されます。このフィールドでは、アップストリームプロジェクトが非公開の場合、認証用の有効なトークンを指定する必要があります。フィールドmr_default_target_selfも表示されます。この値がfalseの場合、すべてのマージリクエストはデフォルトでアップストリームプロジェクトをターゲットとします。

{
   "id":3,

   ...

   "mr_default_target_self": false,
   "forked_from_project":{
      "id":13083,
      "description":"GitLab Community Edition",
      "name":"GitLab Community Edition",
      "name_with_namespace":"GitLab.org / GitLab Community Edition",
      "path":"gitlab-foss",
      "path_with_namespace":"gitlab-org/gitlab-foss",
      "created_at":"2013-09-26T06:02:36.000Z",
      "default_branch":"main",
      "tag_list":[], //deprecated, use `topics` instead
      "topics":[],
      "ssh_url_to_repo":"git@gitlab.com:gitlab-org/gitlab-foss.git",
      "http_url_to_repo":"https://gitlab.com/gitlab-org/gitlab-foss.git",
      "web_url":"https://gitlab.com/gitlab-org/gitlab-foss",
      "avatar_url":"https://gitlab.com/uploads/-/system/project/avatar/13083/logo-extra-whitespace.png",
      "license_url": "https://gitlab.com/gitlab-org/gitlab/-/blob/main/LICENSE",
      "license": {
        "key": "mit",
        "name": "MIT License",
        "nickname": null,
        "html_url": "http://choosealicense.com/licenses/mit/",
        "source_url": "https://opensource.org/licenses/MIT"
      },
      "star_count":3812,
      "forks_count":3561,
      "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
      },
      "repository_storage": "default"
   }

   ...

}

イシューとマージリクエストのテンプレート

  • プラン: Premium、Ultimate
  • 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated

GitLab PremiumまたはUltimateのユーザーに対しては、イシューおよびマージリクエストの説明テンプレートを管理するためのissues_templateパラメータとmerge_requests_templateパラメータも表示されます。

{
  "id": 3,
  "issues_template": null,
  "merge_requests_template": null,
  ...
}

プロジェクトのリストを取得する

プロジェクトのリストを取得します。

すべてのプロジェクトのリストを取得する

web_based_commit_signing_enabled属性の利用可否は、機能フラグによって制御されます。詳細については、履歴を参照してください。この機能はテストには利用できますが、本番環境での使用には適していません。

認証済みユーザーに対して、GitLab全体の表示可能なすべてのプロジェクトのリストを取得します。認証なしでアクセスすると、単純なフィールドを持つ公開プロジェクトのみが返されます。

GET /projects

サポートされている属性:

属性種類必須説明
archivedブール値いいえアーカイブ状態で制限します。
id_after整数いいえ指定されたIDより大きいIDを持つプロジェクトに結果を制限します。
id_before整数いいえ指定されたIDより小さいIDを持つプロジェクトに結果を制限します。
importedブール値いいえ現在のユーザーによって外部システムからインポートされたプロジェクトに結果を制限します。
include_hiddenブール値いいえ非表示プロジェクトを含めます。_(管理者のみ)_PremiumおよびUltimateのみ。
include_pending_deleteブール値いいえ削除保留中のプロジェクトを含めます。(管理者のみ)
last_activity_after日時いいえ指定された時刻以降に最後のアクティビティーが行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ
last_activity_before日時いいえ指定された時刻以前に最後のアクティビティーが行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ
membershipブール値いいえ現在のユーザーがメンバーであるプロジェクトで制限します。
min_access_level整数いいえ現在のユーザーの最小ロール(access_levelで制限します。
order_by文字列いいえidnamepathcreated_atupdated_atstar_countlast_activity_at、またはsimilarityフィールドで並べ替えられたプロジェクトを返します。repository_sizestorage_sizepackages_size、またはwiki_sizeフィールドは、管理者のみが使用できます。similarityは検索時にのみ使用可能であり、現在のユーザーがメンバーであるプロジェクトに限定されます。デフォルトはcreated_atです。
ownedブール値いいえ現在のユーザーが明示的に所有するプロジェクトで制限します。
repository_checksum_failedブール値いいえリポジトリチェックサムの計算に失敗したプロジェクトを制限します。PremiumおよびUltimateのみです。
repository_storage文字列いいえrepository_storageに保存されているプロジェクトに結果を制限します。(管理者のみ)
search_namespacesブール値いいえ検索条件に一致するときに、祖先のネームスペースを含めます。デフォルトはfalseです。
search文字列いいえpathname、またはdescriptionが検索条件(大文字と小文字は区別されない、部分文字列一致)に一致するプロジェクトのリストを返します。複数の用語は、エスケープされたスペース(+または%20)で区切って指定できます。これらの用語はANDで結合されます。たとえばone+twoは、部分文字列oneおよびtwo(順不同)に一致します。
simpleブール値いいえプロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。
sort文字列いいえascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。
starredブール値いいえ現在のユーザーがお気に入りに登録したプロジェクトで制限します。
statisticsブール値いいえプロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。
topic_id整数いいえトピックIDで指定された、割り当てられたトピックを含むプロジェクトに結果を制限します。
topic文字列いいえカンマ区切りのトピック名。指定されたすべてのトピックに一致するプロジェクトに結果を制限します。topics属性を参照してください。
updated_after日時いいえ指定された時刻以降に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。このフィルターを機能させるには、updated_atorder_by属性として指定する必要もあります。
updated_before日時いいえ指定された時刻以前に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。このフィルターを機能させるには、updated_atorder_by属性として指定する必要もあります。
visibility文字列いいえ表示レベル(publicinternalprivate)で制限します。
wiki_checksum_failedブール値いいえWikiチェックサムの計算に失敗したプロジェクトを制限します。PremiumおよびUltimateのみです。
with_custom_attributesブール値いいえ応答にカスタム属性を含めます。(管理者のみ)
with_issues_enabledブール値いいえ有効になっているイシュー機能で制限します。
with_merge_requests_enabledブール値いいえ有効になっているマージリクエスト機能で制限します。
with_programming_language文字列いいえ指定されているプログラミング言語を使用するプロジェクトで制限します。
marked_for_deletion_on日付いいえプロジェクトが削除対象としてマークされた日付でフィルタリングします。GitLab 17.1で導入されました。PremiumおよびUltimateのみです。
activeブール値いいえアーカイブされておらず、削除対象としてマークされていないプロジェクトで制限します。

このエンドポイントは、一部のorder_byオプションでキーセットページネーションをサポートしています。

simple=trueであるか、またはユーザーが認証されていない場合、これは次のような内容を返します:

リクエストの例:

curl --request GET "https://gitlab.example.com/api/v4/projects?simple=true"

レスポンス例:

[
  {
    "id": 4,
    "description": null,
    "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",
    "default_branch": "main",
    "tag_list": [
      "example",
      "disapora client"
    ],
    "topics": [
      "example",
      "disapora client"
    ],
    "ssh_url_to_repo": "git@gitlab.example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "https://gitlab.example.com/diaspora/diaspora-client.git",
    "web_url": "https://gitlab.example.com/diaspora/diaspora-client",
    "avatar_url": "https://gitlab.example.com/uploads/project/avatar/4/uploads/avatar.png",
    "star_count": 0,
    "last_activity_at": "2013-09-30T13:46:02Z",
    "visibility": "public",
    "namespace": {
      "id": 2,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora",
      "parent_id": null,
      "avatar_url": null,
      "web_url": "https://gitlab.example.com/diaspora"
    }
  },
  {
    ...
  }

ユーザーが認証されていて、simpleが設定されていない場合、このエンドポイントは次の内容を返します:

[
  {
    "id": 4,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
    "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",
    "updated_at": "2013-09-30T13:46:02Z",
    "default_branch": "main",
    "tag_list": [ //deprecated, use `topics` instead
      "example",
      "disapora client"
    ],
    "topics": [
      "example",
      "disapora client"
    ],
    "ssh_url_to_repo": "git@gitlab.example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "https://gitlab.example.com/diaspora/diaspora-client.git",
    "web_url": "https://gitlab.example.com/diaspora/diaspora-client",
    "readme_url": "https://gitlab.example.com/diaspora/diaspora-client/blob/main/README.md",
    "avatar_url": "https://gitlab.example.com/uploads/project/avatar/4/uploads/avatar.png",
    "forks_count": 0,
    "star_count": 0,
    "last_activity_at": "2022-06-24T17:11:26.841Z",
    "namespace": {
      "id": 3,
      "name": "Diaspora",
      "path": "diaspora",
      "kind": "group",
      "full_path": "diaspora",
      "parent_id": null,
      "avatar_url": "https://gitlab.example.com/uploads/project/avatar/6/uploads/avatar.png",
      "web_url": "https://gitlab.example.com/diaspora"
    },
    "container_registry_image_prefix": "registry.gitlab.example.com/diaspora/diaspora-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"
    },
    "packages_enabled": true, // deprecated, use package_registry_access_level instead
    "package_registry_access_level": "enabled",
    "empty_repo": false,
    "archived": false,
    "visibility": "public",
    "resolve_outdated_diff_discussions": false,
    "container_expiration_policy": {
      "cadence": "1month",
      "enabled": true,
      "keep_n": 1,
      "older_than": "14d",
      "name_regex": "",
      "name_regex_keep": ".*-main",
      "next_run_at": "2022-06-25T17:11:26.865Z"
    },
    "issues_enabled": true,
    "merge_requests_enabled": true,
    "wiki_enabled": true,
    "jobs_enabled": true,
    "snippets_enabled": true,
    "container_registry_enabled": true,
    "service_desk_enabled": true,
    "can_create_merge_request_in": true,
    "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": "private",
    "emails_disabled": null,
    "emails_enabled": null,
    "shared_runners_enabled": true,
    "group_runners_enabled": true,
    "lfs_enabled": true,
    "creator_id": 1,
    "import_url": null,
    "import_type": null,
    "import_status": "none",
    "import_error": null,
    "open_issues_count": 0,
    "ci_default_git_depth": 20,
    "ci_forward_deployment_enabled": true,
    "ci_forward_deployment_rollback_allowed": true,
    "ci_allow_fork_pipelines_to_run_in_parent_project": true,
    "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
    "ci_job_token_scope_enabled": false,
    "ci_separated_caches": true,
    "ci_restrict_pipeline_cancellation_role": "developer",
    "ci_pipeline_variables_minimum_override_role": "maintainer",
    "ci_push_repository_for_job_token_allowed": false,
    "public_jobs": true,
    "build_timeout": 3600,
    "auto_cancel_pending_pipelines": "enabled",
    "ci_config_path": "",
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "allow_merge_on_skipped_pipeline": null,
    "allow_pipeline_trigger_approve_deployment": false,
    "restrict_user_defined_variables": false,
    "request_access_enabled": true,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "remove_source_branch_after_merge": true,
    "printing_merge_request_link_enabled": true,
    "merge_method": "merge",
    "squash_option": "default_off",
    "enforce_auth_checks_on_uploads": true,
    "suggestion_commit_message": null,
    "merge_commit_template": null,
    "squash_commit_template": null,
    "issue_branch_template": "gitlab/%{id}-%{title}",
    "auto_devops_enabled": false,
    "auto_devops_deploy_strategy": "continuous",
    "autoclose_referenced_issues": true,
    "keep_latest_artifact": true,
    "runner_token_expiration_interval": null,
    "external_authorization_classification_label": "",
    "requirements_enabled": false,
    "requirements_access_level": "enabled",
    "security_and_compliance_enabled": false,
    "secret_push_protection_enabled": false,
    "compliance_frameworks": [],
    "warn_about_potentially_unwanted_characters": true,
    "permissions": {
      "project_access": null,
      "group_access": null
    }
  },
  {
    ...
  }
]

last_activity_atは、プロジェクトアクティビティープロジェクトイベントに基づいて更新されます。updated_atは、プロジェクトレコードがデータベースで変更されるたびに更新されます。

カスタム属性でフィルタリングするには、以下を使用します:

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

リクエストの例:

curl --globoff --request GET "https://gitlab.example.com/api/v4/projects?custom_attributes[location]=Antarctica&custom_attributes[role]=Developer"

ページネーションの制限

オフセットベースのページネーションを使用すると、最大50,000件のプロジェクトにアクセスできます。

この制限を超えるプロジェクトを取得するには、キーセットページネーションを使用します。キーセットページネーションは、order_by=idのみをサポートします。その他のソートオプションは利用できません。

ユーザーのプロジェクトのリストを取得する

指定されたユーザーが所有する、表示可能なプロジェクトのリストを取得します。認証なしでアクセスした場合、公開プロジェクトのみが返されます。

前提要件:

  • 特定の属性を表示するには、管理者であるか、プロジェクトのオーナーロールを持っている必要があります。

user_idで指定されたユーザーのネームスペースにあるプロジェクトのみが返されます。グループまたはサブグループ内のユーザーが所有するプロジェクトは返されません。プロファイルが非公開に設定されている場合、空のリストが返されます。

このエンドポイントは、一部のorder_byオプションでキーセットページネーションをサポートしています。

GET /users/:user_id/projects

サポートされている属性:

属性種類必須説明
user_id文字列はいユーザーのIDまたはユーザー名。
archivedブール値いいえアーカイブ状態で制限します。
id_after整数いいえ指定されたIDより大きいIDを持つプロジェクトに結果を制限します。
id_before整数いいえ指定されたIDより小さいIDを持つプロジェクトに結果を制限します。
membershipブール値いいえ現在のユーザーがメンバーであるプロジェクトで制限します。
min_access_level整数いいえ現在のユーザーの最小ロール(access_levelで制限します。
order_by文字列いいえidnamepathcreated_atupdated_atstar_count、またはlast_activity_atのフィールドで並べ替えられたプロジェクトを返します。デフォルトはcreated_atです。
ownedブール値いいえ現在のユーザーが明示的に所有するプロジェクトで制限します。
search文字列いいえ検索条件に一致するプロジェクトのリストを返します。
simpleブール値いいえプロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。
sort文字列いいえascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。
starredブール値いいえ現在のユーザーがお気に入りに登録したプロジェクトで制限します。
statisticsブール値いいえプロジェクトの統計を含めます。レポーター以上のロールを持つユーザーのみが利用できます。
updated_after日時いいえ指定された時刻以降に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。
updated_before日時いいえ指定された時刻以前に最終更新が行われたプロジェクトに結果を制限します。形式: ISO 8601(YYYY-MM-DDTHH:MM:SSZ)。GitLab 15.10で導入されました。
visibility文字列いいえ表示レベル(publicinternalprivate)で制限します。
with_custom_attributesブール値いいえ応答にカスタム属性を含めます。(管理者のみ)
with_issues_enabledブール値いいえ有効になっているイシュー機能で制限します。
with_merge_requests_enabledブール値いいえ有効になっているマージリクエスト機能で制限します。
with_programming_language文字列いいえ指定されているプログラミング言語を使用するプロジェクトで制限します。

レスポンス例:

[
  {
    "id": 4,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
    "default_branch": "main",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/main/README.md",
    "tag_list": [ //deprecated, use `topics` instead
      "example",
      "disapora client"
    ],
    "topics": [
      "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,
    "can_create_merge_request_in": true,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
    "container_registry_access_level": "disabled",
    "security_and_compliance_access_level": "disabled",
    "created_at": "2013-09-30T13:46:02Z",
    "updated_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "import_url": null,
    "import_type": null,
    "import_status": "none",
    "import_error": null,
    "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,
    "group_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "ci_default_git_depth": 50,
    "ci_forward_deployment_enabled": true,
    "ci_forward_deployment_rollback_allowed": true,
    "ci_allow_fork_pipelines_to_run_in_parent_project": true,
    "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
    "ci_separated_caches": true,
    "ci_restrict_pipeline_cancellation_role": "developer",
    "ci_pipeline_variables_minimum_override_role": "maintainer",
    "ci_push_repository_for_job_token_allowed": false,
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "allow_merge_on_skipped_pipeline": false,
    "allow_pipeline_trigger_approve_deployment": false,
    "restrict_user_defined_variables": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "remove_source_branch_after_merge": false,
    "request_access_enabled": false,
    "merge_method": "merge",
    "squash_option": "default_on",
    "autoclose_referenced_issues": true,
    "enforce_auth_checks_on_uploads": true,
    "suggestion_commit_message": null,
    "merge_commit_template": null,
    "squash_commit_template": null,
    "secret_push_protection_enabled": false,
    "issue_branch_template": "gitlab/%{id}-%{title}",
    "marked_for_deletion_at": "2020-04-03", // Deprecated in favor of marked_for_deletion_on. Planned for removal in a future version of the REST API.
    "marked_for_deletion_on": "2020-04-03",
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "wiki_size" : 0,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0,
      "pipeline_artifacts_size": 0,
      "packages_size": 0,
      "snippets_size": 0,
      "uploads_size": 0,
      "container_registry_size": 0
    },
    "container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
    "_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",
      "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
    }
  },
  {
    "id": 6,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
    "default_branch": "main",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
    "readme_url": "http://example.com/brightbox/puppet/blob/main/README.md",
    "tag_list": [ //deprecated, use `topics` instead
      "example",
      "puppet"
    ],
    "topics": [
      "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,
    "can_create_merge_request_in": true,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
    "container_registry_access_level": "disabled",
    "security_and_compliance_access_level": "disabled",
    "created_at": "2013-09-30T13:46:02Z",
    "updated_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "import_url": null,
    "import_type": null,
    "import_status": "none",
    "import_error": null,
    "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,
    "group_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "ci_default_git_depth": 0,
    "ci_forward_deployment_enabled": true,
    "ci_forward_deployment_rollback_allowed": true,
    "ci_allow_fork_pipelines_to_run_in_parent_project": true,
    "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
    "ci_separated_caches": true,
    "ci_restrict_pipeline_cancellation_role": "developer",
    "ci_pipeline_variables_minimum_override_role": "maintainer",
    "ci_push_repository_for_job_token_allowed": false,
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "allow_merge_on_skipped_pipeline": false,
    "allow_pipeline_trigger_approve_deployment": false,
    "restrict_user_defined_variables": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "remove_source_branch_after_merge": false,
    "request_access_enabled": false,
    "merge_method": "merge",
    "squash_option": "default_on",
    "auto_devops_enabled": true,
    "auto_devops_deploy_strategy": "continuous",
    "repository_storage": "default",
    "approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
    "mirror": false,
    "mirror_user_id": 45,
    "mirror_trigger_builds": false,
    "only_mirror_protected_branches": false,
    "mirror_overwrites_diverged_branches": false,
    "external_authorization_classification_label": null,
    "packages_enabled": true, // deprecated, use package_registry_access_level instead
    "package_registry_access_level": "enabled",
    "service_desk_enabled": false,
    "service_desk_address": null,
    "autoclose_referenced_issues": true,
    "enforce_auth_checks_on_uploads": true,
    "suggestion_commit_message": null,
    "merge_commit_template": null,
    "squash_commit_template": null,
    "secret_push_protection_enabled": false,
    "issue_branch_template": "gitlab/%{id}-%{title}",
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "wiki_size" : 0,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0,
      "pipeline_artifacts_size": 0,
      "packages_size": 0,
      "snippets_size": 0,
      "uploads_size": 0,
      "container_registry_size": 0
    },
    "container_registry_image_prefix": "registry.example.com/brightbox/puppet",
    "_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",
      "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
    }
  }
]

ユーザーがコントリビュートしたプロジェクトのリストを取得する

指定されたユーザーが過去1年以内にコントリビュートした、表示可能なプロジェクトのリストを返します。コントリビュートとみなされる内容の詳細については、コントリビュートしたプロジェクトの表示を参照してください。

GET /users/:user_id/contributed_projects

サポートされている属性:

属性種類必須説明
user_id文字列はいユーザーのIDまたはユーザー名。
order_by文字列いいえidnamepathcreated_atupdated_atstar_count、またはlast_activity_atのフィールドで並べ替えられたプロジェクトを返します。デフォルトはcreated_atです。
simpleブール値いいえプロジェクトごとに制限されたフィールドのみを返します。認証がない場合、このオペレーションは何も行いません。単純なフィールドのみが返されます。
sort文字列いいえascまたはdescの順にソートされたプロジェクトを返します。デフォルトはdescです。

リクエストの例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/users/5/contributed_projects"

レスポンス例:

[
  {
    "id": 4,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
    "default_branch": "main",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
    "readme_url": "http://example.com/diaspora/diaspora-client/blob/main/README.md",
    "tag_list": [ //deprecated, use `topics` instead
      "example",
      "disapora client"
    ],
    "topics": [
      "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,
    "can_create_merge_request_in": true,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
    "container_registry_access_level": "disabled",
    "security_and_compliance_access_level": "disabled",
    "created_at": "2013-09-30T13:46:02Z",
    "updated_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,
    "group_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "allow_merge_on_skipped_pipeline": false,
    "allow_pipeline_trigger_approve_deployment": false,
    "restrict_user_defined_variables": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "remove_source_branch_after_merge": false,
    "request_access_enabled": false,
    "merge_method": "merge",
    "squash_option": "default_on",
    "autoclose_referenced_issues": true,
    "enforce_auth_checks_on_uploads": true,
    "suggestion_commit_message": null,
    "merge_commit_template": null,
    "squash_commit_template": null,
    "secret_push_protection_enabled": false,
    "issue_branch_template": "gitlab/%{id}-%{title}",
    "statistics": {
      "commit_count": 37,
      "storage_size": 1038090,
      "repository_size": 1038090,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0,
      "pipeline_artifacts_size": 0,
      "packages_size": 0,
      "snippets_size": 0,
      "uploads_size": 0,
      "container_registry_size": 0
    },
    "container_registry_image_prefix": "registry.example.com/diaspora/diaspora-client",
    "_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",
      "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
    }
  },
  {
    "id": 6,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
    "default_branch": "main",
    "visibility": "private",
    "ssh_url_to_repo": "git@example.com:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
    "readme_url": "http://example.com/brightbox/puppet/blob/main/README.md",
    "tag_list": [ //deprecated, use `topics` instead
      "example",
      "puppet"
    ],
    "topics": [
      "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,
    "can_create_merge_request_in": true,
    "resolve_outdated_diff_discussions": false,
    "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
    "container_registry_access_level": "disabled",
    "security_and_compliance_access_level": "disabled",
    "created_at": "2013-09-30T13:46:02Z",
    "updated_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,
    "group_runners_enabled": true,
    "forks_count": 0,
    "star_count": 0,
    "runners_token": "b8547b1dc37721d05889db52fa2f02",
    "public_jobs": true,
    "shared_with_groups": [],
    "only_allow_merge_if_pipeline_succeeds": false,
    "allow_merge_on_skipped_pipeline": false,
    "allow_pipeline_trigger_approve_deployment": false,
    "restrict_user_defined_variables": false,
    "only_allow_merge_if_all_discussions_are_resolved": false,
    "remove_source_branch_after_merge": false,
    "request_access_enabled": false,
    "merge_method": "merge",
    "squash_option": "default_on",
    "auto_devops_enabled": true,
    "auto_devops_deploy_strategy": "continuous",
    "repository_storage": "default",
    "approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
    "mirror": false,
    "mirror_user_id": 45,
    "mirror_trigger_builds": false,
    "only_mirror_protected_branches": false,
    "mirror_overwrites_diverged_branches": false,
    "external_authorization_classification_label": null,
    "packages_enabled": true, // deprecated, use package_registry_access_level instead
    "package_registry_access_level": "enabled",
    "service_desk_enabled": false,
    "service_desk_address": null,
    "autoclose_referenced_issues": true,
    "enforce_auth_checks_on_uploads": true,
    "suggestion_commit_message": null,
    "merge_commit_template": null,
    "squash_commit_template": null,
    "secret_push_protection_enabled": false,
    "issue_branch_template": "gitlab/%{id}-%{title}",
    "statistics": {
      "commit_count": 12,
      "storage_size": 2066080,
      "repository_size": 2066080,
      "lfs_objects_size": 0,
      "job_artifacts_size": 0,
      "pipeline_artifacts_size": 0,
      "packages_size": 0,
      "snippets_size": 0,
      "uploads_size": 0,
      "container_registry_size": 0
    },
    "container_registry_image_prefix": "registry.example.com/brightbox/puppet",
    "_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",
      "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
    }
  }
]

名前でプロジェクトを検索する

認証済みのユーザーがアクセスできる名前でプロジェクトを検索します。認証なしでこのエンドポイントにアクセスする場合、エンドポイントは公開されているプロジェクトをリストします。

GET /projects

属性の例:

属性種類必須説明
search文字列はいプロジェクト名に含まれる文字列。
order_by文字列いいえidnamecreated_atstar_count、またはlast_activity_atフィールドで並べ替えられたリクエストを返します。
sort文字列いいえascまたはdescの順にソートされたリクエストを返します。

リクエストの例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects?search=test"

属性のリストを取得する

プロジェクトの属性のリストを取得します。

ユーザーのリストを取得する

プロジェクトのユーザーリストを取得します。

GET /projects/:id/users

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
search文字列いいえ特定のユーザーを検索します。
skip_users整数の配列いいえ指定されたIDを持つユーザーを除外します。

レスポンス例:

[
  {
    "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"
  },
  {
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
    "web_url": "http://localhost:3000/jack_smith"
  }
]

グループのリストを取得する

このプロジェクトの祖先グループのリストを取得します。

GET /projects/:id/groups

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
search文字列いいえ特定のグループを検索します。
shared_min_access_level整数いいえ少なくともこのロール(access_levelを持つ共有グループに制限します。
shared_visible_onlyブール値いいえユーザーがアクセスできる共有グループに制限します。
skip_groups整数の配列いいえ渡されたグループIDをスキップします。
with_sharedブール値いいえこのグループと共有されているプロジェクトを含めます。デフォルトはfalseです。

レスポンス例:

[
  {
    "id": 1,
    "name": "Foobar Group",
    "avatar_url": "http://localhost:3000/uploads/group/avatar/1/foo.jpg",
    "web_url": "http://localhost:3000/groups/foo-bar",
    "full_name": "Foobar Group",
    "full_path": "foo-bar"
  },
  {
    "id": 2,
    "name": "Shared Group",
    "avatar_url": "http://gitlab.example.com/uploads/group/avatar/1/bar.jpg",
    "web_url": "http://gitlab.example.com/groups/foo/bar",
    "full_name": "Shared Group",
    "full_path": "foo/shared"
  }
]

共有可能なグループのリストを取得する

プロジェクトと共有可能なグループのリストを取得します。

GET /projects/:id/share_locations

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
search文字列いいえ特定のグループを検索します。

レスポンス例:

[
  {
    "id": 22,
    "web_url": "http://127.0.0.1:3000/groups/gitlab-org",
    "name": "Gitlab Org",
    "avatar_url": null,
    "full_name": "Gitlab Org",
    "full_path": "gitlab-org"
  },
  {
    "id": 25,
    "web_url": "http://127.0.0.1:3000/groups/gnuwget",
    "name": "Gnuwget",
    "avatar_url": null,
    "full_name": "Gnuwget",
    "full_path": "gnuwget"
  }
]

プロジェクトに招待されたグループのリストを取得する

プロジェクトに招待されたグループのリストを取得します。認証なしでアクセスすると、公開招待グループのみが返されます。このエンドポイントは、次の項目ごとに1分あたり60件のリクエストにレート制限されています:

  • 認証済みユーザーのユーザー。
  • 認証されていないユーザーのIPアドレス。

APIの結果はページネーションされるため、デフォルトでは、このリクエストは一度に20個の結果を返します。

GET /projects/:id/invited_groups

サポートされている属性:

属性種類必須説明
id整数または文字列はいグループのIDまたはURLエンコードされたパス
search文字列いいえ検索条件に一致する認証済みグループのリストを返します
min_access_level整数いいえ現在のユーザーが、指定されているロール(access_level以上のロールを持っているグループに制限します。
relation文字列の配列いいえグループを関係(直接または継承)でフィルタリングします。
with_custom_attributesブール値いいえ応答にカスタム属性を含めます(管理者のみ)

レスポンス例:

[
  {
    "id": 35,
    "web_url": "https://gitlab.example.com/groups/twitter",
    "name": "Twitter",
    "avatar_url": null,
    "full_name": "Twitter",
    "full_path": "twitter"
  }
]

使用されているプログラミング言語のリストを取得する

プロジェクトで使用されているプログラミング言語のリストと使用率を取得します。

GET /projects/:id/languages

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/languages"

レスポンス例:

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

プロジェクトを管理する

プロジェクトを管理します(作成、削除、アーカイブなど)。

プロジェクトを作成する

認証済みユーザーが所有する新しいプロジェクトを作成します。

HTTPリポジトリが公開されていない場合は、URL https://username:password@gitlab.company.com/group/project.gitに認証情報を追加します。ここで、passwordapiスコープが有効な公開アクセスキーです。

POST /projects

サポートされている一般的なプロジェクトの属性:

属性種類必須説明
name文字列はい(pathが指定されていない場合)新しいプロジェクトの名前。指定されていない場合はパスと等しくなります。
path文字列はい(nameが指定されていない場合)新しいプロジェクトのリポジトリ名。指定されていない場合は、名前に基づいて生成されます(小文字とダッシュを使用して生成)。パスの先頭と末尾には特殊文字を使用できません。また、連続する特殊文字を含めることはできません。
allow_merge_on_skipped_pipelineブール値いいえスキップされたジョブでマージリクエストをマージできるかどうかを設定します。
approvals_before_merge整数いいえデフォルトでマージリクエストを承認する必要がある承認者の数。承認ルールを設定するには、マージリクエスト承認APIを参照してください。GitLab 16.0で非推奨になりました。PremiumおよびUltimateのみです。
auto_cancel_pending_pipelines文字列いいえ保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。
auto_devops_deploy_strategy文字列いいえ自動デプロイ戦略(continuousmanual、またはtimed_incremental)。
auto_devops_enabledブール値いいえこのプロジェクトに対してAuto DevOpsを有効にします。
autoclose_referenced_issuesブール値いいえデフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。
avatar混合いいえプロジェクトのアバターの画像ファイル。
build_git_strategy文字列いいえGit戦略。fetchがデフォルトです。
build_timeout整数いいえジョブの最大実行可能時間(秒単位)。
ci_config_path文字列いいえCI設定ファイルへのパス。
container_expiration_policy_attributesハッシュいいえこのプロジェクト用のイメージのクリーンアップポリシーを更新します。cadence(文字列)、keep_n(整数)、older_than(文字列)、name_regex(文字列)、name_regex_delete(文字列)、name_regex_keep(文字列)、enabled(ブール値)を指定できます。cadencekeep_nolder_thanの値の詳細については、コンテナレジストリのドキュメントを参照してください。
container_registry_enabledブール値いいえ_(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。
default_branch文字列いいえデフォルトブランチ名。initialize_with_readmetrueである必要があります。
description文字列いいえプロジェクトの短い説明。
emails_disabledブール値いいえ_(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。
emails_enabledブール値いいえメール通知を有効にします。
external_authorization_classification_label文字列いいえプロジェクトの分類ラベル。PremiumおよびUltimateのみです。
group_runners_enabledブール値いいえこのプロジェクトのグループRunnerを有効にします。
group_with_project_templates_id整数いいえグループレベルのカスタムテンプレートの場合、すべてのカスタムプロジェクトテンプレートのソースとなるグループのIDを指定します。インスタンスレベルのテンプレートの場合は空のままにします。use_custom_templateがtrueである必要があります。PremiumおよびUltimateのみです。
import_url文字列いいえリポジトリのインポート元のURL。URLの値が空でない場合は、initialize_with_readmetrueに設定しないでください。エラーnot a git repository)が発生する可能性があります。
initialize_with_readmeブール値いいえREADME.mdファイルのみを使用してGitリポジトリを作成するかどうか。デフォルトはfalseです。このブール値がtrueの場合、import_url、またはリポジトリの代替コンテンツを指定するこのエンドポイントの他の属性を渡してはなりません。エラーnot a git repository)が発生する可能性があります。
issues_enabledブール値いいえ_(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。
jobs_enabledブール値いいえ_(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。
lfs_enabledブール値いいえLFSを有効にします。
merge_method文字列いいえプロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。
merge_pipelines_enabledブール値いいえマージ結果パイプラインを有効または無効にします。
merge_requests_enabledブール値いいえ_(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。
merge_trains_enabledブール値いいえマージトレインを有効または無効にします。
merge_trains_skip_train_allowedブール値いいえパイプラインが完了するのを待たずに、マージトレインマージリクエストをマージできるようにします。
mirror_trigger_buildsブール値いいえプルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。
mirrorブール値いいえプロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。
namespace_id整数いいえ新しいプロジェクトのネームスペース。グループIDまたはサブグループIDを指定します。指定しない場合、デフォルトで現在のユーザーのパーソナルネームスペースが使用されます。
only_allow_merge_if_all_discussions_are_resolvedブール値いいえすべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。
only_allow_merge_if_all_status_checks_passedブール値いいえすべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。機能フラグonly_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。Ultimateのみです。
only_allow_merge_if_pipeline_succeedsブール値いいえマージリクエストを成功したパイプラインでのみマージできるようにするかどうかを設定します。この設定は、プロジェクト設定でパイプラインが完了しているという名前になります。
packages_enabledブール値いいえGitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。
package_registry_access_level文字列いいえパッケージリポジトリ機能を有効または無効にします。
printing_merge_request_link_enabledブール値いいえコマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。
public_buildsブール値いいえ(非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。
public_jobsブール値いいえtrueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。
repository_object_format文字列いいえリポジトリオブジェクト形式。sha1がデフォルトです。GitLab 16.9で導入されました。
remove_source_branch_after_mergeブール値いいえすべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。
repository_storage文字列いいえリポジトリが存在するストレージシャード。(管理者のみ)
request_access_enabledブール値いいえユーザーがメンバーアクセスをリクエストできるようにします。
resolve_outdated_diff_discussionsブール値いいえプッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。
shared_runners_enabledブール値いいえこのプロジェクト用にインスタンスRunnerを有効にします。
show_default_award_emojisブール値いいえデフォルトの絵文字リアクションを表示します。
snippets_enabledブール値いいえ_(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。
squash_option文字列いいえneveralwaysdefault_ondefault_offのいずれかです。
tag_list配列いいえプロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要のあるタグの配列を指定します。GitLab 14.0で非推奨になりました。代わりにtopicsを使用してください。
template_name文字列いいえuse_custom_templateを指定せずに使用する場合は、組み込みプロジェクトテンプレートの名前。use_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートの名前。
template_project_id整数いいえuse_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートのプロジェクトID。プロジェクトIDを使用する方法は、template_nameを使用する方法よりも推奨されます。これは、template_nameはあいまいになる可能性があるためです。PremiumおよびUltimateのみです。
topics配列いいえプロジェクトのトピックのリスト。最終的にプロジェクトに割り当てる必要のあるトピックの配列を指定します。
use_custom_templateブール値いいえカスタムインスタンスプロジェクトテンプレートまたはグループgroup_with_project_templates_id付き)プロジェクトテンプレートのいずれかを使用します。PremiumおよびUltimateのみです。
visibility文字列いいえプロジェクトの表示レベルを参照してください。
warn_about_potentially_unwanted_charactersブール値いいえこのプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。
wiki_enabledブール値いいえ_(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。

アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:

  • disabled: 機能を無効にします。
  • private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。
  • enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。
  • public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。
属性種類必須説明
analytics_access_level文字列いいえ分析の表示レベルを設定します。
builds_access_level文字列いいえパイプラインの表示レベルを設定します。
container_registry_access_level文字列いいえコンテナレジストリの表示レベルを設定します。
environments_access_level文字列いいえ環境の表示レベルを設定します。
feature_flags_access_level文字列いいえ機能フラグの表示レベルを設定します。
forking_access_level文字列いいえフォークの表示レベルを設定します。
infrastructure_access_level文字列いいえインフラストラクチャ管理の表示レベルを設定します。
issues_access_level文字列いいえイシューの表示レベルを設定します。
merge_requests_access_level文字列いいえマージリクエストの表示レベルを設定します。
model_experiments_access_level文字列いいえ機械学習モデル検証の表示レベルを設定します。
model_registry_access_level文字列いいえ機械学習モデルレジストリの表示レベルを設定します。
monitor_access_level文字列いいえアプリケーションパフォーマンスモニタリングの表示レベルを設定します。
pages_access_level文字列いいえGitLab Pagesの表示レベルを設定します。
releases_access_level文字列いいえリリースの表示レベルを設定します。
repository_access_level文字列いいえリポジトリの表示レベルを設定します。
requirements_access_level文字列いいえ要件管理の表示レベルを設定します。
security_and_compliance_access_level文字列いいえセキュリティとコンプライアンスの表示レベルを設定します。
snippets_access_level文字列いいえスニペットの表示レベルを設定します。
wiki_access_level文字列いいえWikiの表示レベルを設定します。

リクエストの例:

curl --request POST --header "PRIVATE-TOKEN: <your-token>" \
     --header "Content-Type: application/json" --data '{
        "name": "new_project", "description": "New Project", "path": "new_project",
        "namespace_id": "42", "initialize_with_readme": "true"}' \
     --url "https://gitlab.example.com/api/v4/projects/"

ユーザーのプロジェクトを作成する

ユーザーのプロジェクトを作成します。

前提要件:

  • 管理者である必要があります。

HTTPリポジトリが公開されていない場合は、認証情報をURLに追加します。たとえばhttps://username:password@gitlab.company.com/group/project.gitの場合、passwordは、apiスコープが有効になっているパブリックアクセスキーです。

POST /projects/user/:user_id

サポートされている一般的なプロジェクトの属性:

属性種類必須説明
name文字列はい新しいプロジェクトの名前。
user_id整数はいプロジェクトオーナーのユーザーID。
allow_merge_on_skipped_pipelineブール値いいえスキップされたジョブでマージリクエストをマージできるかどうかを設定します。
approvals_before_merge整数いいえデフォルトでマージリクエストを承認する必要がある承認者の数。GitLab 16.0で非推奨になりました。承認ルールを設定するには、マージリクエスト承認APIを参照してください。PremiumおよびUltimateのみです。
auto_cancel_pending_pipelines文字列いいえ保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。
auto_devops_deploy_strategy文字列いいえ自動デプロイ戦略(continuousmanual、またはtimed_incremental)。
auto_devops_enabledブール値いいえこのプロジェクトに対してAuto DevOpsを有効にします。
autoclose_referenced_issuesブール値いいえデフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。
avatar混合いいえプロジェクトのアバターの画像ファイル。
build_git_strategy文字列いいえGit戦略。fetchがデフォルトです。
build_timeout整数いいえジョブの最大実行可能時間(秒単位)。
ci_config_path文字列いいえCI設定ファイルへのパス。
container_registry_enabledブール値いいえ_(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。
default_branch文字列いいえデフォルトブランチ名。initialize_with_readmetrueである必要があります。
description文字列いいえプロジェクトの短い説明。
emails_disabledブール値いいえ_(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。
emails_enabledブール値いいえメール通知を有効にします。
enforce_auth_checks_on_uploadsブール値いいえアップロード時に認証チェックを強制します。
external_authorization_classification_label文字列いいえプロジェクトの分類ラベル。PremiumおよびUltimateのみです。
group_runners_enabledブール値いいえこのプロジェクトのグループRunnerを有効にします。
group_with_project_templates_id整数いいえグループレベルのカスタムテンプレートの場合、すべてのカスタムプロジェクトテンプレートのソースとなるグループのIDを指定します。インスタンスレベルのテンプレートの場合は空のままにします。use_custom_templateがtrueである必要があります。PremiumおよびUltimateのみです。
import_url文字列いいえリポジトリのインポート元のURL。
initialize_with_readmeブール値いいえデフォルトではfalseです。
issue_branch_template文字列いいえイシューから作成されたブランチの名前を提案するために使用されるテンプレート。(GitLab 15.6で導入されました)
issues_enabledブール値いいえ_(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。
jobs_enabledブール値いいえ_(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。
lfs_enabledブール値いいえLFSを有効にします。
merge_commit_template文字列いいえマージリクエストでマージコミットメッセージを作成するために使用されるテンプレート
merge_method文字列いいえプロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。
merge_requests_enabledブール値いいえ_(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。
mirror_trigger_buildsブール値いいえプルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。
mirrorブール値いいえプロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。
namespace_id整数いいえ新しいプロジェクトのネームスペース(デフォルトは現在のユーザーのネームスペース)。
only_allow_merge_if_all_discussions_are_resolvedブール値いいえすべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。
only_allow_merge_if_all_status_checks_passedブール値いいえすべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。機能フラグonly_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。Ultimateのみです。
only_allow_merge_if_pipeline_succeedsブール値いいえマージリクエストを成功したジョブのみとマージできるようにするかどうかを設定します。
packages_enabledブール値いいえGitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。
package_registry_access_level文字列いいえパッケージリポジトリ機能を有効または無効にします。
path文字列いいえ新しいプロジェクトのカスタムリポジトリ名。デフォルトでは、名前に基づいて生成されます。
printing_merge_request_link_enabledブール値いいえコマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。
public_buildsブール値いいえ(非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。
public_jobsブール値いいえtrueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。
repository_object_format文字列いいえリポジトリオブジェクト形式。sha1がデフォルトです。GitLab 16.9で導入されました。
remove_source_branch_after_mergeブール値いいえすべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。
repository_storage文字列いいえリポジトリが存在するストレージシャード。(管理者のみ)
request_access_enabledブール値いいえユーザーがメンバーアクセスをリクエストできるようにします。
resolve_outdated_diff_discussionsブール値いいえプッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。
shared_runners_enabledブール値いいえこのプロジェクト用にインスタンスRunnerを有効にします。
show_default_award_emojisブール値いいえデフォルトの絵文字リアクションを表示します。
snippets_enabledブール値いいえ_(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。
squash_commit_template文字列いいえマージリクエストでスカッシュコミットメッセージを作成するために使用されるテンプレート
squash_option文字列いいえneveralwaysdefault_ondefault_offのいずれかです。
suggestion_commit_message文字列いいえマージリクエストの提案を適用するために使用されるコミットメッセージ。
tag_list配列いいえ_(GitLab 14.0で非推奨になりました)_プロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要があるタグの配列を指定します。代わりにtopicsを使用してください。
template_name文字列いいえuse_custom_templateを指定せずに使用する場合は、組み込みプロジェクトテンプレートの名前。use_custom_templateとともに使用する場合は、カスタムプロジェクトテンプレートの名前。
topics配列いいえプロジェクトのトピックのリスト。
use_custom_templateブール値いいえカスタムインスタンスプロジェクトテンプレートまたはグループgroup_with_project_templates_id付き)プロジェクトテンプレートのいずれかを使用します。PremiumおよびUltimateのみです。
visibility文字列いいえプロジェクトの表示レベルを参照してください。
warn_about_potentially_unwanted_charactersブール値いいえこのプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。
wiki_enabledブール値いいえ_(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。

アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:

  • disabled: 機能を無効にします。
  • private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。
  • enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。
  • public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。
属性種類必須説明
analytics_access_level文字列いいえ分析の表示レベルを設定します。
builds_access_level文字列いいえパイプラインの表示レベルを設定します。
container_registry_access_level文字列いいえコンテナレジストリの表示レベルを設定します。
environments_access_level文字列いいえ環境の表示レベルを設定します。
feature_flags_access_level文字列いいえ機能フラグの表示レベルを設定します。
forking_access_level文字列いいえフォークの表示レベルを設定します。
infrastructure_access_level文字列いいえインフラストラクチャ管理の表示レベルを設定します。
issues_access_level文字列いいえイシューの表示レベルを設定します。
merge_requests_access_level文字列いいえマージリクエストの表示レベルを設定します。
model_experiments_access_level文字列いいえ機械学習モデル検証の表示レベルを設定します。
model_registry_access_level文字列いいえ機械学習モデルレジストリの表示レベルを設定します。
monitor_access_level文字列いいえアプリケーションパフォーマンスモニタリングの表示レベルを設定します。
pages_access_level文字列いいえGitLab Pagesの表示レベルを設定します。
releases_access_level文字列いいえリリースの表示レベルを設定します。
repository_access_level文字列いいえリポジトリの表示レベルを設定します。
requirements_access_level文字列いいえ要件管理の表示レベルを設定します。
security_and_compliance_access_level文字列いいえセキュリティとコンプライアンスの表示レベルを設定します。
snippets_access_level文字列いいえスニペットの表示レベルを設定します。
wiki_access_level文字列いいえWikiの表示レベルを設定します。

プロジェクトを編集する

既存のプロジェクトを更新します。

HTTPリポジトリが公開されていない場合は、URL https://username:password@gitlab.company.com/group/project.gitに認証情報を追加します。ここで、passwordapiスコープが有効な公開アクセスキーです。

PUT /projects/:id

サポートされている一般的なプロジェクトの属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
allow_merge_on_skipped_pipelineブール値いいえスキップされたジョブでマージリクエストをマージできるかどうかを設定します。
allow_pipeline_trigger_approve_deploymentブール値いいえパイプラインのトリガー元がデプロイを承認できるかどうかを設定します。PremiumおよびUltimateのみです。
only_allow_merge_if_all_status_checks_passedブール値いいえすべてのステータスチェックに合格していなければ、マージリクエストのマージをブロックする必要があることを示します。デフォルトはfalseです。

機能フラグonly_allow_merge_if_all_status_checks_passedをデフォルトで無効にして、GitLab 15.5で導入されました。この機能フラグは、GitLab 15.9でデフォルトで有効になりました。Ultimateのみです。
approvals_before_merge整数いいえデフォルトでマージリクエストを承認する必要がある承認者の数。GitLab 16.0で非推奨になりました。承認ルールを設定するには、マージリクエスト承認APIを参照してください。PremiumおよびUltimateのみです。
auto_cancel_pending_pipelines文字列いいえ保留中のパイプラインを自動的にキャンセルします。このアクションは、有効状態と無効状態を切り替えます。ブール値ではありません。
auto_devops_deploy_strategy文字列いいえ自動デプロイ戦略(continuousmanual、またはtimed_incremental)。
auto_devops_enabledブール値いいえこのプロジェクトに対してAuto DevOpsを有効にします。
auto_duo_code_review_enabledブール値いいえマージリクエストでGitLab Duoによる自動レビューを有効にします。マージリクエストのGitLab Duoしてください。Ultimateのみです。
autoclose_referenced_issuesブール値いいえデフォルトブランチで参照されているイシューを自動的にクローズするかどうかを設定します。
avatar混合いいえプロジェクトのアバターの画像ファイル。
build_git_strategy文字列いいえGit戦略。fetchがデフォルトです。
build_timeout整数いいえジョブの最大実行可能時間(秒単位)。
ci_config_path文字列いいえCI設定ファイルへのパス。
ci_default_git_depth整数いいえシャロークローンのリビジョンのデフォルト数。
ci_delete_pipelines_in_seconds整数いいえ設定された時刻よりも前のパイプラインは削除されます。
ci_forward_deployment_enabledブール値いいえ古いデプロイジョブを防止を有効または無効にします。
ci_forward_deployment_rollback_allowedブール値いいえロールバックデプロイのジョブの再試行を許可するを有効または無効にします。
ci_allow_fork_pipelines_to_run_in_parent_projectブール値いいえフォークからのマージリクエストに対して親プロジェクトでパイプラインを実行するを有効または無効にします。(GitLab 15.3で導入されました)
ci_id_token_sub_claim_components配列いいえIDトークンsubクレームに含まれるフィールド。project_pathで始まる配列を指定できます。配列にはref_typerefも含まれる場合があります。["project_path", "ref_type", "ref"]がデフォルトです。GitLab 17.10で導入されました。
ci_separated_cachesブール値いいえキャッシュをブランチの保護状態に応じて分離するかどうかを設定します。
ci_restrict_pipeline_cancellation_role文字列いいえパイプラインまたはジョブをキャンセルするために必要なロールを設定します。developermaintainerno_oneのいずれかです。GitLab 16.8で導入されました。PremiumおよびUltimateのみです。
ci_pipeline_variables_minimum_override_role文字列いいえ変数をオーバーライドできるロールを指定できます。ownermaintainerdeveloperno_one_allowedのいずれかです。GitLab 17.1で導入されました。GitLab 17.1~17.7では、restrict_user_defined_variablesを有効にする必要があります。
ci_push_repository_for_job_token_allowedブール値いいえジョブトークンを使用してプロジェクトリポジトリにプロジェクトをプッシュする機能を有効または無効にします。GitLab 17.2で導入されました。
container_expiration_policy_attributesハッシュいいえこのプロジェクト用のイメージのクリーンアップポリシーを更新します。cadence(文字列)、keep_n(整数)、older_than(文字列)、name_regex(文字列)、name_regex_delete(文字列)、name_regex_keep(文字列)、enabled(ブール値)を指定できます。
container_registry_enabledブール値いいえ_(非推奨)_このプロジェクトのコンテナレジストリを有効にします。代わりにcontainer_registry_access_levelを使用してください。
default_branch文字列いいえデフォルトブランチ名。
description文字列いいえプロジェクトの短い説明。
duo_remote_flows_enabledブール値いいえプロジェクトでフローを実行できるかどうかを決定します。
emails_disabledブール値いいえ_(非推奨)_メール通知を無効にします。代わりにemails_enabledを使用してください。
emails_enabledブール値いいえメール通知を有効にします。
enforce_auth_checks_on_uploadsブール値いいえアップロード時に認証チェックを強制します。
external_authorization_classification_label文字列いいえプロジェクトの分類ラベル。PremiumおよびUltimateのみです。
group_runners_enabledブール値いいえこのプロジェクトのグループRunnerを有効にします。
import_url文字列いいえリポジトリのインポート元URL。
issues_enabledブール値いいえ_(非推奨)_このプロジェクト用にイシューを有効にします。代わりにissues_access_levelを使用してください。
issues_template文字列いいえイシューのデフォルトの説明。説明は、GitLab Flavored Markdownを使用して解析されます。イシューとマージリクエストのテンプレートを参照してください。PremiumおよびUltimateのみです。
jobs_enabledブール値いいえ_(非推奨)_このプロジェクト用にジョブを有効にします。代わりにbuilds_access_levelを使用してください。
keep_latest_artifactブール値いいえこのプロジェクトの最新のアーティファクトを保持する機能を無効または有効にします。
lfs_enabledブール値いいえLFSを有効にします。
max_artifacts_size整数いいえ個々のジョブアーティファクトの最大ファイルサイズ(MB単位)。
merge_commit_template文字列いいえマージリクエストでマージコミットメッセージを作成するために使用されるテンプレート
merge_method文字列いいえプロジェクトのマージ方法を設定します。merge(マージコミット)、rebase_merge(半線形履歴を使用するマージコミット)、またはff(早送りマージ)を指定できます。
merge_pipelines_enabledブール値いいえマージ結果パイプラインを有効または無効にします。
merge_requests_enabledブール値いいえ_(非推奨)_このプロジェクト用にマージリクエストを有効にします。代わりにmerge_requests_access_levelを使用してください。
merge_trains_enabledブール値いいえマージトレインを有効または無効にします。
merge_trains_skip_train_allowedブール値いいえパイプラインが完了するのを待たずに、マージトレインマージリクエストをマージできるようにします。
mirror_overwrites_diverged_branchesブール値いいえプルミラーが、分岐したブランチを上書きします。PremiumおよびUltimateのみです。
mirror_trigger_buildsブール値いいえプルミラーリングがビルドをトリガーします。PremiumおよびUltimateのみです。
mirror_user_id整数いいえプルミラーイベントに関連するすべてのアクティビティーを担当するユーザー。_(管理者のみ)_PremiumとUltimateプランのみ。
mirrorブール値いいえプロジェクトでプルミラーリングを有効にします。PremiumおよびUltimateのみです。
mr_default_target_selfブール値いいえフォークされたプロジェクトの場合、マージリクエストのターゲットをこのプロジェクトに設定します。falseの場合、ターゲットはアップストリームプロジェクトになります。
name文字列いいえプロジェクト名。
only_allow_merge_if_all_discussions_are_resolvedブール値いいえすべてのディスカッションが解決された場合にのみマージリクエストをマージできるようにするかどうかを設定します。
only_allow_merge_if_pipeline_succeedsブール値いいえマージリクエストを成功したジョブのみとマージできるようにするかどうかを設定します。
only_mirror_protected_branchesブール値いいえ保護ブランチのみをミラーリングします。PremiumおよびUltimateのみです。
packages_enabledブール値いいえGitLab 17.10で非推奨になりました。パッケージリポジトリ機能を有効または無効にします。代わりにpackage_registry_access_levelを使用してください。
package_registry_access_level文字列いいえパッケージリポジトリ機能を有効または無効にします。
path文字列いいえプロジェクトのカスタムリポジトリ名。デフォルトでは、名前に基づいて生成されます。
prevent_merge_without_jira_issueブール値いいえマージリクエストで、Jiraからの関連イシューを必須にするかどうかを設定します。Ultimateのみです。
printing_merge_request_link_enabledブール値いいえコマンドラインからプッシュするときに、マージリクエストを作成/表示するためのリンクを表示します。
public_buildsブール値いいえ(非推奨)trueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。代わりにpublic_jobsを使用してください。
public_jobsブール値いいえtrueの場合、プロジェクトメンバー以外のユーザーもジョブを表示できます。
remove_source_branch_after_mergeブール値いいえすべての新しいマージリクエストに対して、デフォルトでDelete source branchオプションを有効にします。
repository_storage文字列いいえリポジトリが存在するストレージシャード。(管理者のみ)
request_access_enabledブール値いいえユーザーがメンバーアクセスをリクエストできるようにします。
resolve_outdated_diff_discussionsブール値いいえプッシュで変更された行に関するマージリクエスト差分ディスカッションを自動的に解決します。
restrict_user_defined_variablesブール値いいえ_(GitLab 17.7で非推奨となり、ci_pipeline_variables_minimum_override_roleが推奨されます)_パイプラインをトリガーするときに、メンテナーロールを持つユーザーのみがユーザー定義変数を渡せるようにします。たとえば、UIで、APIを使用して、またはトリガートークンにより、パイプラインがトリガーされる場合などです。
service_desk_enabledブール値いいえサービスデスク機能を有効または無効にします。
shared_runners_enabledブール値いいえこのプロジェクト用にインスタンスRunnerを有効にします。
show_default_award_emojisブール値いいえデフォルトの絵文字リアクションを表示します。
snippets_enabledブール値いいえ_(非推奨)_このプロジェクト用にスニペットを有効にします。代わりにsnippets_access_levelを使用してください。
issue_branch_template文字列いいえイシューから作成されたブランチの名前を提案するために使用されるテンプレート。(GitLab 15.6で導入されました)
spp_repository_pipeline_accessブール値いいえユーザーとトークンに、このプロジェクトからセキュリティポリシーの設定をフェッチするための読み取り専用アクセスを許可します。このプロジェクトをセキュリティポリシーソースとして使用するプロジェクトで、セキュリティポリシーを適用するために必要です。Ultimateのみです。
squash_commit_template文字列いいえマージリクエストでスカッシュコミットメッセージを作成するために使用されるテンプレート
squash_option文字列いいえneveralwaysdefault_ondefault_offのいずれかです。
suggestion_commit_message文字列いいえマージリクエストの提案を適用するために使用されるコミットメッセージ。
tag_list配列いいえ_(GitLab 14.0で非推奨になりました)_プロジェクトのタグのリスト。最終的にプロジェクトに割り当てる必要があるタグの配列を指定します。代わりにtopicsを使用してください。
topics配列いいえプロジェクトのトピックのリスト。これにより、プロジェクトにすでに追加されている既存のトピックがすべて置き換えられます。
visibility文字列いいえプロジェクトの表示レベルを参照してください。
warn_about_potentially_unwanted_charactersブール値いいえこのプロジェクトで不要である可能性がある文字の使用に関する警告を有効にします。
wiki_enabledブール値いいえ_(非推奨)_このプロジェクト用にWikiを有効にします。代わりにwiki_access_levelを使用してください。
web_based_commit_signing_enabledブール値いいえGitLab UIから作成されたコミットに対する、Webベースのコミット署名を有効にします。GitLab.comでのみ利用可能です。

たとえば、GitLab.comプロジェクトのインスタンスRunnerの設定を切り替えるには、次のようにします:

curl --request PUT --header "PRIVATE-TOKEN: <your-token>" \
     --url "https://gitlab.com/api/v4/projects/<your-project-ID>" \
     --data "shared_runners_enabled=true" # to turn off: "shared_runners_enabled=false"

アクセス制御オプションを使用したプロジェクト機能の表示レベル設定は、次のいずれかにできます:

  • disabled: 機能を無効にします。
  • private: 機能を有効にして、Only project members(プロジェクトメンバーのみ)に設定します。
  • enabled: 機能を有効にして、Everyone with access(アクセスできる人すべて)に設定します。
  • public: 機能を有効にして、全員に設定します。pages_access_levelでのみ利用可能です。

サポートされているプロジェクトの表示レベル属性を以下に示します:

属性種類必須説明
analytics_access_level文字列いいえ分析の表示レベルを設定します。
builds_access_level文字列いいえパイプラインの表示レベルを設定します。
container_registry_access_level文字列いいえコンテナレジストリの表示レベルを設定します。
environments_access_level文字列いいえ環境の表示レベルを設定します。
feature_flags_access_level文字列いいえ機能フラグの表示レベルを設定します。
forking_access_level文字列いいえフォークの表示レベルを設定します。
infrastructure_access_level文字列いいえインフラストラクチャ管理の表示レベルを設定します。
issues_access_level文字列いいえイシューの表示レベルを設定します。
merge_requests_access_level文字列いいえマージリクエストの表示レベルを設定します。
model_experiments_access_level文字列いいえ機械学習モデル検証の表示レベルを設定します。
model_registry_access_level文字列いいえ機械学習モデルレジストリの表示レベルを設定します。
monitor_access_level文字列いいえアプリケーションパフォーマンスモニタリングの表示レベルを設定します。
pages_access_level文字列いいえGitLab Pagesの表示レベルを設定します。
releases_access_level文字列いいえリリースの表示レベルを設定します。
repository_access_level文字列いいえリポジトリの表示レベルを設定します。
requirements_access_level文字列いいえ要件管理の表示レベルを設定します。
security_and_compliance_access_level文字列いいえセキュリティとコンプライアンスの表示レベルを設定します。
snippets_access_level文字列いいえスニペットの表示レベルを設定します。
wiki_access_level文字列いいえWikiの表示レベルを設定します。

メンバーをインポートする

別のプロジェクトからメンバーをインポートします。

ターゲットプロジェクトに対するインポートメンバーのロールによって、次のようになります:

  • メンテナーの場合、ソースプロジェクトのオーナーロールを持つメンバーは、メンテナーロールでインポートされます。
  • オーナーの場合、ソースプロジェクトのオーナーロールを持つメンバーは、オーナーロールでインポートされます。
POST /projects/:id/import_project_members/:project_id

サポートされている属性:

属性種類必須説明
id整数または文字列はいメンバーを受け入れるターゲットプロジェクトのIDまたはURLエンコードされたパス
project_id整数または文字列はいメンバーのインポート元のソースプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/import_project_members/32"

戻り値:

  • 成功した場合は200 OK
  • ターゲットプロジェクトまたはソースプロジェクトが存在しないか、リクエスタがアクセスできない場合は、404 Project Not Found
  • プロジェクトメンバーのインポートが正常に完了しなかった場合は、422 Unprocessable Entity

レスポンス例:

  • すべてのメールが正常に送信された場合(HTTPステータスコード200):

    {  "status":  "success"  }
  • 1つ以上のメンバーのインポートでエラーが発生した場合(HTTPステータスコード200):

    {
      "status": "error",
      "message": {
                   "john_smith": "Some individual error message",
                   "jane_smith": "Some individual error message"
                 },
      "total_members_count": 3
    }
  • システムエラーが発生した場合(HTTPステータスコード404および422):

{  "message":  "Import failed"  }

プロジェクトをアーカイブする

プロジェクトをアーカイブします。

前提要件:

  • 管理者であるか、プロジェクトのオーナーロールが割り当てられている必要があります。

このエンドポイントはべき等です。すでにアーカイブされているプロジェクトをアーカイブしても、プロジェクトは変更されません。

POST /projects/:id/archive

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/archive"

レスポンス例:

{
  "id": 3,
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
  "default_branch": "main",
  "visibility": "private",
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/main/README.md",
  "tag_list": [ //deprecated, use `topics` instead
    "example",
    "disapora project"
  ],
  "topics": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "repository_object_format": "sha1",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
  "jobs_enabled": true,
  "wiki_enabled": true,
  "snippets_enabled": false,
  "can_create_merge_request_in": true,
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
  "container_registry_access_level": "disabled",
  "security_and_compliance_access_level": "disabled",
  "created_at": "2013-09-30T13:46:02Z",
  "updated_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",
  "import_error": null,
  "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",
  "license_url": "http://example.com/diaspora/diaspora-client/blob/main/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
  "shared_runners_enabled": true,
  "group_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
  "ci_default_git_depth": 50,
  "ci_forward_deployment_enabled": true,
  "ci_forward_deployment_rollback_allowed": true,
  "ci_allow_fork_pipelines_to_run_in_parent_project": true,
  "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
  "ci_separated_caches": true,
  "ci_restrict_pipeline_cancellation_role": "developer",
  "ci_pipeline_variables_minimum_override_role": "maintainer",
  "ci_push_repository_for_job_token_allowed": false,
  "public_jobs": true,
  "shared_with_groups": [],
  "only_allow_merge_if_pipeline_succeeds": false,
  "allow_merge_on_skipped_pipeline": false,
  "allow_pipeline_trigger_approve_deployment": false,
  "restrict_user_defined_variables": false,
  "only_allow_merge_if_all_discussions_are_resolved": false,
  "remove_source_branch_after_merge": false,
  "request_access_enabled": false,
  "merge_method": "merge",
  "squash_option": "default_on",
  "autoclose_referenced_issues": true,
  "enforce_auth_checks_on_uploads": true,
  "suggestion_commit_message": null,
  "merge_commit_template": null,
  "secret_push_protection_enabled": false,
  "container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
  "_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",
    "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
  }
}

プロジェクトのアーカイブを解除する

プロジェクトのアーカイブを解除します。

前提要件:

  • 管理者であるか、プロジェクトのオーナーロールが割り当てられている必要があります。

このエンドポイントはべき等です。アーカイブされていないプロジェクトのアーカイブを解除しても、プロジェクトは変更されません。

POST /projects/:id/unarchive

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/unarchive"

レスポンス例:

{
  "id": 3,
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
  "default_branch": "main",
  "visibility": "private",
  "ssh_url_to_repo": "git@example.com:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "readme_url": "http://example.com/diaspora/diaspora-project-site/blob/main/README.md",
  "tag_list": [ //deprecated, use `topics` instead
    "example",
    "disapora project"
  ],
  "topics": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13:46:02Z"
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "repository_object_format": "sha1",
  "issues_enabled": true,
  "open_issues_count": 1,
  "merge_requests_enabled": true,
  "jobs_enabled": true,
  "wiki_enabled": true,
  "snippets_enabled": false,
  "can_create_merge_request_in": true,
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": false, // deprecated, use container_registry_access_level instead
  "container_registry_access_level": "disabled",
  "security_and_compliance_access_level": "disabled",
  "created_at": "2013-09-30T13:46:02Z",
  "updated_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",
  "import_error": null,
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
  "license_url": "http://example.com/diaspora/diaspora-client/blob/main/LICENSE",
  "license": {
    "key": "lgpl-3.0",
    "name": "GNU Lesser General Public License v3.0",
    "nickname": "GNU LGPLv3",
    "html_url": "http://choosealicense.com/licenses/lgpl-3.0/",
    "source_url": "http://www.gnu.org/licenses/lgpl-3.0.txt"
  },
  "shared_runners_enabled": true,
  "group_runners_enabled": true,
  "forks_count": 0,
  "star_count": 0,
  "runners_token": "b8bc4a7a29eb76ea83cf79e4908c2b",
  "ci_default_git_depth": 50,
  "ci_forward_deployment_enabled": true,
  "ci_forward_deployment_rollback_allowed": true,
  "ci_allow_fork_pipelines_to_run_in_parent_project": true,
  "ci_id_token_sub_claim_components": ["project_path", "ref_type", "ref"],
  "ci_separated_caches": true,
  "ci_restrict_pipeline_cancellation_role": "developer",
  "ci_pipeline_variables_minimum_override_role": "maintainer",
  "ci_push_repository_for_job_token_allowed": false,
  "public_jobs": true,
  "shared_with_groups": [],
  "only_allow_merge_if_pipeline_succeeds": false,
  "allow_merge_on_skipped_pipeline": false,
  "allow_pipeline_trigger_approve_deployment": false,
  "restrict_user_defined_variables": false,
  "only_allow_merge_if_all_discussions_are_resolved": false,
  "remove_source_branch_after_merge": false,
  "request_access_enabled": false,
  "merge_method": "merge",
  "squash_option": "default_on",
  "autoclose_referenced_issues": true,
  "enforce_auth_checks_on_uploads": true,
  "suggestion_commit_message": null,
  "merge_commit_template": null,
  "container_registry_image_prefix": "registry.example.com/diaspora/diaspora-project-site",
  "secret_push_protection_enabled": false,
  "_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",
    "cluster_agents": "http://example.com/api/v4/projects/1/cluster_agents"
  }
}

プロジェクトを削除する

前提要件:

  • 管理者であるか、プロジェクトのオーナーロールを持っている必要があります。

プロジェクトを削除対象としてマークします。プロジェクトは、保持期間の終了時に削除されます:

  • GitLab.comでは、プロジェクトは30日間保持されます。
  • GitLab Self-Managedでは、保持期間はインスタンスの設定によって制御されます。

このエンドポイントは、以前に削除対象としてマークされたプロジェクトを即座に削除することもできます。

GitLab.comでは、プロジェクトが削除された後、そのデータは30日間保持され、即時削除は利用できません。GitLab.comでプロジェクトをすぐに削除する必要がある場合は、サポートチケットを発行してください。

DELETE /projects/:id

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
full_path文字列いいえpermanently_removeで使用するプロジェクトのフルパス。GitLab 15.11でPremiumおよびUltimate限定で導入され、18.0でGitLab Freeに移行されました。プロジェクトパスを確認するには、単一プロジェクトの取得path_with_namespaceを使用します。
permanently_removeブール値/文字列いいえ削除対象としてマークされているプロジェクトを即時削除します。GitLab 15.11でPremiumおよびUltimate限定で導入され、18.0でGitLab Freeに移行されました。GitLab.comとDedicatedでは無効になっています。

削除対象としてマークされているプロジェクトを復元する

削除対象としてマークされているプロジェクトを復元します。

POST /projects/:id/restore

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

プロジェクトを新しいネームスペースに転送する

プロジェクトを新しいネームスペースに転送します。

プロジェクトの転送に必要な前提要件については、プロジェクトを別のネームスペースに転送を参照してください。

PUT /projects/:id/transfer

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
namespace整数または文字列はいプロジェクトの転送先のネームスペースのIDまたはパス。

リクエストの例:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/transfer?namespace=14"

レスポンス例:

  {
  "id": 7,
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  "description_html": "<p data-sourcepos=\"1:1-1:56\" dir=\"auto\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
  "name": "hello-world",
  "name_with_namespace": "cute-cats / hello-world",
  "path": "hello-world",
  "path_with_namespace": "cute-cats/hello-world",
  "created_at": "2020-10-15T16:25:22.415Z",
  "updated_at": "2020-10-15T16:25:22.415Z",
  "default_branch": "main",
  "tag_list": [], //deprecated, use `topics` instead
  "topics": [],
  "ssh_url_to_repo": "git@gitlab.example.com:cute-cats/hello-world.git",
  "http_url_to_repo": "https://gitlab.example.com/cute-cats/hello-world.git",
  "web_url": "https://gitlab.example.com/cute-cats/hello-world",
  "readme_url": "https://gitlab.example.com/cute-cats/hello-world/-/blob/main/README.md",
  "avatar_url": null,
  "forks_count": 0,
  "star_count": 0,
  "last_activity_at": "2020-10-15T16:25:22.415Z",
  "namespace": {
    "id": 18,
    "name": "cute-cats",
    "path": "cute-cats",
    "kind": "group",
    "full_path": "cute-cats",
    "parent_id": null,
    "avatar_url": null,
    "web_url": "https://gitlab.example.com/groups/cute-cats"
  },
  "container_registry_image_prefix": "registry.example.com/cute-cats/hello-world",
  "_links": {
    "self": "https://gitlab.example.com/api/v4/projects/7",
    "issues": "https://gitlab.example.com/api/v4/projects/7/issues",
    "merge_requests": "https://gitlab.example.com/api/v4/projects/7/merge_requests",
    "repo_branches": "https://gitlab.example.com/api/v4/projects/7/repository/branches",
    "labels": "https://gitlab.example.com/api/v4/projects/7/labels",
    "events": "https://gitlab.example.com/api/v4/projects/7/events",
    "members": "https://gitlab.example.com/api/v4/projects/7/members"
  },
  "packages_enabled": true, // deprecated, use package_registry_access_level instead
  "package_registry_access_level": "enabled",
  "empty_repo": false,
  "archived": false,
  "visibility": "private",
  "resolve_outdated_diff_discussions": false,
  "container_registry_enabled": true, // deprecated, use container_registry_access_level instead
  "container_registry_access_level": "enabled",
  "container_expiration_policy": {
    "cadence": "7d",
    "enabled": false,
    "keep_n": null,
    "older_than": null,
    "name_regex": null,
    "name_regex_keep": null,
    "next_run_at": "2020-10-22T16:25:22.746Z"
  },
  "issues_enabled": true,
  "merge_requests_enabled": true,
  "wiki_enabled": true,
  "jobs_enabled": true,
  "snippets_enabled": true,
  "service_desk_enabled": false,
  "service_desk_address": null,
  "can_create_merge_request_in": true,
  "issues_access_level": "enabled",
  "repository_access_level": "enabled",
  "merge_requests_access_level": "enabled",
  "forking_access_level": "enabled",
  "analytics_access_level": "enabled",
  "wiki_access_level": "enabled",
  "builds_access_level": "enabled",
  "snippets_access_level": "enabled",
  "pages_access_level": "enabled",
  "security_and_compliance_access_level": "enabled",
  "emails_disabled": null,
  "emails_enabled": null,
  "shared_runners_enabled": true,
  "group_runners_enabled": true,
  "lfs_enabled": true,
  "creator_id": 2,
  "import_status": "none",
  "open_issues_count": 0,
  "ci_default_git_depth": 50,
  "public_jobs": true,
  "build_timeout": 3600,
  "auto_cancel_pending_pipelines": "enabled",
  "ci_config_path": null,
  "shared_with_groups": [],
  "only_allow_merge_if_pipeline_succeeds": false,
  "allow_merge_on_skipped_pipeline": null,
  "allow_pipeline_trigger_approve_deployment": false,
  "restrict_user_defined_variables": false,
  "request_access_enabled": true,
  "only_allow_merge_if_all_discussions_are_resolved": false,
  "remove_source_branch_after_merge": true,
  "printing_merge_request_link_enabled": true,
  "merge_method": "merge",
  "squash_option": "default_on",
  "suggestion_commit_message": null,
  "merge_commit_template": null,
  "auto_devops_enabled": true,
  "auto_devops_deploy_strategy": "continuous",
  "autoclose_referenced_issues": true,
  "approvals_before_merge": 0, // Deprecated. Use merge request approvals API instead.
  "mirror": false,
  "compliance_frameworks": [],
  "warn_about_potentially_unwanted_characters": true,
  "secret_push_protection_enabled": false
}

プロジェクト転送に利用可能なグループのリストを取得する

ユーザーがプロジェクトを転送できる転送先グループのリストを取得します。

GET /projects/:id/transfer_locations

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
search文字列いいえ検索するグループ名。

リクエストの例:

curl --url "https://gitlab.example.com/api/v4/projects/1/transfer_locations"

レスポンス例:

[
  {
    "id": 27,
    "web_url": "https://gitlab.example.com/groups/gitlab",
    "name": "GitLab",
    "avatar_url": null,
    "full_name": "GitLab",
    "full_path": "GitLab"
  },
  {
    "id": 31,
    "web_url": "https://gitlab.example.com/groups/foobar",
    "name": "FooBar",
    "avatar_url": null,
    "full_name": "FooBar",
    "full_path": "FooBar"
  }
]

プロジェクトアバターをアップロードする

指定されたプロジェクトにアバターをアップロードします。

PUT /projects/:id

サポートされている属性:

属性種類必須説明
avatar文字列はいアップロードするファイル。
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

ファイルシステムからアバターをアップロードするには、--form引数を使用します。これにより、cURLはヘッダーContent-Type: multipart/form-dataを使用してデータを送信します。file=パラメータは、ファイルシステムの画像ファイルを指しており、先頭に@を付ける必要があります。次に例を示します:

リクエストの例:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5" \
  --form "avatar=@dk.png"

レスポンス例:

{
  "avatar_url": "https://gitlab.example.com/uploads/-/system/project/avatar/2/dk.png"
}

プロジェクトアバターをダウンロードする

プロジェクトアバターをダウンロードします。プロジェクトが公開されている場合、このエンドポイントには認証なしでアクセスできます。

GET /projects/:id/avatar

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/4/avatar"

プロジェクトアバターを削除する

プロジェクトアバターを削除するには、avatar属性に空白の値を指定します。

リクエストの例:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
     --data "avatar=" "https://gitlab.example.com/api/v4/projects/5"

プロジェクトを共有する

プロジェクトをグループと共有します。

プロジェクトをグループと共有する

プロジェクトをグループと共有します。

POST /projects/:id/share

サポートされている属性:

属性種類必須説明
group_access整数はいグループに付与するロール(access_level
group_id整数はい共有するグループのID。
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
expires_at文字列いいえISO 8601形式での共有有効期限。例: 2016-09-26

グループからプロジェクトの共有を解除します。成功すると204が返されますが、コンテンツは返されません。

DELETE /projects/:id/share/:group_id

サポートされている属性:

属性種類必須説明
group_id整数はいグループのID。
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/share/17"

プロジェクトのハウスキーピングタスクを開始する

プロジェクトのハウスキーピングタスクを開始します。

POST /projects/:id/housekeeping

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
task文字列いいえ到達不能なオブジェクトの手動プルーニングをトリガーする場合はprune、積極的なハウスキーピングをトリガーする場合はeager

リアルタイムセキュリティスキャン

  • プラン: Ultimate
  • 提供形態: GitLab.com
  • ステータス: 実験的機能

リアルタイムで1つのファイルのSASTスキャン結果を返します。

POST /projects/:id/security_scans/sast/scan

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス

リクエストの例:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
 --header "Content-Type: application/json" \
 --data '{
  "file_path":"src/main.c",
  "content":"#include<string.h>\nint main(int argc, char **argv) {\n  char buff[128];\n  strcpy(buff, argv[1]);\n  return 0;\n}\n"
 }' \
 --url "https://gitlab.example.com/api/v4/projects/:id/security_scans/sast/scan"

レスポンス例:

{
  "vulnerabilities": [
    {
      "name": "Insecure string processing function (strcpy)",
      "description": "The `strcpy` family of functions do not provide the ability to limit or check buffer\nsizes before copying to a destination buffer. This can lead to buffer overflows. Consider\nusing more secure alternatives such as `strncpy` and provide the correct limit to the\ndestination buffer and ensure the string is null terminated.\n\nFor more information please see: https://linux.die.net/man/3/strncpy\n\nIf developing for C Runtime Library (CRT), more secure versions of these functions should be\nused, see:\nhttps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strncpy-s-strncpy-s-l-wcsncpy-s-wcsncpy-s-l-mbsncpy-s-mbsncpy-s-l?view=msvc-170\n",
      "severity": "High",
      "location": {
        "file": "src/main.c",
        "start_line": 5,
        "end_line": 5,
        "start_column": 3,
        "end_column": 23
      }
    }
  ]
}

Gitリポジトリのスナップショットをダウンロードする

このエンドポイントには、管理者のみがアクセスできます。

プロジェクト(またはリクエストされた場合はWiki)のGitリポジトリのスナップショットをダウンロードします。このスナップショットは、常に非圧縮のtar形式です。

リポジトリが破損してgit cloneが機能しない場合でも、スナップショットを使用すると、一部のデータを取得できる場合があります。

GET /projects/:id/snapshot

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
wikiブール値いいえプロジェクトリポジトリではなく、Wikiをダウンロードするかどうか。

リポジトリストレージへのパスを取得する

指定されたプロジェクトのリポジトリストレージへのパスを取得します。Gitaly Cluster(Praefect)を使用している場合は、代わりにPraefectによって生成されたレプリカパスを参照してください。

管理者のみが利用できます。

GET /projects/:id/storage

サポートされている属性:

属性種類必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
[
  {
    "project_id": 1,
    "disk_path": "@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b",
    "created_at": "2012-10-12T17:04:47Z",
    "repository_storage": "default"
  }
]

シークレットプッシュ保護のステータス

  • プラン: Ultimate

デベロッパー以上のロールが付与されている場合、次のリクエストはsecret_push_protection_enabled値も返す可能性があります。これらのリクエストの一部には、ロールに関するより厳格な要件があります。詳細については、前述のエンドポイントを参照してください。この情報を使用して、プロジェクトに対してシークレットプッシュ保護が有効になっているかどうかを判断します。secret_push_protection_enabledの値を変更するには、プロジェクトセキュリティ設定APIを使用してください。

  • GET /projects
  • GET /projects/:id
  • GET /users/:user_id/projects
  • GET /users/:user_id/contributed_projects
  • PUT /projects/:project_id/transfer?namespace=:namespace_id
  • PUT /projects/:id
  • POST /projects
  • POST /projects/user/:user_id
  • POST /projects/:id/archive
  • POST /projects/:id/unarchive

レスポンス例:

{
  "id": 1,
  "project_id": 3,
  "secret_push_protection_enabled": true,
  ...
}

トラブルシューティング

応答の予期しないrestrict_user_defined_variables

restrict_user_defined_variablesci_pipeline_variables_minimum_override_roleに競合する値を設定すると、pipeline_variables_minimum_override_role設定の方が優先順位が高いため、応答の値が予期される値と異なる場合があります。

たとえば、次のような場合が該当します:

  • restrict_user_defined_variablestrueci_pipeline_variables_minimum_override_roledeveloperに設定すると、応答はrestrict_user_defined_variables: falseを返します。ci_pipeline_variables_minimum_override_roledeveloperに設定すると、優先され、変数は制限されません。
  • restrict_user_defined_variablesfalseci_pipeline_variables_minimum_override_rolemaintainerに設定すると、応答はrestrict_user_defined_variables: trueを返します。ci_pipeline_variables_minimum_override_rolemaintainerに設定すると優先され、変数が制限されるためです。