Skip to main content

Method Signature

Parameters

Examples

Basic Usage

Access Version Details

Asynchronous Usage

Error Handling

Overview

The get_version method allows you to retrieve a specific version of a prompt by its version ID or version number. This is useful for accessing historical versions, comparing changes, or rolling back to previous versions.

Method Signature

Synchronous

Asynchronous

Parameters

*Either version_id or version_number must be provided.

Returns

Returns a dictionary containing the complete version information.

Examples

Get Version by Number

Get Version by ID

Detailed Version Information

Asynchronous Usage

Compare Versions

Get Latest Version

Get Active Version

Batch Version Retrieval

Asynchronous Batch Retrieval

Version Content Analysis

Export Version

Error Handling

Version Structure

A retrieved version contains:
  • version_id: Unique identifier for this version
  • prompt_id: ID of the parent prompt
  • version_number: Sequential version number
  • content: The version content with variables
  • description: Optional description of changes
  • variables: List of variables used in content
  • metadata: Version-specific metadata
  • is_active: Whether this version is currently active
  • created_at: Creation timestamp
  • created_by: User who created the version
  • updated_at: Last modification timestamp (if applicable)

Best Practices

  • Use version numbers for sequential access
  • Use version IDs when you have the specific identifier
  • Always handle cases where versions might not exist
  • Cache frequently accessed versions
  • Validate version content before using in production
  • Compare versions to understand evolution

Common Use Cases

  • Retrieving specific versions for rollback
  • Comparing different versions for analysis
  • Loading historical versions for audit
  • Accessing A/B test versions
  • Reviewing version evolution
  • Preparing versions for deployment