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

# Prompt Versions

> Version, test, and rollback prompts safely

Every time you save a prompt, Endprompt creates a new version. This gives you complete history, easy rollbacks, and safe iteration.

## How Versioning Works

```mermaid theme={null}
timeline
    title Prompt Version History
    v1 : Initial prompt : Draft
    v2 : Added examples : Draft
    v3 : Fixed JSON format : Live (Default)
    v4 : Testing new model : Draft
```

* Each save creates an immutable version
* Versions are numbered sequentially (v1, v2, v3...)
* Only **Live** prompts can be set as the endpoint default
* You can view, compare, and restore any version

## Version Properties

| Property           | Description                           |
| ------------------ | ------------------------------------- |
| **Version Number** | Sequential identifier (v1, v2, v3...) |
| **Created At**     | Timestamp of creation                 |
| **Status**         | Draft, Live, or Archived              |
| **Template**       | The prompt text at that version       |
| **Model**          | LLM model used                        |
| **Settings**       | Temperature, max tokens, etc.         |

## Viewing Version History

<Steps>
  <Step title="Open the Prompt">
    Navigate to your endpoint's Prompts tab and click on the prompt.
  </Step>

  <Step title="Open Version History">
    Click the **History** or **Versions** button in the prompt editor.
  </Step>

  <Step title="Browse Versions">
    See all versions with timestamps and status indicators.
  </Step>

  <Step title="View Details">
    Click any version to see its full configuration.
  </Step>
</Steps>

## Comparing Versions

Compare two versions side-by-side:

1. Open version history
2. Select two versions to compare
3. View a diff showing what changed

This helps you understand:

* What changed between versions
* Why a prompt started behaving differently
* What to restore if something breaks

## Status Workflow

### Draft → Live

Promote a prompt when it's ready for production:

<Steps>
  <Step title="Test Thoroughly">
    Ensure the prompt works correctly with various inputs.
  </Step>

  <Step title="Open Actions Menu">
    Click the **⋯** menu on the prompt.
  </Step>

  <Step title="Select Promote to Live">
    Click **Promote to Live**.
  </Step>

  <Step title="Confirm">
    The prompt is now Live and can be set as default.
  </Step>
</Steps>

### Live → Default

Set a Live prompt as the endpoint's default:

1. Ensure the prompt has **Live** status
2. Click **Set as Default** in the actions menu
3. All requests to the endpoint now use this prompt

<Note>
  Only one prompt can be the default at a time. Setting a new default replaces the previous one.
</Note>

### Demote to Draft

If a Live prompt needs more work:

1. Click **⋯** → **Demote to Draft**
2. The prompt returns to Draft status
3. If it was the default, you'll need to set a new default

### Archive

Remove a prompt from active use:

1. Click **⋯** → **Archive**
2. The prompt is hidden from lists
3. History is preserved for reference

<Tip>
  Archive old prompts instead of deleting them. You might need to reference or restore them later.
</Tip>

## Rollback Scenarios

### Something Broke in Production

```mermaid theme={null}
flowchart LR
    A[v3 Live/Default] --> B[v4 Live/Default]
    B --> C[Bug Discovered!]
    C --> D[Rollback to v3]
    D --> E[v3 Live/Default Again]
```

<Steps>
  <Step title="Identify the Issue">
    Check logs to see when problems started.
  </Step>

  <Step title="Open Version History">
    Find the last working version.
  </Step>

  <Step title="Restore">
    Click **Restore this version** to create a new version with that content.
  </Step>

  <Step title="Promote and Set Default">
    Promote the restored version and set it as default.
  </Step>
</Steps>

### A/B Testing Results

After testing two prompts:

1. Review metrics (latency, success rate, user feedback)
2. Promote the winning prompt to Live
3. Set it as default
4. Archive the losing prompt

## Version Best Practices

<AccordionGroup>
  <Accordion title="Write meaningful changes" icon="comment">
    Make each version a meaningful improvement. Avoid saving trivial changes.
  </Accordion>

  <Accordion title="Test before promoting" icon="flask">
    Always test Draft prompts thoroughly before promoting to Live.
  </Accordion>

  <Accordion title="Keep one Live prompt as default" icon="star">
    Your endpoint should always have a reliable default prompt.
  </Accordion>

  <Accordion title="Use Draft for experiments" icon="vial">
    Try new models, approaches, or major changes in Draft status.
  </Accordion>

  <Accordion title="Document big changes" icon="file-lines">
    Use the prompt name or description to note significant changes.
  </Accordion>
</AccordionGroup>

## Calling Specific Versions

While your endpoint uses the default prompt by default, you can call specific prompts:

```bash theme={null}
# Use default prompt
curl -X POST https://yourcompany.api.endprompt.ai/api/v1/summarize

# Use specific prompt by name
curl -X POST "https://yourcompany.api.endprompt.ai/api/v1/summarize?prompt=detailed-summary"
```

<Warning>
  Only **Live** prompts can be called directly. Draft prompts can only be tested through the UI.
</Warning>

## Version Limits

| Plan       | Version History  |
| ---------- | ---------------- |
| Free       | Last 10 versions |
| Pro        | Last 50 versions |
| Enterprise | Unlimited        |

<Note>
  When you exceed version limits, oldest versions are archived but not deleted.
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Testing Prompts" icon="flask" href="/prompts/testing">
    Learn to test prompts effectively
  </Card>

  <Card title="Prompt Snippets" icon="puzzle-piece" href="/prompts/snippets">
    Create reusable template fragments
  </Card>
</CardGroup>
