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

# List rules in a library

> Process rules scoped to one knowledge library version.

Same shape as [List process rules](/api-reference/list-rules), but scoped to a single library version. Useful for reading a specific historical snapshot rather than the current active one.


## OpenAPI

````yaml openapi.yaml GET /v1/libraries/{id}/rules
openapi: 3.1.0
info:
  title: Seyn API
  version: 1.0.0
  description: >
    Programmatic access to Seyn for your organization.


    - **Ingest** data from any source with the Ingestion endpoints (requires a
    key with the `ingest` scope).

    - **Read** extracted process knowledge: search, rules, libraries,
    provenance, and metrics.


    Authenticate with a bearer API key (`sk_live_*`); each key is scoped to a
    single organization.
  contact:
    name: Seyn Support
    email: support@seynlabs.com
    url: https://seynlabs.com
servers:
  - url: https://api.seynlabs.com
    description: Production
  - url: https://api-dev.seynlabs.com
    description: Staging
security:
  - bearerAuth: []
tags:
  - name: Ingestion
    description: >-
      Push data into Seyn from any source: register a custom source and stream
      records to it
  - name: Knowledge
    description: Natural-language search over extracted knowledge
  - name: Rules
    description: Process rules, the atomic knowledge units extracted by the pipeline
  - name: Libraries
    description: Versioned snapshots of extracted knowledge for your organization
  - name: Patterns
    description: Aggregate pipeline analytics
paths:
  /v1/libraries/{id}/rules:
    get:
      tags:
        - Libraries
      summary: List rules in a library
      operationId: librariesRules
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: reviewStatus
          in: query
          schema:
            type: string
            enum:
              - inferred
              - confirmed
              - rejected
              - modified
          description: Filter by human-review status.
        - name: search
          in: query
          schema:
            type: string
          description: Substring match against rule description (case-insensitive).
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        '200':
          description: Rules scoped to the library.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessEnvelope_RuleSummaryList'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/LibraryNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    SuccessEnvelope_RuleSummaryList:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: array
          items:
            $ref: '#/components/schemas/RuleSummary'
        meta:
          allOf:
            - $ref: '#/components/schemas/Meta'
            - type: object
              properties:
                pagination:
                  $ref: '#/components/schemas/Pagination'
      required:
        - success
        - data
        - meta
    RuleSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        description:
          type: string
          description: >-
            Plain-English statement of the rule, produced by the extraction
            pipeline.
        processId:
          type:
            - string
            - 'null'
          description: ID of the process this rule belongs to, or null if process-wide.
        appliesAtStep:
          type:
            - string
            - 'null'
          description: Step within the parent process where this rule applies, or null.
        confidence:
          type: number
          format: float
          minimum: 0
          maximum: 1
          description: 0–1 heuristic confidence score from the LLM.
        frequency:
          type: number
          format: float
          minimum: 0
          maximum: 1
          description: 0–1 share of opportunities where the rule's conditions held.
        reviewStatus:
          type: string
          enum:
            - inferred
            - confirmed
            - rejected
            - modified
          description: >-
            Human-review state of the rule. See [Review
            Status](https://docs.seynlabs.com/concepts#review-status).
        createdAt:
          type:
            - string
            - 'null'
          format: date-time
          description: ISO-8601 timestamp; null if the row predates timestamping.
      required:
        - id
        - description
        - processId
        - appliesAtStep
        - confidence
        - frequency
        - reviewStatus
        - createdAt
    Meta:
      type: object
      properties:
        requestId:
          type: string
          description: Per-request UUID; quote in support tickets.
      additionalProperties: true
      required:
        - requestId
    Pagination:
      type: object
      properties:
        total:
          type: integer
          minimum: 0
        limit:
          type: integer
          minimum: 0
        offset:
          type: integer
          minimum: 0
      required:
        - total
        - limit
        - offset
    ErrorBody:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - MISSING_AUTH_HEADER
                - INVALID_API_KEY
                - KEY_REVOKED
                - RATE_LIMITED
                - NOT_FOUND
                - LIBRARY_NOT_FOUND
                - SOURCE_NOT_FOUND
                - VALIDATION_ERROR
                - INSUFFICIENT_SCOPE
                - PAYLOAD_TOO_LARGE
                - INTERNAL_ERROR
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
  responses:
    ValidationError:
      description: Request parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            validationError:
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Query parameter 'q' is required
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            missing:
              summary: No Authorization header
              value:
                success: false
                error:
                  code: MISSING_AUTH_HEADER
                  message: 'Authorization: Bearer <api-key> header is required'
            invalid:
              summary: Unrecognized key
              value:
                success: false
                error:
                  code: INVALID_API_KEY
                  message: API key is invalid or unrecognized
    Forbidden:
      description: API key was revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            revoked:
              value:
                success: false
                error:
                  code: KEY_REVOKED
                  message: API key has been revoked
    LibraryNotFound:
      description: Knowledge library not found in this organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            libraryNotFound:
              value:
                success: false
                error:
                  code: LIBRARY_NOT_FOUND
                  message: Knowledge library not found
    RateLimited:
      description: Per-key rate limit exceeded (default 60 req/min/key).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            rateLimited:
              value:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Rate limit exceeded for this API key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk_live_*
      description: |
        Bearer token from `app.seynlabs.com` → Settings → API Keys.
        Send as `Authorization: Bearer sk_live_...`.

````