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

# Get Prompt

> Get a single prompt with its content

## Request

<ParamField header="Authorization" type="string" required>
  Bearer token with your API key: `Bearer tr_your_api_key`
</ParamField>

<ParamField path="slug" type="string" required>
  The prompt slug
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier for the prompt
</ResponseField>

<ResponseField name="slug" type="string">
  URL-friendly identifier
</ResponseField>

<ResponseField name="name" type="string">
  Display name of the prompt
</ResponseField>

<ResponseField name="description" type="string | null">
  Description of the prompt
</ResponseField>

<ResponseField name="provider" type="string | null">
  Model provider: `OPENAI`, `ANTHROPIC`, `GOOGLE`, or `AMAZON_BEDROCK`
</ResponseField>

<ResponseField name="model" type="string | null">
  Default model for this prompt
</ResponseField>

<ResponseField name="temperature" type="number | null">
  Temperature setting for the model (0-2)
</ResponseField>

<ResponseField name="topP" type="number | null">
  Top-p (nucleus) sampling setting (0-1)
</ResponseField>

<ResponseField name="maxOutputTokens" type="number | null">
  Maximum output tokens limit
</ResponseField>

<ResponseField name="currentVersion" type="number">
  Current version number
</ResponseField>

<ResponseField name="content" type="array">
  Array of prompt messages

  <Expandable title="Message object">
    <ResponseField name="id" type="string">
      Unique identifier for the message
    </ResponseField>

    <ResponseField name="role" type="string">
      Message role: `system`, `user`, or `assistant`
    </ResponseField>

    <ResponseField name="content" type="string">
      Message content (may include `{{variables}}`)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="variables" type="string[]">
  List of template variables extracted from content
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of creation
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of last update
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://app.tracia.io/api/v1/prompts/welcome-email \
    -H "Authorization: Bearer tr_your_api_key"
  ```

  ```typescript SDK theme={null}
  const prompt = await tracia.prompts.get('welcome-email');
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "clx1abc123",
    "slug": "welcome-email",
    "name": "Welcome Email",
    "description": "A welcome email template",
    "provider": "OPENAI",
    "model": "gpt-4",
    "temperature": 0.7,
    "topP": null,
    "maxOutputTokens": null,
    "currentVersion": 3,
    "content": [
      {
        "id": "msg_1",
        "role": "system",
        "content": "You are a helpful assistant that writes professional emails."
      },
      {
        "id": "msg_2",
        "role": "user",
        "content": "Write a welcome email for {{name}} who just signed up for {{product}}."
      }
    ],
    "variables": ["name", "product"],
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-20T14:22:00.000Z"
  }
  ```

  ```json 404 theme={null}
  {
    "code": "NOT_FOUND",
    "message": "Prompt not found: welcome-email"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /prompts/{slug}
openapi: 3.1.0
info:
  title: Tracia API
  description: REST API for managing and running AI prompts with tracing
  version: 1.0.0
servers:
  - url: https://app.tracia.io/api/v1
    description: Production server
security:
  - bearerAuth: []
paths:
  /prompts/{slug}:
    get:
      tags:
        - Prompts
      summary: Get Prompt
      description: Get a single prompt with its content
      operationId: getPrompt
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: The prompt slug
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Prompt'
        '404':
          description: Prompt not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Prompt:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the prompt
        slug:
          type: string
          description: URL-friendly identifier
        name:
          type: string
          description: Display name of the prompt
        description:
          type: string
          nullable: true
          description: Description of the prompt
        provider:
          type: string
          nullable: true
          enum:
            - OPENAI
            - ANTHROPIC
            - GOOGLE
            - AMAZON_BEDROCK
          description: Model provider
        model:
          type: string
          nullable: true
          description: Default model for this prompt
        temperature:
          type: number
          nullable: true
          description: Temperature setting for the model (0-2)
        topP:
          type: number
          nullable: true
          description: Top-p (nucleus) sampling setting (0-1)
        maxOutputTokens:
          type: integer
          nullable: true
          description: Maximum output tokens limit
        currentVersion:
          type: integer
          description: Current version number
        content:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          description: Array of prompt messages
        variables:
          type: array
          items:
            type: string
          description: List of template variables extracted from content
        createdAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp of creation
        updatedAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp of last update
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
            message:
              type: string
              description: Error message
    Message:
      type: object
      required:
        - id
        - role
        - content
      properties:
        id:
          type: string
          description: Unique identifier for the message
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          description: Message role
        content:
          type: string
          description: Message content (may include `{{variables}}`)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key starting with `tr_`

````