GitLab API

GitlabTool

Actions1095

Projects → headApiV4ProjectsIdRepositoryFilesFilePath

AI-generated

Summary

Check the existence of a file in a GitLab project repository by sending a HEAD request to the file endpoint.

Inputs

  • id (required) — Specify the project ID or URL-encoded path (e.g., 'gitlab-org/gitlab').
  • file_path (required) — Provide the URL-encoded path to the file in the repository (e.g., 'lib%2Fclass%2Erb').
  • ref (required) — Indicate the name of the branch, tag, or commit to reference.
  • skipAuthentication — Optionally skip authentication for the request.

Output shape

no body — success or failure status only from the HEAD HTTP request

The operation performs a HEAD HTTP method call, so the response contains no body but returns status codes indicating file existence. No pagination or data envelope applies.

Examples

Example 1: Verify if a file exists in the main branch of a GitLab project.

Set 'id' to the project identifier, 'file_path' to the file path URL-encoded, and 'ref' to 'main'. The operation returns HTTP status headers without response content.

Links

Discussion