---
title: "Read Compilation Result"
description: "Read a compile packet job result."
canonical: https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/compiling-code/read-compilation-result
markdown: https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/compiling-code/read-compilation-result.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/01%20Cloud%20Platform/99%20API%20Reference/04%20Compiling%20Code/02%20Read%20Compilation%20Result
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# Read Compilation Result

[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) > [Compiling Code](https://www.quantconnect.com/docs/v2/cloud-platform/api-reference/compiling-code.md) > Read Compilation Result

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

## Introduction

Read a compile packet job result.

## Request

Read a compile result for a specific Project Id and Compile Id. The `/compile/read` API accepts requests in the following format:

| `ReadCompileRequest` Model - Request to read a compile packet job. |  |
| --- | --- |
| projectId | `integer required example: 23456789` Id of the project you requested to compile. |
| compileId | `string required example: 5d1f2cba3a0ec7407c566614300502b5-173e0419674daf4144ce7c9931155ca8` Compile Id returned during the creation request. |
| Example | `{ "projectId": 23456789, "compileId": "5d1f2cba3a0ec7407c566614300502b5-173e0419674daf4144ce7c9931155ca8" }` |

## Responses

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

### 200 Success

| `ReadCompileResponse` Model - Response received from reading a compile job. |  |
| --- | --- |
| compileId | `string example: 5d1f2cba3a0ec7407c566614300502b5-173e0419674daf4144ce7c9931155ca8` Compile Id for a successful build. |
| state | `string Enum` The current state of the compile job. Options : ['InQueue', 'BuildSuccess', 'BuildError'] |
| logs | `string Array` Logs of the compilation request. |
| success | `boolean` Indicate if the API request was successful. |
| errors | `string Array` List of errors with the API call. |
| Example | `{ "compileId": "5d1f2cba3a0ec7407c566614300502b5-173e0419674daf4144ce7c9931155ca8", "state": "InQueue", "logs": [ "string" ], "success": true, "errors": [ "string" ] }` |

### 401 Authentication Error

| `UnauthorizedError` Model - Unauthorized response from the API. Key is missing, invalid, or timestamp is too old for hash. |  |
| --- | --- |
| www_authenticate | `string` Header |

## Examples

The following example demonstates creating, and reading a compilation job 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())

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

# The project ID of the project to compile
project_id = 12345678

### Create Compilation Job
# Prepare data payload to create a compilation job
payload = {
    "projectId": project_id  # ID of the project to compile
}
# Send a POST request to the /compile/create endpoint to start compilation
response = post(f'{BASE_URL}/compile/create', headers=get_headers(), json=payload)
# Parse the JSON response into python managable dict
result = response.json()
# Extract the compile ID from the response
compile_id = result['compileId']
# Check if the request was successful and print the result
if result['success']:
    print("Compilation Job Created Successfully:")
    print(result)

### Read Compilation Result
# Prepare data payload to read compilation result
payload = {
    "projectId": project_id,  # ID of the project
    "compileId": compile_id  # ID of the compilation job
}
# Send a POST request to the /compile/read endpoint to get compilation result
response = post(f'{BASE_URL}/compile/read', headers=get_headers(), json=payload)
# Parse the JSON response into python managable dict
result = response.json()
# Check if the request was successful and print the result
if result['success']:
    print("Compilation Result:")
    print(result)
```
