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

# Get Tag

> Retrieves a tag's metadata and its associated snippets. API Cost: 1 + N requests (1 for tag + N for snippets).



## OpenAPI

````yaml GET /tag
openapi: 3.1.0
info:
  title: Snippets AI API
  description: >-
    A comprehensive API for managing snippets, folders, tags, and variations
    programmatically
  version: 1.0.0
  contact:
    name: Snippets AI Support
    email: team@getsnippets.ai
servers:
  - url: https://www.getsnippets.ai/api/prompts
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Snippets
    description: Operations for managing code snippets and text snippets
  - name: Variations
    description: Operations for managing snippet variations and version history
  - name: Folders
    description: Operations for organizing snippets into folders
  - name: Tags
    description: Operations for tagging and categorizing snippets
paths:
  /tag:
    get:
      tags:
        - Tags
      summary: Get a tag
      description: >-
        Retrieves a tag's metadata and its associated snippets. API Cost: 1 + N
        requests (1 for tag + N for snippets).
      operationId: getTag
      parameters:
        - name: tagId
          in: query
          required: true
          description: The ID of the tag
          schema:
            type: string
            format: uuid
        - name: limit
          in: query
          required: false
          description: 'Maximum number of snippets to return (1-100, default: 50)'
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          required: false
          description: 'Number of snippets to skip (default: 0)'
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        '200':
          description: Tag retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
components:
  schemas:
    TagResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            tag:
              type: object
            snippets:
              type: array
              items:
                type: object
        usage:
          $ref: '#/components/schemas/BatchUsageInfo'
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
    BatchUsageInfo:
      type: object
      properties:
        remainingRequests:
          type: integer
          description: Number of API requests remaining
        usageDeducted:
          type: integer
          description: Number of requests deducted for this operation
    PaginationInfo:
      type: object
      properties:
        limit:
          type: integer
        offset:
          type: integer
        totalSnippets:
          type: integer
        hasMore:
          type: boolean
        currentPage:
          type: integer
        totalPages:
          type: integer
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: Error message describing what went wrong
        error:
          type: string
          description: Additional error details
  responses:
    BadRequest:
      description: Bad request - Invalid parameters or malformed JSON
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            message: Snippet ID is required
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            message: Invalid or inactive API key
    Forbidden:
      description: Forbidden - Insufficient permissions or quota exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficient_quota:
              value:
                success: false
                message: >-
                  Insufficient API requests. This operation requires 5 requests
                  but you have 0 remaining.
                usage:
                  remainingRequests: 0
                  requiredRequests: 5
            no_access:
              value:
                success: false
                message: API key does not have access to this team
    NotFound:
      description: Not Found - Requested resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            message: Snippet not found
    RateLimitExceeded:
      description: Too Many Requests - Rate limit exceeded (20 requests per minute)
      headers:
        Retry-After:
          description: Number of seconds to wait before making another request
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            message: >-
              Rate limit exceeded. Too many requests from this API key. Try
              again in 120 seconds.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication using Bearer token. Include your API key in the
        Authorization header.

````