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

# Customer-facing ingestion pipeline health (TRU-167)

> Returns ingest reliability signals (success/error rate, top error
categories, DLQ depth, ingest lag percentiles, last-span timestamp,
redaction match count) scoped to the authenticated tenant so
customers can self-diagnose pipeline issues.




## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/ingestion-health
openapi: 3.1.0
info:
  title: TruLayer API
  version: 0.1.0
  description: |
    Trace ingestion, evaluation, query, and feedback API for TruLayer AI.

    ### Authentication

    Two auth schemes coexist: SDK API keys (`Authorization: Bearer tl_...`)
    and Clerk session JWTs (dashboard). Routes marked "requires Clerk auth"
    in their summary are unreachable via API key.

    ### Roles (TRU-234)

    Dashboard requests carry one of three organization roles: `owner`,
    `member`, `viewer`. Endpoints enforce role allowlists, not rank
    comparisons. See `docs/security.md` for the full role-permission
    matrix.

    - **owner** — full control including billing, member management,
      destructive deletes on failure-rules/model-routes/webhooks/eval-rules,
      control-loop execution, and DLQ resolution.
    - **member** — read + write (ingest, feedback, evals, API keys,
      projects, failure-rules, model-routes, webhooks).
    - **viewer** — read-only dashboard access plus compliance read access
      to `/v1/audit-log` and `/v1/dlq`.
servers:
  - url: https://api.trulayer.ai
    description: Production
  - url: http://localhost:8080
    description: Local development
security:
  - BearerAuth: []
tags:
  - name: health
  - name: ingest
  - name: traces
  - name: metrics
  - name: feedback
  - name: evals
  - name: eval-rules
  - name: control
  - name: apikeys
  - name: model-routes
  - name: datasets
  - name: search
  - name: anomaly
  - name: webhooks
  - name: failure-rules
  - name: eval-runs
  - name: ci
  - name: otlp
  - name: billing
  - name: deprecations
  - name: audit
  - name: failures
  - name: projects
  - name: compliance
  - name: dsr
  - name: policies
  - name: members
paths:
  /v1/ingestion-health:
    get:
      tags:
        - metrics
      summary: Customer-facing ingestion pipeline health (TRU-167)
      description: |
        Returns ingest reliability signals (success/error rate, top error
        categories, DLQ depth, ingest lag percentiles, last-span timestamp,
        redaction match count) scoped to the authenticated tenant so
        customers can self-diagnose pipeline issues.
      operationId: getIngestionHealth
      parameters:
        - name: project_id
          in: query
          description: Filter to a single project. Omit for all projects in the tenant.
          schema:
            type: string
            format: uuid
        - name: window
          in: query
          description: |
            Rolling time window. Defaults to `24h`. Ignored when both `from`
            and `to` are supplied (TRU-393).
          schema:
            type: string
            enum:
              - 1h
              - 24h
              - 7d
            default: 24h
        - name: from
          in: query
          description: |
            Inclusive ISO-8601 / RFC 3339 lower bound on the report window.
            Must be supplied together with `to`. When both are present the
            explicit range overrides the `window` enum (TRU-393). Bucket
            granularity in the response scales with the requested span:
            ≤ 2h → `5m`, ≤ 48h → `1h`, > 48h → `1d`.
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          description: |
            Inclusive ISO-8601 / RFC 3339 upper bound on the report window.
            Must be supplied together with `from`. `to` must not precede
            `from`.
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Ingestion-health report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestionHealthResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    IngestionHealthResponse:
      type: object
      required:
        - window
        - from
        - to
        - bucket_interval
        - success_rate
        - error_rate
        - top_errors
        - dlq_depth
        - ingest_lag_ms
        - redaction_match_count
      properties:
        project_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            Echoes the `project_id` query param when set; omitted for
            tenant-wide reports.
        window:
          type: string
          enum:
            - 1h
            - 24h
            - 7d
          description: |
            Echoes the `window` query param. Informational only when an
            explicit `from`/`to` pair was supplied — the response's
            `from`/`to` fields are the source of truth for the time bounds
            actually used.
        from:
          type: string
          format: date-time
          description: Inclusive lower bound the report was computed over (TRU-393).
        to:
          type: string
          format: date-time
          description: Inclusive upper bound the report was computed over (TRU-393).
        bucket_interval:
          type: string
          enum:
            - 5m
            - 1h
            - 1d
          description: |
            Bucket granularity that scales with the report's requested
            range: ≤ 2h → `5m`, ≤ 48h → `1h`, > 48h → `1d` (TRU-393).
            Frontends that build time-series charts on top of this
            endpoint should consume this value rather than re-deriving it.
        success_rate:
          type: number
          description: >-
            Fraction 0–1 of traces without an error. 1.0 when no traffic in the
            window.
        error_rate:
          type: number
          description: Fraction 0–1 of traces with a non-empty error.
        top_errors:
          type: array
          items:
            $ref: '#/components/schemas/IngestionHealthTopError'
        dlq_depth:
          $ref: '#/components/schemas/IngestionHealthDLQDepth'
        ingest_lag_ms:
          $ref: '#/components/schemas/IngestionHealthLag'
        last_successful_span_at:
          type: string
          format: date-time
          nullable: true
        redaction_match_count:
          type: integer
          format: int64
          description: Zero until redaction instrumentation lands.
    IngestionHealthTopError:
      type: object
      required:
        - category
        - count
      properties:
        category:
          type: string
          description: Coarse error category (first 64 chars of the error text)
        count:
          type: integer
          format: int64
    IngestionHealthDLQDepth:
      type: object
      required:
        - traces
        - evals
      properties:
        traces:
          type: integer
          format: int64
        evals:
          type: integer
          format: int64
    IngestionHealthLag:
      type: object
      required:
        - p50
        - p95
        - p99
      properties:
        p50:
          type: integer
          format: int64
        p95:
          type: integer
          format: int64
        p99:
          type: integer
          format: int64
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: SDK API key (`tl_...`) or Clerk session JWT

````