Skip to main content

Read Course Completions

Page through course completion records, most recent first. Each completion includes the user ID, course info, completion timestamp (UTC), and — for graded courses — pass/fail and score.

API endpoints:

note

This example assumes you already have an access_token — see Authentication.

import httpx

# Page through course completions (ordered most recent first)
completions = []
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["cursor"] = cursor

response = httpx.get(
f"https://your-account.wyzed.com/v3_service/tenants/{tenant_id}/course_completions/",
headers={
"Authorization": f"Bearer {access_token}",
},
params=params,
)
response.raise_for_status()

# Response shape: {"course_completions": [...], "more": true, "next_cursor": "..."}
data = response.json()
completions.extend(data["course_completions"])

if not data["more"]:
break
cursor = data["next_cursor"]

print(f"Retrieved {len(completions)} completions")
for c in completions:
user_id = c["user_id"]
course_name = c["course"]["name"]
completed_at = c["completed_at"] # ISO 8601 UTC timestamp
score_percent = c["grade"]["score_percent"] # None if not marked

# A completion only carries the user_id — not the user's name or email.
# To get those, call the User Service read endpoint with this user_id:
# GET /v3_user/tenants/{tenant_id}/users/{user_id}

score = "100% (not marked)" if score_percent is None else f"{score_percent}%"
print(f"- user {user_id} completed '{course_name}' on {completed_at} — {score}")