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

# Create an auto-tagging rule for the authenticated user

> Creates an auto-tagging rule. Provide `tag_id` or at least one `add_tag_ids` value.



## OpenAPI

````yaml /api-reference/openapi.json post /create-auto-tagging-rule
openapi: 3.1.0
info:
  title: Memex REST API
  description: Memex REST API endpoints.
  version: '2026-03-10'
servers:
  - url: https://memex.garden/api
    description: Public edge router
  - url: https://rubctkzqxcdgkbbcprnu.supabase.co/functions/v1
    description: Direct Supabase Edge Functions
security:
  - bearerAuth: []
paths:
  /create-auto-tagging-rule:
    post:
      summary: Create an auto-tagging rule for the authenticated user
      description: >-
        Creates an auto-tagging rule. Provide `tag_id` or at least one
        `add_tag_ids` value.
      operationId: createAutoTaggingRule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAutoTaggingRuleRequest'
            examples:
              basic:
                summary: Create a disabled library rule
                value:
                  data:
                    tag_id: 00000000-0000-0000-0000-000000000000
                    enabled: false
                    source_library: true
                    text_queries:
                      - vector databases
                    ai_prompt: Content about vector databases
      responses:
        '200':
          description: Auto-tagging rule creation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAutoTaggingRuleResponse'
        '401':
          description: Authentication required or invalid bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '500':
          description: Unexpected server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    CreateAutoTaggingRuleRequest:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
            tag_id:
              type: string
              format: uuid
              description: Primary tag ID. Required when add_tag_ids is omitted.
            add_tag_ids:
              type: array
              items:
                type: string
                format: uuid
              description: >-
                Tag IDs to apply. At least one tag_id or add_tag_ids value is
                required.
            enabled:
              type: boolean
              default: false
            source_library:
              type: boolean
              description: Whether to run against library content.
            source_all_feeds:
              type: boolean
              default: false
            text_queries:
              type: array
              items:
                type: string
            ai_prompt:
              type:
                - string
                - 'null'
            content_types:
              type: array
              items:
                $ref: '#/components/schemas/ContentEntityType'
            feed_ids:
              type: array
              items:
                type: string
            condition_expression:
              oneOf:
                - $ref: '#/components/schemas/AutoTaggingConditionExpression'
                - type: 'null'
          additionalProperties: false
      additionalProperties: false
    CreateAutoTaggingRuleResponse:
      type: object
      required:
        - ruleId
      properties:
        ruleId:
          type: string
          format: uuid
      additionalProperties: false
    UnauthorizedError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Unauthorized
      additionalProperties: true
    InternalServerError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
      additionalProperties: true
    ContentEntityType:
      type: string
      enum:
        - web
        - pdf
        - youtube
        - twitter
        - instagram
        - tiktok
        - facebook
        - linkedin
        - pinterest
        - reddit
        - chatgpt
        - claude
        - annotation
        - image
        - transcribedMedia
        - audioRecording
        - selector
        - chatThread
        - twitterProfile
        - subreddit
        - youtubeChannel
      description: Exact persisted `content_entity.type` value.
    AutoTaggingConditionExpression:
      type: object
      description: >-
        Auto-tagging condition expression tree. Supported node types include
        contentType, tag, keyword, aiPrompt, group, and not.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - contentType
            - tag
            - keyword
            - aiPrompt
            - group
            - not
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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