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

# Get Prompt

> Retrieve a prompt and optionally personalize it with dynamic variables. Perfect for fetching the prompt you want to use right before sending it to your AI.

**Dynamic Variables:** Use handlebars-style placeholders like `{{userName}}` in your prompt, then pass query parameters to fill them in.

**Example:** Calling `/prompts/abc-123?userName=Alice&productName=Premium` will replace `{{userName}}` with "Alice" and `{{productName}}` with "Premium" in the returned prompt.



## OpenAPI

````yaml https://www.greenflash.ai/api/openapi get /prompts/{id}
openapi: 3.1.0
info:
  title: Greenflash API Reference
  version: 1.0.0
  description: >-
    Greenflash endpoints for capturing interactions, managing prompts, and
    identifying users.
servers:
  - url: https://www.greenflash.ai/api/v1
    description: Greenflash API v1
security: []
tags:
  - name: Interactions
    description: Capture interactions between users and AI
  - name: Business Events
    description: Capture business events
  - name: Analytics
    description: Understand chat and agentic interactions analyses
  - name: Inbox
    description: Review flagged conversations
  - name: Segments
    description: Manage user segments
  - name: Prompts
    description: Manage prompts
  - name: Chat
    description: Stream chat and agentic conversations
  - name: Models
    description: Manage AI models
  - name: Products
    description: Manage products
  - name: Users
    description: Manage users
  - name: Organizations
    description: Manage organizations
paths:
  /prompts/{id}:
    get:
      tags:
        - Prompts
      summary: Get Prompt
      description: >-
        Retrieve a prompt and optionally personalize it with dynamic variables.
        Perfect for fetching the prompt you want to use right before sending it
        to your AI.


        **Dynamic Variables:** Use handlebars-style placeholders like
        `{{userName}}` in your prompt, then pass query parameters to fill them
        in.


        **Example:** Calling
        `/prompts/abc-123?userName=Alice&productName=Premium` will replace
        `{{userName}}` with "Alice" and `{{productName}}` with "Premium" in the
        returned prompt.
      parameters:
        - schema:
            type: string
            description: >-
              The prompt identifier. Can be: internal prompt ID (UUID), or
              externalPromptId (your custom ID).
          required: true
          description: >-
            The prompt identifier. Can be: internal prompt ID (UUID), or
            externalPromptId (your custom ID).
          name: id
          in: path
      responses:
        '200':
          description: Prompt retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPromptResponse'
              example:
                composedPrompt: You are a helpful assistant for Premium. Greet Alice warmly.
                prompt:
                  id: 123e4567-e89b-12d3-a456-426614174000
                  externalPromptId: support-v1
                  name: Customer Support Prompt
                  description: Standard customer support  prompt
                  source: customer
                  productId: 123e4567-e89b-12d3-a456-426614174001
                  archivedAt: null
                  createdAt: '2025-10-01T12:00:00Z'
                  updatedAt: '2025-10-01T12:00:00Z'
                  components:
                    - id: 123e4567-e89b-12d3-a456-426614174002
                      type: system
                      source: customer
                      name: Base Instructions
                      content: >-
                        You are a helpful assistant for {{productName}}. Greet
                        {{userName}} warmly.
                      isDynamic: false
                      createdAt: '2025-10-01T12:00:00Z'
                      updatedAt: '2025-10-01T12:00:00Z'
        '404':
          description: Prompt not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for GetPrompt operations.
              example:
                success: false
                error: Prompt not found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for GetPrompt operations.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Greenflash from 'greenflash';

            const client = new Greenflash({
              apiKey: process.env['GREENFLASH_API_KEY'], // This is the default and can be omitted
            });

            const getPromptResponse = await client.prompts.get('id');

            console.log(getPromptResponse.composedPrompt);
        - lang: Python
          source: |-
            import os
            from greenflash import Greenflash

            client = Greenflash(
                api_key=os.environ.get("GREENFLASH_API_KEY"),  # This is the default and can be omitted
            )
            get_prompt_response = client.prompts.get(
                "id",
            )
            print(get_prompt_response.composed_prompt)
components:
  schemas:
    GetPromptResponse:
      type: object
      properties:
        composedPrompt:
          type: string
          description: The prompt with variables interpolated from query parameters.
        prompt:
          $ref: '#/components/schemas/Prompt'
      required:
        - composedPrompt
        - prompt
    Prompt:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The Greenflash prompt ID.
        externalPromptId:
          type: string
          description: Your external identifier for the prompt.
        name:
          type:
            - string
            - 'null'
          description: Prompt name.
        description:
          type:
            - string
            - 'null'
          description: Prompt description.
        source:
          type:
            - string
            - 'null'
          description: Prompt source.
        productId:
          type:
            - string
            - 'null'
          format: uuid
          description: The product ID this prompt is associated with.
        archivedAt:
          type:
            - string
            - 'null'
          description: ISO 8601 timestamp when archived, or null if active.
        createdAt:
          type: string
          description: ISO 8601 timestamp when created.
        updatedAt:
          type: string
          description: ISO 8601 timestamp when last updated.
        components:
          type: array
          items:
            $ref: '#/components/schemas/PromptComponent'
          description: Array of prompt components that make up this prompt.
      required:
        - id
        - name
        - description
        - source
        - productId
        - archivedAt
        - createdAt
        - updatedAt
        - components
      description: The full prompt object with components.
    PromptComponent:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The Greenflash component ID.
        externalComponentId:
          type: string
          description: Your external identifier for the component.
        type:
          type: string
          enum:
            - system
            - user
            - tool
            - guardrail
            - rag
            - agent
            - other
          default: system
          description: >-
            Component type: system, user, tool, guardrail, rag, agent, or a
            custom type (other).
        source:
          type: string
          description: Component source (e.g., customer, participant, greenflash).
        name:
          type:
            - string
            - 'null'
          description: Component name.
        content:
          type: string
          description: The content of the component.
        isDynamic:
          type:
            - boolean
            - 'null'
          description: Whether the component content changes dynamically.
        createdAt:
          type: string
          description: ISO 8601 timestamp when created.
        updatedAt:
          type: string
          description: ISO 8601 timestamp when last updated.
      required:
        - id
        - source
        - name
        - content
        - isDynamic
        - createdAt
        - updatedAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````