GLQL API

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Use this API to execute GitLab Query Language (GLQL) queries programmatically. GLQL provides a simplified query language for searching and filtering GitLab resources such as issues, merge requests, and epics across projects and groups.

Prerequisites:

  • The group or project must allow access to its data.
  • For private groups and projects, you must use a personal access token with appropriate permissions.

Execute a GLQL query

Executes a GLQL query to search and filter GitLab resources.

POST /glql

This endpoint rate-limits queries based on the query SHA. Identical queries that time out are tracked and might be temporarily blocked if executed too frequently.

Supported attributes:

AttributeTypeRequiredDescription
glql_yamlstringYesThe GLQL query with optional YAML configuration. Maximum size: 10,000 bytes (10 KB). See Query formats for details.
afterstringNoCursor for pagination. Use the data.pageInfo.endCursor value from a previous query to fetch the next page of results.

Query formats

The glql_yaml parameter accepts the YAML format with a query key:

yaml
fields: id,title,author
group: my-group
limit: 10
sort: created desc
query: state = opened

Configuration options

The following configuration options can be included in the YAML:

OptionTypeRequiredDescription
fieldsstringNoComma-separated list of fields to return. Default: title. See available fields.
groupstringNoScope the query to a specific group. Cannot be used with project. If group is also specified in the query, the query value takes precedence.
limitintegerNoMaximum number of results to return. Must be between 1 and 100. Default: 100.
projectstringNoScope the query to a specific project. Format: group/project. If project is also specified in the query, the query value takes precedence.
sortstringNoSort order for results. Format: field direction (for example, created asc or created desc).

Available fields

Set the fields configuration option to a comma-separated list of the available GLQL fields.

GLQL query syntax

The query syntax is defined by GLQL.

Response attributes

If successful, returns 200 OK and the following response attributes:

AttributeTypeDescription
dataobjectContains the query results.
data.countintegerTotal number of matching results.
data.nodesarrayArray of matching resources with requested fields.
data.pageInfoobjectPagination information.
data.pageInfo.endCursorstringCursor for fetching the next page of results.
data.pageInfo.hasNextPagebooleanIndicates if more results are available.
data.pageInfo.hasPreviousPagebooleanIndicates if previous results are available.
data.pageInfo.startCursorstringCursor for fetching the previous page of results.
errorstringError message if the query failed.
fieldsarrayArray of field definitions.
fields[].fieldstringThe base field name. For aliased parameterized fields, this is the underlying field name (for example, durationQuantile), while key is the alias (for example, p50). For standard fields, same as key.
fields[].keystringThe unique field identifier.
fields[].labelstringThe human-readable field name.
fields[].namestringThe common field name that unifies similar fields. For example, created and createdAt keys have the name createdAt. For aliased parameterized fields, this is the generated response key (for example, durationQuantile_quantile_0_d5), not a common name.
fields[].parametersobjectResolved parameter metadata for parameterized fields. Absent when the field has no parameters. Values are strings, or arrays of strings for list parameters. For example, {"granularity": "weekly"}, {"quantile": "0.5"}, or {"thresholds": ["4", "25", "100"]}.
fields[].typestringField classification: dimension or metric for analytics mode fields. Absent for standard fields.
successbooleanIndicates if the query was successful.