> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get span field coverage

> Given a filter over spans, return the union of span attribute keys and evaluator outputs that appear in the matching spans, along with a coverage count for each field.

Useful for schema discovery and data completeness analysis — e.g. before adding spans to an evaluation dataset, an agent or UI can call this endpoint to understand which attributes are present and how consistently they appear across the selected spans, without fetching full span payloads.

The query is bounded internally to the first 10,000 matching spans. When this cap is reached, `sampled` is set to `true` and counts are approximate.



## OpenAPI

````yaml POST /v3/spans/fields
openapi: 3.0.3
info:
  title: Fiddler API - 2.0
  description: APIs to interact with Fiddler
  termsOfService: https://fiddler.ai/about/terms
  contact:
    email: support@fiddler.ai
  license:
    name: Proprietary
    url: '2.0'
  version: '2.0'
servers: []
security:
  - BearerAuth: []
tags:
  - name: access-key
    description: CRUD operations for API keys
  - name: span-v3
  - name: aggregation-invalidation-request-v3
    description: Endpoints related to retrieving aggregation invalidation requests
  - name: alert-rules-v3
    description: CRUD for Alert Rules, Summary, and Stats APIs
  - name: application-v3
  - name: attribute-v3
  - name: auth
    description: Authentication strategies and login flows
  - name: baseline-v3
    description: CRUD for baseline
  - name: catalog-v3
    description: >-
      Entity catalog provides paginated, searchable discovery of entity names
      (attribute keys, agent names, span types, span names) and their distinct
      values. Powered by ClickHouse materialized views — no worker or PostgreSQL
      dependency.
  - name: chart-annotation-v3
    description: Endpoints related to retrieving chart annotations
  - name: chart-v3
    description: CRUD for chart
  - name: queries-v3
    description: v3 queries API
  - name: configuration-v3
    description: CRUD for configurations
  - name: custom-metrics-v3
  - name: dimensionality-reduction-v3
  - name: environment-v3
    description: Endpoints related to environment management
  - name: evals
  - name: datasets
  - name: evaluation-v3
  - name: evaluator-v3
  - name: rule-evaluators-v3
  - name: experiment-v3
  - name: explainability-v3
  - name: llm_rca-v3
  - name: file-upload
    description: Endpoints related to file uploading.
  - name: fql-expressions-v3
    description: >
      Endpoints for listing FQL (Fiddler Query Language) functions available for
      GenAI custom metrics. Used by the frontend for autocomplete and signature
      hints in the FQL editor.
  - name: genai-alert-rules-v3
    description: CRUD API for GenAI Alert Rules
  - name: genai-custom-metrics-v3
    description: API for GenAI Custom Metrics
  - name: genai-metrics-v3
    description: >-
      Endpoints for pre-aggregated GenAI metrics. All metric data is
      pre-aggregated by an hourly ClickHouse refreshable materialized view; no
      real-time aggregation is performed at request time.
  - name: guardrails-api
    description: Endpoints related to retrieving Guardrails specific data
  - name: ingestion-v3
  - name: intercom-api
    description: Endpoints related to intercom APIs
  - name: jobs-v3
  - name: llm-gateway-v3
  - name: auth-login
  - name: auth-logout
  - name: metrics-v3
    description: Metrics endpoints
  - name: model-v3
  - name: dashboard-v3
  - name: model-deployment-v3
  - name: monitoring-summary-v3
  - name: histograms-v3
  - name: organization-roles-v3
    description: Update user org role
  - name: organization-settings-v3
    description: Update organization settings such as timezone, email configuration, etc.
  - name: pagerduty-api
    description: CRUD for Pagerduty services.
  - name: project-v3
  - name: project-roles-v3
    description: Project role assignment management
  - name: searchable-text-key-v3
    description: >-
      Manage the global searchable text keys table that controls which OTel
      attribute keys are routed to the full-text-searchable `ValueContent`
      column in the unified attributes table. Changes propagate to the backing
      ClickHouse dictionary within 1-2 minutes and affect all tenants.
  - name: segments-v3
  - name: semantic-mapping-v3
    description: >-
      Manage the global semantic name mappings table that maps raw OTel
      attribute keys to canonical semantic concepts. Changes propagate to the
      backing ClickHouse dictionary within 1-2 minutes and affect all tenants.
  - name: server-info-v3
    description: Endpoints related to retrieving server information
  - name: sessions-v3
    description: v3 session APIs
  - name: team-roles-v3
  - name: team-v3
  - name: traces-v3
    description: v3 trace api for monitoring
  - name: fetch-sessions-v3
    description: v3 fetch sessions api for monitoring
  - name: user-access-key
    description: >
      CRUD operations for user API keys. All endpoints are user-scoped — each
      user can only operate on their own API keys. No one including Org admins
      have access to other users' API keys.
  - name: users-v3
  - name: version-compatibility-v3
  - name: webhooks
externalDocs:
  url: https://docs.fiddler.ai
  description: Find out more about Fiddler
paths:
  /v3/spans/fields:
    post:
      tags:
        - span-v3
      summary: Get span field coverage
      description: >-
        Given a filter over spans, return the union of span attribute keys and
        evaluator outputs that appear in the matching spans, along with a
        coverage count for each field.


        Useful for schema discovery and data completeness analysis — e.g. before
        adding spans to an evaluation dataset, an agent or UI can call this
        endpoint to understand which attributes are present and how consistently
        they appear across the selected spans, without fetching full span
        payloads.


        The query is bounded internally to the first 10,000 matching spans. When
        this cap is reached, `sampled` is set to `true` and counts are
        approximate.
      operationId: getSpanFieldsV3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpanFieldsRequest'
            example:
              application_id: c688de46-2054-49ab-b85f-0f0178cb44d7
              start_time: '2026-05-01T00:00:00Z'
              end_time: '2026-05-18T23:59:59Z'
              filter:
                condition: AND
                rules:
                  - field: Span::span_type
                    operator: eq
                    value: llm
      responses:
        '200':
          description: Span field coverage for the matching spans
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SpanFieldsResponse'
              example:
                data:
                  total_spans: 10000
                  sampled: true
                  span_attributes:
                    - key: system.gen_ai.usage.input_tokens
                      count: 10000
                    - key: system.gen_ai.usage.output_tokens
                      count: 10000
                    - key: system.gen_ai.context.retrieval
                      count: 5
                  evaluator_outputs:
                    - rule_name: Safety
                      output_name: is_toxic
                      count: 10000
                    - rule_name: Faithfulness
                      output_name: score
                      count: 3200
                api_version: '3.0'
                kind: NORMAL
        '400':
          $ref: '#/components/responses/400'
        '500':
          $ref: '#/components/responses/500'
components:
  schemas:
    SpanFieldsRequest:
      type: object
      required:
        - application_id
        - start_time
        - end_time
      properties:
        application_id:
          type: string
          format: uuid
          description: UUID of the GenAI application to query spans from
        start_time:
          type: string
          format: date-time
          description: Start of the time range (inclusive, UTC).
        end_time:
          type: string
          format: date-time
          description: End of the time range (exclusive, UTC).
        filter:
          description: >-
            Optional structured filter tree. Uses the same DSL as POST
            /spans/query. Maximum nesting depth is 3 levels and maximum total
            rule count is 10.
          allOf:
            - $ref: '#/components/schemas/QueryCondition'
        search:
          $ref: '#/components/schemas/SearchFilter'
    ApiResponse:
      type: object
      description: |
        Response object for standard API responses.
      properties:
        api_version:
          type: string
          default: '3.0'
          enum:
            - '2.0'
            - '3.0'
          description: |
            API version.
        kind:
          type: string
          default: NORMAL
          enum:
            - NORMAL
          description: |
            Type of response, indicating a normal response.
    SpanFieldsResponse:
      type: object
      required:
        - total_spans
        - sampled
        - span_attributes
        - evaluator_outputs
      properties:
        total_spans:
          type: integer
          description: >-
            Number of spans used to compute coverage. Capped at 10,000. When
            sampled is true this is 10,000 and counts are approximate; when
            sampled is false this is the exact number of matching spans.
        sampled:
          type: boolean
          description: >-
            True when the result is based on a 10,000-span sample of a larger
            result set. Counts are approximate in this case.
        span_attributes:
          type: array
          items:
            $ref: '#/components/schemas/SpanAttributeCoverage'
          description: >-
            Span attribute keys found across the sampled spans, each with a
            coverage count.
        evaluator_outputs:
          type: array
          items:
            $ref: '#/components/schemas/EvaluatorOutputCoverage'
          description: >-
            Evaluator rule/output pairs found across the sampled spans, each
            with a coverage count.
    QueryCondition:
      type: object
      description: Recursive filter condition supporting AND/OR nesting with rules
      required:
        - condition
        - rules
      properties:
        condition:
          $ref: '#/components/schemas/QueryConditionType'
        rules:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/QueryCondition'
              - $ref: '#/components/schemas/QueryRule'
    SearchFilter:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          description: Free-form search text. Case-insensitive substring match.
          minLength: 3
          maxLength: 64
        scope:
          $ref: '#/components/schemas/SearchScope'
    SpanAttributeCoverage:
      type: object
      required:
        - key
        - count
      properties:
        key:
          type: string
          description: Span attribute key (e.g. "system.gen_ai.usage.input_tokens")
        count:
          type: integer
          description: >-
            Number of spans (within the sample) that have this attribute key.
            Divide by total_spans to get the coverage ratio.
    EvaluatorOutputCoverage:
      type: object
      required:
        - rule_name
        - output_name
        - count
      properties:
        rule_name:
          type: string
          description: Name of the evaluator rule
        output_name:
          type: string
          description: Name of the specific output within the rule
        count:
          type: integer
          description: >-
            Number of spans (within the sample) that have a score for this
            evaluator output.
    ErrorResponse:
      type: object
      description: |
        Response object for errors returned by the API.
      properties:
        api_version:
          type: string
          default: '3.0'
          enum:
            - '2.0'
            - '3.0'
          description: |
            API version of the response.
        kind:
          type: string
          default: ERROR
          enum:
            - ERROR
          description: |
            Type of response, usually indicating an error.
        error:
          type: object
          properties:
            code:
              type: integer
              format: int32
              description: >
                Represents the code for this error, typically an HTTP response
                code.
              default: 400
              enum:
                - 400
                - 403
                - 404
                - 500
            message:
              type: string
              description: >
                A human-readable message providing more details about the error.
                If there are multiple errors, it will be the message for the
                first error.
              example: Resource Not Found
            errors:
              type: array
              description: >
                Container for additional information regarding the error,
                especially for multiple errors.
              items:
                type: object
                properties:
                  reason:
                    type: string
                    description: >
                      Unique identifier for this error, different from the error
                      code.
                    example: ResourceNotFoundException
                  message:
                    type: string
                    description: >
                      A human-readable message providing more details about the
                      error. If there is only one error, this field will match
                      error.message.
                    example: Resource Not Found
                  help:
                    type: string
                    description: >
                      Link to support or documentation providing more
                      information on the error.
    QueryConditionType:
      type: string
      description: Condition type to apply for filters
      enum:
        - AND
        - OR
    QueryRule:
      type: object
      description: Rule to apply for filters
      required:
        - field
        - operator
        - value
      properties:
        field:
          type: string
          description: Name of the field to apply the filter on
        operator:
          $ref: '#/components/schemas/OperatorType'
        value:
          description: value of the filter
          anyOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items:
                type: string
    SearchScope:
      type: string
      enum:
        - all
        - input
        - output
    OperatorType:
      type: string
      description: Type of operator
      enum:
        - EQUAL
        - NOT_EQUAL
        - IN
        - NOT_IN
        - LESS
        - LESS_OR_EQUAL
        - GREATER
        - GREATER_OR_EQUAL
        - BETWEEN
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````