Orbit API

  • Tier: Premium, Ultimate
  • Offering: GitLab.com
  • Status: Experiment

The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use.

Use this API to run queries, retrieve schemas, and check cluster health for Orbit.

Create a query

Creates and executes a query against the Orbit gRPC service.

POST /api/v4/orbit/query

Supported attributes:

AttributeTypeRequiredDescription
queryobjectYesThe query DSL object.
query_typestringNoThe query language. Only json is supported. Default is json.
response_formatstringNoOne of raw or llm. Default is raw.

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

AttributeTypeDescription
resultarray or stringThe query results. An array when raw, a string when llm.
query_typestringThe query language, for example json.
raw_query_stringsstring arrayThe underlying queries that were run.
row_countintegerThe number of rows returned.

Examples

Retrieve a user by username:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": {
      "query_type": "search",
      "node": {"id": "u", "entity": "User", "filters": {"username": "john_smith"}}
    }
  }' \
  --url "https://gitlab.example.com/api/v4/orbit/query"

Example response:

{
  "result": [
    {
      "u_id": 1,
      "u_username": "john_smith",
      "u_name": "John Smith",
      "u_state": "active",
      "u_type": "User"
    }
  ],
  "query_type": "search",
  "row_count": 1
}

Find merged merge requests in a project:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": {
      "query_type": "traversal",
      "nodes": [
        {"id": "p", "entity": "Project", "node_ids": [8]},
        {"id": "mr", "entity": "MergeRequest", "filters": {"state": "merged"}}
      ],
      "relationships": [{"type": "IN_PROJECT", "from": "mr", "to": "p"}]
    }
  }' \
  --url "https://gitlab.example.com/api/v4/orbit/query"

Example response:

{
  "result": [
    {
      "p_name": "Diaspora Client",
      "p_full_path": "diaspora/diaspora-client",
      "mr_id": 43,
      "mr_iid": 1,
      "mr_title": "Resolve connection timeout on large payloads",
      "mr_state": "merged"
    },
    {
      "mr_id": 44,
      "mr_iid": 2,
      "mr_title": "Replace deprecated API calls in federation module",
      "mr_state": "merged"
    }
  ],
  "query_type": "traversal",
  "row_count": 2
}

Count merge requests per project:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": {
      "query_type": "aggregation",
      "nodes": [
        {"id": "p", "entity": "Project"},
        {"id": "mr", "entity": "MergeRequest"}
      ],
      "relationships": [{"type": "IN_PROJECT", "from": "mr", "to": "p"}],
      "aggregations": [{"function": "count", "target": "mr", "group_by": "p", "alias": "mr_count"}]
    }
  }' \
  --url "https://gitlab.example.com/api/v4/orbit/query"

Example response:

{
  "result": [
    {"p_name": "Diaspora Client", "p_full_path": "diaspora/diaspora-client", "mr_count": 8},
    {"p_name": "Puppet", "p_full_path": "brightbox/puppet", "mr_count": 6}
  ],
  "query_type": "aggregation",
  "row_count": 2
}

Find outgoing neighbors of a user:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": {
      "query_type": "neighbors",
      "node": {"id": "u", "entity": "User", "node_ids": [43]},
      "neighbors": {"node": "u"}
    }
  }' \
  --url "https://gitlab.example.com/api/v4/orbit/query"

Example response:

{
  "result": [
    {
      "_gkg_relationship_type": "MEMBER_OF",
      "_gkg_neighbor_type": "Project",
      "id": 5,
      "name": "Diaspora Client"
    },
    {
      "_gkg_relationship_type": "MEMBER_OF",
      "_gkg_neighbor_type": "Group",
      "id": 29,
      "name": "diaspora"
    },
    {
      "_gkg_relationship_type": "AUTHORED",
      "_gkg_neighbor_type": "MergeRequest",
      "id": 43,
      "title": "Resolve connection timeout on large payloads"
    }
  ],
  "query_type": "neighbors",
  "row_count": 3
}

Find the shortest path between two projects:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{
    "query": {
      "query_type": "path_finding",
      "nodes": [
        {"id": "p1", "entity": "Project", "node_ids": [8]},
        {"id": "p2", "entity": "Project", "node_ids": [5]}
      ],
      "path": {"type": "shortest", "from": "p1", "to": "p2", "max_depth": 3}
    }
  }' \
  --url "https://gitlab.example.com/api/v4/orbit/query"

Example response:

{
  "result": [
    {
      "depth": 2,
      "path": [
        {"id": 8, "entity_type": "Project", "name": "Diaspora Client", "full_path": "diaspora/diaspora-client"},
        {"id": 43, "entity_type": "User", "name": "John Smith", "username": "john_smith"},
        {"id": 5, "entity_type": "Project", "name": "Puppet", "full_path": "brightbox/puppet"}
      ],
      "edges": ["MEMBER_OF", "MEMBER_OF"]
    }
  ],
  "query_type": "path_finding",
  "row_count": 1
}

Execute a named query

Executes a server-defined named query. Prefer this endpoint over create a query for programmatic consumers: the query structure lives on the server, so it cannot drift from the DSL grammar or ontology.

POST /api/v4/orbit/query/:name

Supported attributes:

AttributeTypeRequiredDescription
namestringYesThe named query identifier, for example recent_merges.
parametersobjectNoValues for the placeholders the named query declares.
response_formatstringNoOne of raw or llm. Default is raw.

The request body must use Content-Type: application/json. Form encoding stringifies nested parameter values, which the per-query parameter schemas reject.

If successful, returns 200 OK with the same response attributes as create a query.

Example request:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{"parameters": {}}' \
  --url "https://gitlab.example.com/api/v4/orbit/query/my_neighbors"

List query templates

Lists the server-defined named queries with their query DSL rendered for the authenticated user.

For programmatic consumers, prefer executing named queries directly with parameters. Use the templates and their rendered raw_query from this endpoint only where displaying the query DSL text is the goal, such as populating a query editor or explorer with the text of a preset.

The rendered query DSL is not the same for every user:

  • Identity values, like the ID of the authenticated user, are resolved server-side from the request credentials. The same request returns different raw_query values for different users. Do not cache or share templates across users.
  • Placeholders for caller-supplied values, like the selected nodes in expand_neighbors, are filled with server-declared example values. Replace them with real values before you execute the query.
GET /api/v4/orbit/query/templates

If successful, returns 200 OK and an array of template objects with the following attributes:

AttributeTypeDescription
namestringThe name of the named query.
descriptionstringThe description of the named query.
raw_queryobjectThe query DSL rendered for the authenticated user.

Example request:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/orbit/query/templates"

Example response, where 43 is the ID of the authenticated user:

[
  {
    "name": "my_neighbors",
    "description": "Immediate graph neighborhood of the current user.",
    "raw_query": {
      "query_type": "neighbors",
      "node": {"id": "me", "entity": "User", "node_ids": [43]},
      "neighbors": {"node": "me", "direction": "both"},
      "limit": 100
    }
  },
  {
    "name": "recent_merges",
    "description": "Recently merged merge requests and the users who merged them.",
    "raw_query": {
      "query_type": "traversal",
      "nodes": [
        {"id": "u", "entity": "User", "columns": ["id", "username"]},
        {"id": "mr", "entity": "MergeRequest", "filters": {"state": "merged"}, "columns": ["id", "title", "merged_at"]}
      ],
      "relationships": [{"type": "MERGED", "from": "u", "to": "mr"}],
      "limit": 100
    }
  }
]

Retrieve the schema

Retrieves the Orbit schema.

GET /api/v4/orbit/schema

Supported attributes:

AttributeTypeRequiredDescription
expandstringNoComma-separated node names to expand.
response_formatstringNoOne of raw or llm. Default is raw.

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

AttributeTypeDescription
schema_versionstringThe version of the schema.
domainsobject arrayThe domain definitions.
nodesobject arrayThe node type definitions.
edgesobject arrayThe edge type definitions.

Example request:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/orbit/schema?expand=MergeRequest"

Example response:

{
  "schema_version": "0.1",
  "domains": [
    {"name": "ci", "description": "Entities related to CI/CD pipelines, stages, and jobs.", "node_names": ["Job", "Pipeline", "Stage"]},
    {"name": "code_review", "node_names": ["MergeRequest", "MergeRequestDiff", "MergeRequestDiffFile"]},
    {"name": "core", "node_names": ["Group", "Note", "Project", "User"]},
    {"name": "plan", "node_names": ["Label", "Milestone", "WorkItem"]},
    {"name": "security", "node_names": ["Finding", "SecurityScan", "Vulnerability"]},
    {"name": "source_code", "node_names": ["Branch", "Definition", "Directory", "File", "ImportedSymbol"]}
  ],
  "nodes": [],
  "edges": []
}

Retrieve access and cluster health

Returns whether the authenticated user can access the Knowledge Graph, along with the cluster health. Use this endpoint to decide whether to expose Orbit actions before you call them. It always returns 200 OK, regardless of access or service health.

GET /api/v4/orbit/status

Supported attributes:

AttributeTypeRequiredDescription
response_formatstringNoOne of raw or llm. Default is raw.

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

AttributeTypeDescription
userobjectThe requesting user’s access.
user.availablebooleanWhether the user can access the Knowledge Graph.
systemobjectThe cluster health, or null when the user has no access.
system.statusstringThe cluster health status, for example healthy or unknown.
system.timestampstringThe timestamp of the health check.
system.versionstringThe service version.
system.componentsarrayThe individual component statuses.

Example request:

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

Example response:

{
  "user": {
    "available": true
  },
  "system": {
    "status": "healthy",
    "timestamp": "2026-03-05T15:08:35.885160548+00:00",
    "version": "0.1.0",
    "components": [
      {"name": "gkg-indexer", "status": "healthy", "replicas": {"ready": 1, "desired": 1}, "metrics": {}},
      {"name": "gkg-webserver", "status": "healthy", "replicas": {"ready": 1, "desired": 1}, "metrics": {}},
      {"name": "clickhouse", "status": "healthy", "replicas": {"ready": 0, "desired": 0}, "metrics": {}}
    ]
  }
}

When the user has no access, system is null:

{
  "user": {
    "available": false
  },
  "system": null
}

List all tools

Lists all available Orbit operations.

GET /api/v4/orbit/tools

If successful, returns 200 OK and an array of tool objects with the following attributes:

AttributeTypeDescription
namestringThe name of the tool.
descriptionstringThe description of the tool.
parametersobjectThe parameter schema for the tool.

Example request:

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

Example response:

[
  {
    "name": "query_graph",
    "description": "Execute graph queries to find nodes, traverse relationships...",
    "parameters": {
      "type": "object",
      "required": ["query"],
      "properties": {"query": {"type": "object"}}
    }
  },
  {
    "name": "get_graph_schema",
    "description": "List the GitLab Knowledge Graph schema...",
    "parameters": {
      "type": "object",
      "properties": {"expand_nodes": {"type": "array"}}
    }
  }
]