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

# Retrieve versions

This endpoint allows you to get a list of versions of a prompt.

## Get prompt versions

<CodeGroup>
  ```python example.py theme={"system"}
  import requests

  url = "https://api.keywordsai.co/api/prompts/<prompt_id>/versions/"
  api_key = "YOUR_KEYWORDS_AI_API_KEY" # Replace with your actual Keywords AI API key
  headers = {
      "Authorization": f"Bearer {api_key}",
      "Content-Type": "application/json"
  }

  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```typescript example.ts theme={"system"}
  fetch('https://api.keywordsai.co/api/prompts/<prompt_id>/versions/', 
  {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_KEYWORDS_AI_API_KEY'
      }
  })
  .then(response => response.json())
  .then(data => console.log(data));
  ```
</CodeGroup>

## Get a single prompt version

You can get a single prompt version by sending a GET request to the `api/prompts/<prompt_id>/versions/<version_id>/` endpoint.

<CodeGroup>
  ```python example.py theme={"system"}
  import requests

  url = "https://api.keywordsai.co/api/prompts/<prompt_id>/versions/<version>/"
  api_key = "YOUR_KEYWORDS_AI_API_KEY" # Replace with your actual Keywords AI API key
  headers = {
      "Authorization": f"Bearer {api_key}",
      "Content-Type": "application/json"
  }

  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```typescript example.ts theme={"system"}
  fetch('https://api.keywordsai.co/api/prompts/<prompt_id>/versions/<prompt_version_id>/', 
  {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_KEYWORDS_AI_API_KEY'
      }
  })
  .then(response => response.json())
  .then(data => console.log(data));
  ```
</CodeGroup>
