> ## 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.

# Create a saved filter (TRU-216)

> Creates a team-shared saved filter. Dashboard-only. Requires
member+. The `filters` payload is opaque JSON owned by the
dashboard — the server only enforces it is a JSON object.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/saved-filters
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/saved-filters:
    post:
      tags:
        - saved-filters
      summary: Create a saved filter (TRU-216)
      description: |
        Creates a team-shared saved filter. Dashboard-only. Requires
        member+. The `filters` payload is opaque JSON owned by the
        dashboard — the server only enforces it is a JSON object.
      operationId: createSavedFilter
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSavedFilterRequest'
      responses:
        '201':
          description: Saved filter created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedFilter'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Caller lacks the required role (owner or member)
components:
  schemas:
    CreateSavedFilterRequest:
      type: object
      required:
        - project_id
        - name
        - filters
      properties:
        project_id:
          type: string
          format: uuid
        name:
          type: string
          maxLength: 100
        filters:
          type: object
          additionalProperties: true
    SavedFilter:
      type: object
      description: |
        A team-shared, tenant-scoped query preset for the traces list
        (TRU-216). `filters` is an opaque JSON object whose shape is
        owned by the dashboard.
      required:
        - id
        - created_at
        - updated_at
        - tenant_id
        - project_id
        - name
        - filters
        - created_by
      properties:
        id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        tenant_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        name:
          type: string
          maxLength: 100
        filters:
          type: object
          additionalProperties: true
          description: Opaque filter DSL object owned by the dashboard.
        created_by:
          type: string
          description: Clerk user ID of the author.
    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

````