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

# List Codes

> Endpoint to list QEC codes with optional filtering and pagination.

Args:
    family: Filter by code family (e.g., "stabilizer", "subsystem", "bosonic").
    sub_family: Filter by code sub-family (e.g., "rotated_surface", "xzzx_surface").
    code_type: Filter by code type (e.g., "CSS", "non-CSS").
    completeness: Filter by completeness level ("full", "partial", "metadata_only").
    n: Filter by code distance n.
    d: Filter by code distance d (for non-CSS codes, d can be a dict with separate distances for X and Z errors).
    q: Search query to match against code name and slug (case-insensitive, prefix match).
    page: Page number for pagination (default: 1).
    page_size: Number of items per page for pagination (default: 20).

Returns:
    A paginated list of QEC codes matching the filters, along with the total count.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json get /codes
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.3.0
servers: []
security: []
paths:
  /codes:
    get:
      summary: List Codes
      description: |-
        Endpoint to list QEC codes with optional filtering and pagination.

        Args:
            family: Filter by code family (e.g., "stabilizer", "subsystem", "bosonic").
            sub_family: Filter by code sub-family (e.g., "rotated_surface", "xzzx_surface").
            code_type: Filter by code type (e.g., "CSS", "non-CSS").
            completeness: Filter by completeness level ("full", "partial", "metadata_only").
            n: Filter by code distance n.
            d: Filter by code distance d (for non-CSS codes, d can be a dict with separate distances for X and Z errors).
            q: Search query to match against code name and slug (case-insensitive, prefix match).
            page: Page number for pagination (default: 1).
            page_size: Number of items per page for pagination (default: 20).

        Returns:
            A paginated list of QEC codes matching the filters, along with the total count.
      operationId: list_codes_codes_get
      parameters:
        - name: family
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Family
        - name: sub_family
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Sub Family
        - name: code_type
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Code Type
        - name: completeness
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Completeness
        - name: 'n'
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  type: integer
              - type: 'null'
            title: 'N'
        - name: d
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  type: integer
              - type: 'null'
            title: D
        - name: q
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Q
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            title: Page
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            default: 20
            title: Page Size
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QECCodeListResponseModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    QECCodeListResponseModel:
      properties:
        items:
          items:
            $ref: '#/components/schemas/QECCodeModel'
          type: array
          title: Items
        total:
          type: integer
          title: Total
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
      type: object
      required:
        - items
        - total
        - page
        - page_size
      title: QECCodeListResponseModel
      description: Pydantic model for the QEC Code Library list API response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    QECCodeModel:
      properties:
        slug:
          type: string
          title: Slug
        name:
          type: string
          title: Name
        family:
          type: string
          title: Family
        sub_family:
          type: string
          title: Sub Family
          default: ''
        code_type:
          type: string
          title: Code Type
        'n':
          anyOf:
            - type: integer
            - type: 'null'
          title: 'N'
        k:
          anyOf:
            - type: integer
            - type: 'null'
          title: K
        d:
          anyOf:
            - type: integer
            - additionalProperties: true
              type: object
            - type: 'null'
          title: D
        completeness:
          type: string
          title: Completeness
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        stabilizers:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Stabilizers
        logical_operators:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Logical Operators
        layout_svg_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Layout Svg Url
        qecx_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Qecx Url
        references:
          anyOf:
            - items:
                $ref: '#/components/schemas/QECReferenceModel'
              type: array
            - type: 'null'
          title: References
      type: object
      required:
        - slug
        - name
        - family
        - code_type
        - completeness
      title: QECCodeModel
      description: Pydantic model for the QEC Code Library API responses.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    QECReferenceModel:
      properties:
        authors:
          items:
            type: string
          type: array
          title: Authors
        title:
          type: string
          title: Title
        year:
          type: integer
          title: Year
        doi:
          anyOf:
            - type: string
            - type: 'null'
          title: Doi
        annotation:
          anyOf:
            - type: string
            - type: 'null'
          title: Annotation
      type: object
      required:
        - authors
        - title
        - year
      title: QECReferenceModel
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````