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

# Get Snippet Usage

Get all prompts that use a given snippet (prompt template). Returns a list of prompts and their version numbers that reference this snippet, as well as any release labels that reference it. The identifier can be either the prompt name or the prompt id.


## OpenAPI

````yaml GET /prompt-templates/{identifier}/snippet-usage
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /prompt-templates/{identifier}/snippet-usage:
    get:
      tags:
        - prompt-templates
        - snippets
      summary: Get Snippet Usage
      operationId: get_snippet_usage
      parameters:
        - name: identifier
          in: path
          required: true
          schema:
            type: string
            title: identifier
            description: The identifier can be either the prompt name or the prompt id.
        - name: prompt_version_number
          in: query
          required: false
          schema:
            type: integer
            title: prompt_version_number
            description: Optional specific version number to check usage for
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSnippetUsageResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          description: Access denied - Invalid workspace_id
        '404':
          description: Prompt template not found
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    GetSnippetUsageResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        snippet_name:
          type: string
          description: The name of the snippet prompt template
        snippet_usage:
          type: array
          items:
            type: object
            properties:
              prompt_registry_id:
                type: integer
                description: The ID of the prompt that uses this snippet
              prompt_name:
                type: string
                description: The name of the prompt that uses this snippet
              version_numbers:
                type: array
                items:
                  type: integer
                description: List of version numbers that use this snippet
          description: List of prompts using this snippet
        total_prompts_using_snippet:
          type: integer
          description: Total number of prompts using this snippet
        label_usage:
          type: array
          items:
            type: object
            properties:
              prompt_registry_id:
                type: integer
                description: The ID of the prompt with a label using this snippet
              prompt_name:
                type: string
                description: The name of the prompt with a label using this snippet
              label_name:
                type: string
                description: The name of the label using this snippet
          description: List of labels using this snippet
        total_labels_using_snippet:
          type: integer
          description: Total number of labels using this snippet
      title: GetSnippetUsageResponse
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````