---
title: "Lean Version"
canonical: https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/lean-version
markdown: https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/lean-version.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/01%20Cloud%20Platform/99%20API%20Reference/13%20Lean%20Version
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Lean Version

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Cloud Platform](https://www.quantconnect.com/docs/v2/cloud-platform.md) > [API Reference](https://www.quantconnect.com/docs/v2/cloud-platform/api-reference.md) > Lean Version

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Returns a list of lean versions with basic information for each version.

## Request

The `/lean/versions/read` API accepts requests in the following format:

| `/lean/versions/read` Method |
| --- |

## Responses

The `/lean/versions/read` API provides a response in the following format:

### 200 Success

| `LeanVersionsResponse` Model - Contains the LEAN versions with their basic descriptions. |  |
| --- | --- |
| versions | `LeanVersion Array` List of LEAN versions with their basic descriptions. |
| success | `boolean` Indicate if the API request was successful. |
| errors | `string Array` List of errors with the API call. |
| Example | `{ "versions": [ { "id": 0, "created": "2021-11-26T15:18:27.693Z", "description": "string", "leanHash": "string", "leanCloudHash": "string", "name": "string", "ref": "string", "public": true } ], "success": true, "errors": [ "string" ] }` |

| `LeanVersion` Model |  |
| --- | --- |
| id | `integer` Id of the LEAN version. |
| created | `string($date-time)` Date when this version was created. |
| description | `string` Description of the LEAN version. |
| leanHash | `string` Commit Hash in the LEAN repository. |
| leanCloudHash | `string` Commit Hash in the LEAN Cloud repository. |
| name | `string` Name of the branch where the commit is. |
| ref | `string` Reference to the branch where the commit is. |
| public | `boolean` Indicates if the version is available for the public. |
| Example | `{ "id": 0, "created": "2021-11-26T15:18:27.693Z", "description": "string", "leanHash": "string", "leanCloudHash": "string", "name": "string", "ref": "string", "public": true }` |

## Examples

The following example demonstates getting a list of Lean versions through the cloud API.

```
from base64 import b64encode
from hashlib import sha256
from time import time
from requests import get, post
BASE_URL = 'https://www.quantconnect.com/api/v2/'

# You need to replace these with your actual credentials.
# You can request your credentials at https://www.quantconnect.com/settings/
# You can find our organization ID at https://www.quantconnect.com/organization/
USER_ID = 0
API_TOKEN = '____'
ORGANIZATION_ID = '____'

def get_headers():
    # Get timestamp
    timestamp = f'{int(time())}'
    time_stamped_token = f'{API_TOKEN}:{timestamp}'.encode('utf-8')

    # Get hased API token
    hashed_token = sha256(time_stamped_token).hexdigest()
    authentication = f'{USER_ID}:{hashed_token}'.encode('utf-8')
    authentication = b64encode(authentication).decode('ascii')

    # Create headers dictionary.
    return {
        'Authorization': f'Basic {authentication}',
        'Timestamp': timestamp
    }

# Authenticate to verify credentials
response = post(f'{BASE_URL}/authenticate', headers = get_headers())
print(response.json())

# --------------------

### Get Lean Versions
# Send a POST request to the /lean/versions/read endpoint to get Lean versions
response = post(f'{BASE_URL}/lean/versions/read', headers=get_headers())
# Parse the JSON response into python managable dict
result = response.json()
# Check if the request was successful and print the versions
if result['success']:
    print("Lean Versions:")
    print(result)
```
