SDK v0.2.2 and later: Each time entry returned by
list_time_spent() has a workflow_v3_stage field. For Projects that support workflow_v3, it holds the exact stage the time was spent in, with its id, name and stage_type. The workflow_stage field can be None for these Projects, for example for time spent in an External stage. Check both fields before you read a stage’s name, as the Timers - Stages example does.
from datetime import datetime
from encord import EncordUserClient
# --- Configuration ---
SSH_PATH = "/Users/chris-encord/ssh-private-key.txt" # Replace with the file path to your access key
PROJECT_ID = "00000000-0000-0000-0000-000000000000" # Replace with the project unique ID
# --- Connect to Encord ---
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
ssh_private_key_path=SSH_PATH,
# For US platform users use "https://api.us.encord.com"
domain="https://api.encord.com",
)
project = user_client.get_project(PROJECT_ID)
# --- Get Time Entries ---
start_date = datetime(2025, 1, 1)
end_date = datetime(2025, 6, 8)
# Returns all data
time_entries = list(project.list_time_spent(start=start_date, end=end_date))
print(time_entries)
from collections import defaultdict
from datetime import datetime
from encord import EncordUserClient
# --- Configuration ---
SSH_PATH = "/Users/chris-encord/ssh-private-key.txt" # Replace with the file path to your access key
PROJECT_ID = "00000000-0000-0000-0000-000000000000" # Replace with the project unique ID
# --- Connect to Encord ---
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
ssh_private_key_path=SSH_PATH,
# For US platform users use "https://api.us.encord.com"
domain="https://api.encord.com",
)
project = user_client.get_project(PROJECT_ID)
# --- Get Time Entries ---
start_date = datetime(2025, 1, 1)
end_date = datetime(2025, 6, 8)
# Returns all data
time_entries = list(project.list_time_spent(start=start_date, end=end_date))
# Filters for total Project time
total_time = sum(entry.time_spent_seconds for entry in time_entries)
print(f"Total time for project: {total_time} sec ({total_time / 60:.1f} min)")
from collections import defaultdict
from datetime import datetime
from encord import EncordUserClient
# --- Configuration ---
SSH_PATH = "/Users/chris-encord/ssh-private-key.txt" # Replace with the file path to your access key
PROJECT_ID = "00000000-0000-0000-0000-000000000000" # Replace with the project unique ID
# --- Connect to Encord ---
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
ssh_private_key_path=SSH_PATH,
# For US platform users use "https://api.us.encord.com"
domain="https://api.encord.com",
)
project = user_client.get_project(PROJECT_ID)
# --- Get Time Entries ---
start_date = datetime(2025, 1, 1)
end_date = datetime(2025, 6, 8)
# Returns all data
time_entries = list(project.list_time_spent(start=start_date, end=end_date))
# Totals the time spent in each stage.
# For Projects that support workflow_v3, workflow_v3_stage is the exact stage.
# workflow_stage can be None for these Projects, for example for External stages.
stage_time: defaultdict[str, int] = defaultdict(int)
for entry in time_entries:
if entry.workflow_v3_stage is not None:
stage_name = entry.workflow_v3_stage.name
elif entry.workflow_stage is not None:
stage_name = entry.workflow_stage.title
else:
stage_name = "No stage"
stage_time[stage_name] += entry.time_spent_seconds
for stage, seconds in sorted(stage_time.items(), key=lambda x: x[1], reverse=True):
print(f"Stage: {stage:<25} | {seconds:>5} sec | {seconds / 60:>5.1f} min")
from collections import defaultdict
from datetime import datetime
from encord import EncordUserClient
# --- Configuration ---
SSH_PATH = "/Users/chris-encord/ssh-private-key.txt" # Replace with the file path to your access key
PROJECT_ID = "00000000-0000-0000-0000-000000000000" # Replace with the project unique ID
# --- Connect to Encord ---
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
ssh_private_key_path=SSH_PATH,
# For US platform users use "https://api.us.encord.com"
domain="https://api.encord.com",
)
project = user_client.get_project(PROJECT_ID)
# --- Get Time Entries ---
start_date = datetime(2025, 1, 1)
end_date = datetime(2025, 6, 8)
# Returns all data
time_entries = list(project.list_time_spent(start=start_date, end=end_date))
# Filters for task time
task_time = defaultdict(int)
for entry in time_entries:
task_time[str(entry.workflow_task_uuid)] += entry.time_spent_seconds
for task, seconds in sorted(task_time.items(), key=lambda x: x[1], reverse=True):
print(f"Task UUID: {task} | {seconds:>5} sec | {seconds / 60:>5.1f} min")
from collections import defaultdict
from datetime import datetime
from encord import EncordUserClient
# --- Configuration ---
SSH_PATH = "/Users/chris-encord/ssh-private-key.txt" # Replace with the file path to your access key
PROJECT_ID = "00000000-0000-0000-0000-000000000000" # Replace with the project unique ID
# --- Connect to Encord ---
user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
ssh_private_key_path=SSH_PATH,
# For US platform users use "https://api.us.encord.com"
domain="https://api.encord.com",
)
project = user_client.get_project(PROJECT_ID)
# --- Get Time Entries ---
start_date = datetime(2025, 1, 1)
end_date = datetime(2025, 6, 8)
# Returns all data
time_entries = list(project.list_time_spent(start=start_date, end=end_date))
# Filters for user
user_time = defaultdict(int)
for entry in time_entries:
user_time[entry.user_email] += entry.time_spent_seconds
for user, seconds in sorted(user_time.items(), key=lambda x: x[1], reverse=True):
print(f"User: {user:<30} | {seconds:>5} sec | {seconds / 60:>5.1f} min")

