> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-platform/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo-platform/_mcp/server.

# List Span Groups

GET https://host.com/apis/intake/v2/workspaces/{workspace}/spans/groups

Reference: https://docs.nvidia.com/nemo-platform/nemo-platform/documentation/reference/api-reference/spans/list-span-groups-apis-intake-v-2-workspaces-workspace-spans-groups-get

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Nemo Platform API
  version: 1.0.0
paths:
  /apis/intake/v2/workspaces/{workspace}/spans/groups:
    get:
      operationId: list-span-groups-apis-intake-v-2-workspaces-workspace-spans-groups-get
      summary: List Span Groups
      tags:
        - subpackage_spans
      parameters:
        - name: workspace
          in: path
          required: true
          schema:
            type: string
        - name: by
          in: query
          description: >-
            Comma-separated span fields to group by, e.g. trace_id or
            session_id,trace_id.
          required: true
          schema:
            type: string
        - name: page
          in: query
          description: Page number.
          required: false
          schema:
            type: integer
            default: 1
        - name: page_size
          in: query
          description: Page size.
          required: false
          schema:
            type: integer
            default: 10
        - name: sort
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/SpanGroupSortField'
            default: '-span_count'
        - name: filter
          in: query
          description: >-
            Filter spans by the same fields as the span list endpoint, then
            group matching spans by the comma-separated fields in the by query
            parameter.
          required: false
          schema:
            $ref: '#/components/schemas/SpanFilter'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpanGroupsPage'
        '400':
          description: Invalid group-by parameter
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/List_span_groups_apis_intake_v2_workspaces__workspace__spans_groups_getRequestBadRequestError
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
servers:
  - url: https://host.com
    description: Default
components:
  schemas:
    SpanGroupSortField:
      type: string
      enum:
        - span_count
        - '-span_count'
      title: SpanGroupSortField
    SpanKind:
      type: string
      enum:
        - LLM
        - CHAIN
        - TOOL
        - RETRIEVER
        - EMBEDDING
        - AGENT
        - RERANKER
        - EVALUATOR
        - GUARDRAIL
        - UNKNOWN
      title: SpanKind
    SpanStatus:
      type: string
      enum:
        - success
        - error
        - cancelled
        - unknown
      title: SpanStatus
    DatetimeFilter:
      type: object
      properties:
        $gte:
          type: string
          format: date-time
          description: Filter for results greater than or equal to this datetime.
        $lte:
          type: string
          format: date-time
          description: Filter for results less than or equal to this datetime.
      title: DatetimeFilter
    SpanFilter:
      type: object
      properties:
        session_id:
          type: string
          description: Filter by span session id.
        trace_id:
          type: string
          description: Filter by canonical trace id.
        project:
          type: string
          description: Filter by project name.
        evaluation_id:
          type: string
          description: Filter by evaluation id.
        evaluation_sha:
          type: string
          description: Filter by evaluation sha.
        evaluation_run_id:
          type: string
          description: >-
            Filter by evaluation run id. ATIF evaluation context is stored on
            root trajectory spans; use session_id from a matched root to fetch
            the full trace tree.
        dataset_id:
          type: string
          description: Filter by dataset id.
        dataset_name:
          type: string
          description: Filter by dataset name.
        dataset_version:
          type: string
          description: Filter by dataset version.
        test_case_id:
          type: string
          description: Filter by dataset test case id.
        source:
          type: string
          description: Filter by ingest source (e.g. 'otel', 'atif', 'chat_completions').
        kind:
          $ref: '#/components/schemas/SpanKind'
          description: Filter by normalized span kind.
        status:
          $ref: '#/components/schemas/SpanStatus'
          description: Filter by normalized span status.
        model:
          type: string
          description: Filter by model name.
        tool_name:
          type: string
          description: Filter by tool name.
        provider:
          type: string
          description: Filter by provider (e.g. 'openai', 'nim', 'anthropic').
        agent_id:
          type: string
          description: Filter by agent identifier.
        agent_name:
          type: string
          description: Filter by agent application name (e.g. 'claude-code', 'codex').
        prompt_name:
          type: string
          description: Filter by prompt template name.
        prompt_version:
          type: string
          description: Filter by prompt template version.
        parent_span_id:
          type: string
          description: Filter by parent span id. Use to fetch direct children of a span.
        started_at:
          $ref: '#/components/schemas/DatetimeFilter'
          description: Filter by span start timestamp.
      title: SpanFilter
    SpanGroup:
      type: object
      properties:
        group:
          type: object
          additionalProperties:
            type: string
          description: Group key values, keyed by the requested group-by fields.
        span_count:
          type: integer
          description: Number of matching spans in this group.
      required:
        - group
        - span_count
      title: SpanGroup
    PaginationData:
      type: object
      properties:
        page:
          type: integer
          description: The current page number.
        page_size:
          type: integer
          description: The page size used for the query.
        current_page_size:
          type: integer
          description: The size for the current page.
        total_pages:
          type: integer
          description: The total number of pages.
        total_results:
          type: integer
          description: The total number of results.
      required:
        - page
        - page_size
        - current_page_size
        - total_pages
        - total_results
      title: PaginationData
    SpanGroupBy:
      type: string
      enum:
        - trace_id
        - session_id
      title: SpanGroupBy
    SpanGroupsPage:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/SpanGroup'
        pagination:
          $ref: '#/components/schemas/PaginationData'
          description: Pagination information.
        sort:
          type: string
          description: The field on which the results are sorted.
        filter:
          type: object
          additionalProperties:
            description: Any type
          description: Filtering information.
        grouped_by:
          type: array
          items:
            $ref: '#/components/schemas/SpanGroupBy'
          description: Span fields used to group the matching spans.
      required:
        - data
        - grouped_by
      title: SpanGroupsPage
    List_span_groups_apis_intake_v2_workspaces__workspace__spans_groups_getRequestBadRequestError:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
      title: >-
        List_span_groups_apis_intake_v2_workspaces__workspace__spans_groups_getRequestBadRequestError
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
        input:
          description: Any type
        ctx:
          type: object
          additionalProperties:
            description: Any type
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "data": [
    {
      "group": {
        "trace_id": "4f8b3a2c-9d7e-4f1a-bb3e-2a1c9d5e7f6a"
      },
      "span_count": 125
    },
    {
      "group": {
        "trace_id": "7a9d2e1b-3c4f-4d2a-8e5b-1f7c3a9d8b2e"
      },
      "span_count": 87
    }
  ],
  "grouped_by": [
    "trace_id"
  ],
  "pagination": {
    "page": 1,
    "page_size": 10,
    "current_page_size": 2,
    "total_pages": 5,
    "total_results": 45
  },
  "sort": "-span_count",
  "filter": {
    "project": "nemo-analytics",
    "status": "success",
    "kind": "LLM",
    "started_at": {
      "$gte": "2024-05-01T00:00:00Z",
      "$lte": "2024-05-31T23:59:59Z"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups"

querystring = {"by":"trace_id","page":"1","page_size":"10","sort":"-span_count","filter":"{\"project\":\"nemo-analytics\",\"status\":\"success\",\"kind\":\"LLM\",\"started_at\":{\"$gte\":\"2024-05-01T00:00:00Z\",\"$lte\":\"2024-05-31T23:59:59Z\"}}"}

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.get(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D';
const options = {method: 'GET', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D");
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/apis/intake/v2/workspaces/team-alpha/spans/groups?by=trace_id&page=1&page_size=10&sort=-span_count&filter=%7B%22project%22%3A%22nemo-analytics%22%2C%22status%22%3A%22success%22%2C%22kind%22%3A%22LLM%22%2C%22started_at%22%3A%7B%22%24gte%22%3A%222024-05-01T00%3A00%3A00Z%22%2C%22%24lte%22%3A%222024-05-31T23%3A59%3A59Z%22%7D%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```