Support
Create Support Ticket
Description
To open a new ticket, provide the subject and message properties. Each new ticket uses one ticket from the quota of your support seat. To update an existing ticket with a comment, provide the hash of the ticket and the message. A comment on a closed ticket opens the ticket again, unless you set close to true. You can attach a project, backtest, live deployment, or AI conversation only when you open a new ticket. When you attach any of them, you give the QuantConnect Support Staff permission to view your project and all its libraries. When you comment on a ticket, the endpoint ignores these properties. You must have a support seat in the organization to use this endpoint.
Request
The organization, the ticket to comment on or the subject of a new ticket, and the message. The /organizations/support/tickets/create API accepts requests in the following format:
CreateSupportTicketRequest Model - Request body to open a support ticket or comment on a ticket. | |
|---|---|
| organizationId | string Id of the organization. |
| subject | string Subject of the new ticket. Required to open a new ticket. |
| message | string HTML body of the message. |
| hash | string Id of the ticket to comment on. To open a new ticket, omit this property. |
| close | boolean If true, close the ticket after you add the comment. Requires hash. |
| projectId | integer Optional. Id of one of your projects to attach to the new ticket. To get your project Ids, use the /projects/read endpoint. |
| backtestId | string Optional. Id of a backtest of the attached project to attach to the new ticket. Requires projectId. To get the backtest Ids of a project, use the /backtests/list endpoint. |
| deployId | string Optional. Id of a stopped live deployment of the attached project to attach to the new ticket. Requires projectId. To get the deployment Ids of a project, use the /live/list endpoint. |
| agentDeploymentId | string Optional. Id of an AI conversation of the attached project to attach to the new ticket. Requires projectId. To get the conversation Ids of a project, use the /agents/deployments/list endpoint. |
| Example |
{
"organizationId": "5cad178b20a1d52567b534553413b691",
"subject": "Live algorithm stopped after a brokerage disconnection",
"message": "My live algorithm stopped at 10:32 ET after the brokerage disconnected.",
"hash": "string",
"close": true,
"projectId": 0,
"backtestId": "string",
"deployId": "string",
"agentDeploymentId": "string"
}
|
Responses
The /organizations/support/tickets/create API provides a response in the following format:
200 Success
CreateSupportTicketResponse Model - Response from opening a support ticket or commenting on a ticket. | |
|---|---|
| hash | string Id of the ticket. |
| success | boolean Indicate if the API request was successful. |
| errors | string Array List of errors with the API call. |
| Example |
{
"hash": "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 demonstrates checking the ticket quota of your support seat, listing the support tickets of your organization, reading the messages of an open ticket, and opening a new ticket with an attached project, backtest, live deployment, and AI conversation 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())
# --------------------
### Check Ticket Quota
# Send a POST request to the /organizations/support/tickets/list endpoint to get the ticket quota and the tickets
response = post(f'{BASE_URL}/organizations/support/tickets/list', headers=get_headers(), json={
"organizationId": ORGANIZATION_ID,
"closedPage": 0 # Page of 10 closed tickets, starting at 0
})
# Parse the JSON response into python managable dict
result = response.json()
# Print the number of new tickets you can open. Every ticket you opened in the last month counts, even if it's closed
remaining = result['remaining'] if result['success'] else 0
print(f"Remaining tickets: {remaining} of {result.get('allowance')}")
### List Support Tickets
# The same response contains the open tickets and the requested page of closed tickets
open_tickets = result.get('open', [])
for ticket in open_tickets:
print(ticket['data']['external_id'], ticket['status'], ticket['title'])
### Read Support Ticket
if open_tickets:
# Send a POST request to the /organizations/support/tickets/read endpoint to read the first open ticket
response = post(f'{BASE_URL}/organizations/support/tickets/read', headers=get_headers(), json={
"organizationId": ORGANIZATION_ID,
"hash": open_tickets[0]['hash']
})
# Parse the JSON response into python managable dict
result = response.json()
# Check if the request was successful and print the messages
if result['success']:
for message in result['messages']:
print(message['time'], message['name'], message['message'])
### Create Support Ticket (only when the quota has tickets left)
if remaining > 0:
# Send a POST request to the /organizations/support/tickets/create endpoint to open a new ticket
# Each new ticket uses one ticket from the quota of your support seat
response = post(f'{BASE_URL}/organizations/support/tickets/create', headers=get_headers(), json={
"organizationId": ORGANIZATION_ID,
"subject": "Backtest orders don't fill at the expected price",
"message": "<p>The market orders in the attached backtest fill at the previous close.</p>",
"projectId": 12345678, # Optional. Gives the Support Team permission to view the project
"backtestId": "1c991c7eec8a7bd3b4bfc7e18a376fa6", # Optional. Backtest of the attached project
"deployId": "L-141106d80de1da9a9f85ea07c06bf7b6", # Optional. Stopped live deployment of the attached project
"agentDeploymentId": "A-3306e3e787f321efadf5c4392861d68d" # Optional. AI conversation of the attached project
})
# Parse the JSON response into python managable dict
result = response.json()
# Keep the hash of the new ticket to find it and comment on it
ticket_hash = result['hash']
### Get the Id of the New Support Ticket
# Send a POST request to the /organizations/support/tickets/list endpoint to find the new ticket
response = post(f'{BASE_URL}/organizations/support/tickets/list', headers=get_headers(), json={
"organizationId": ORGANIZATION_ID
})
# Parse the JSON response into python managable dict
result = response.json()
# Print the Id to mention when you contact our Support Team about the ticket
ticket = next(t for t in result['open'] if t['hash'] == ticket_hash)
print(f"Ticket Id: {ticket['data']['external_id']}")
### Comment on Support Ticket
# Send a POST request to the /organizations/support/tickets/create endpoint with the hash to comment on the ticket
response = post(f'{BASE_URL}/organizations/support/tickets/create', headers=get_headers(), json={
"organizationId": ORGANIZATION_ID,
"hash": ticket_hash,
"message": "<p>The issue is resolved. Thank you.</p>",
"close": True # Close the ticket after you add the comment
})
# Parse the JSON response into python managable dict
result = response.json()
print(result)