Your company here — click to reach over 10,000 unique daily visitors

glab-api - Man Page

Make an authenticated request to GitLab API


glab api  [flags]


Makes an authenticated HTTP request to the GitLab API and prints the response. The endpoint argument should either be a path of a GitLab API v4 endpoint, or "graphql" to access the GitLab GraphQL API.

If the current directory is a Git directory, the GitLab authenticated host in the current directory will be used otherwise gitlab.com will be used. Override the GitLab hostname with '--hostname'.

Placeholder values :fullpath or :id, :user or :username, :group, :namespace, :repo, and :branch in the endpoint argument will get replaced with values from the repository of the current directory.

The default HTTP request method is "GET" normally and "POST" if any parameters were added. Override the method with '--method'.

Pass one or more '--raw-field' values in "key=value" format to add JSON-encoded string parameters to the POST body.

The '--field' flag behaves like '--raw-field' with magic type conversion based on the format of the value:

For GraphQL requests, all fields other than "query" and "operationName" are interpreted as GraphQL variables.

Raw request body may be passed from the outside via a file specified by '--input'. Pass "-" to read from standard input. In this mode, parameters specified via

In '--paginate' mode, all pages of results will sequentially be requested until there are no more pages of results. For GraphQL requests, this requires that the original query accepts an '$endCursor: String' variable and that it fetches the


-F, --field=[] Add a parameter of inferred type (changes default HTTP method to "POST")

-H, --header=[] Add an additional HTTP request header

--hostname="" The GitLab hostname for the request (default is "gitlab.com" or authenticated host in current git directory)

-i, --include[=false] Include HTTP response headers in the output

--input="" The file to use as body for the HTTP request

-X, --method="GET" The HTTP method for the request

--paginate[=false] Make additional HTTP requests to fetch all pages of results

-f, --raw-field=[] Add a string parameter

--silent[=false] Do not print the response body

Options Inherited from Parent Commands

--help[=false] Show help for command


$ glab api projects/:fullpath/releases

$ glab api projects/gitlab-com%2Fwww-gitlab-com/issues

$ glab api issues --paginate

$ glab api graphql -f query='
  query {
    project(fullPath: "gitlab-org/gitlab-docs") {
      statistics {
      boards {
        nodes {

$ glab api graphql --paginate -f query='
  query($endCursor: String) {
    project(fullPath: "gitlab-org/graphql-sandbox") {
      issues(first: 2, after: $endCursor) {
        edges {
          node {
        pageInfo {

See Also


Referenced By


May 2024 Auto generated by spf13/cobra