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

# Query email template rows

> Email template table rows. Default columns: name, subject, tags, type (Branded/Text) and created date. Opt-in via `columns`: n_attachments, n_bulk_sends (counted from the bulk send collection). Type is derived from whether the template carries branded sections, so it can be filtered but not sorted.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /library/email/_query
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /library/email/_query:
    post:
      tags:
        - library
      summary: Query email template rows
      description: >-
        Email template table rows. Default columns: name, subject, tags, type
        (Branded/Text) and created date. Opt-in via `columns`: n_attachments,
        n_bulk_sends (counted from the bulk send collection). Type is derived
        from whether the template carries branded sections, so it can be
        filtered but not sorted.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/pkg_routes_library_email_templates.QueryEmailsRequest
        description: Query email templates request
        required: true
      responses:
        '200':
          description: Email template rows
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/pkg_routes_library_email_templates.QueryEmailsResponse
        '400':
          description: Bad request - invalid request body
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_library_email_templates.QueryEmailsRequest:
      type: object
      properties:
        columns:
          description: Columns names the optional cells to add to the default response.
          type: array
          items:
            type: string
        filters:
          $ref: >-
            #/components/schemas/pkg_routes_library_email_templates.QueryEmailsFilters
        page:
          $ref: '#/components/schemas/types.ListPagination'
        sort:
          $ref: '#/components/schemas/types.ListSort'
    pkg_routes_library_email_templates.QueryEmailsResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_library_email_templates.EmailRow'
        total:
          type: integer
    pkg_routes_library_email_templates.QueryEmailsFilters:
      type: object
      properties:
        created:
          $ref: '#/components/schemas/types.ListFilterDate'
        data:
          type: array
          items:
            $ref: '#/components/schemas/types.ListFilterData'
        ids:
          type: array
          items:
            type: string
        search:
          type: string
        tags:
          type: array
          items:
            type: string
        type:
          description: >-
            Type narrows to "Branded" or "Text". Branded templates are the ones
            with

            stored sections; everything else is text.
          type: array
          items:
            type: string
    types.ListPagination:
      type: object
      properties:
        limit:
          type: integer
        skip:
          type: integer
    types.ListSort:
      type: object
      properties:
        field:
          type: string
        last: {}
        order:
          type: integer
    pkg_routes_library_email_templates.EmailRow:
      type: object
      properties:
        _id:
          type: string
        created_at:
          type: string
        n_attachments:
          description: The opt-in cells, null unless their column was requested.
          type: integer
        n_bulk_sends:
          type: integer
        name:
          type: string
        subject:
          type: string
        tags:
          type: array
          items:
            type: string
        type:
          description: >-
            Type is "Branded" for a template built from sections, "Text"
            otherwise.
          type: string
    types.ListFilterDate:
      type: object
      properties:
        after:
          type: string
        before:
          type: string
    types.ListFilterData:
      type: object
      properties:
        key:
          type: string
        op:
          type: string
        value: {}
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.