Skip to main content
RapidDev - Software Development Agency
retool-integrationsREST API Resource

How to Integrate Retool with Khan Academy API

Khan Academy's public REST API was deprecated and shut down. For organizations using Khan Academy for Teams or education programs, you can access learning progress data through exported CSV reports or Khan Academy's unofficial data endpoints. Build a student learning progress dashboard in Retool by importing exported Khan Academy data into a database or Retool Database, then querying it for custom analytics and progress tracking.

What you'll learn

  • Why Khan Academy's public API is deprecated and what alternatives exist for progress data access
  • How to export student progress data from Khan Academy for Teams or Khan for Schools
  • How to import Khan Academy CSV exports into Retool Database for persistent storage and querying
  • How to build a student learning progress dashboard in Retool using imported data
  • How to schedule regular data refresh using Retool Workflows for up-to-date reporting
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate16 min read30 minutesOtherLast updated April 2026RapidDev Engineering Team
TL;DR

Khan Academy's public REST API was deprecated and shut down. For organizations using Khan Academy for Teams or education programs, you can access learning progress data through exported CSV reports or Khan Academy's unofficial data endpoints. Build a student learning progress dashboard in Retool by importing exported Khan Academy data into a database or Retool Database, then querying it for custom analytics and progress tracking.

Quick facts about this guide
FactValue
ToolKhan Academy API
CategoryOther
MethodREST API Resource
DifficultyIntermediate
Time required30 minutes
Last updatedApril 2026

Build a Khan Academy Learning Progress Dashboard in Retool

Khan Academy's public API (api.khanacademy.org) was officially deprecated and shut down, making direct API-based integration with Retool no longer possible for new implementations. However, organizations running education programs, corporate training, or school district tech stacks still need ways to track and report on Khan Academy learning progress alongside other operational data. Retool can serve as the analytics and reporting layer using Khan Academy's data export capabilities as the data source.

Khan Academy for Teams and Khan Academy for Schools (the enterprise tiers) provide CSV export functionality from their admin dashboards. These exports include student identifiers, exercise completion status, mastery levels, time spent, and course progress — all the data needed to build meaningful progress dashboards. By importing these exports into Retool Database (a built-in PostgreSQL-compatible database available in all Retool plans) or an existing PostgreSQL or MySQL database, you can query the data directly from Retool and build customized progress tracking panels.

For organizations in approved district partnerships, Khan Academy for Schools may provide direct data access through their district data portal or SIS (Student Information System) integrations. In those cases, a REST API Resource connection may be available using credentials provided by Khan Academy's enterprise team. This guide covers both the CSV-import path (available to all organizations) and notes the district partnership path where applicable.

Integration method

REST API Resource

Khan Academy's public REST API (api.khanacademy.org) was deprecated and is no longer available for new integrations. For organizations using Khan Academy for Teams (an enterprise product for schools and districts), progress data can be exported as CSV reports from the teacher/admin dashboard and imported into Retool Database or PostgreSQL for custom analytics. Alternatively, Khan Academy for Schools provides a data API for approved district partners. This guide covers the CSV import path into Retool Database and building student progress dashboards from the imported data.

Prerequisites

  • A Khan Academy for Teams, Khan Academy for Schools, or Khan Academy for Districts account with admin/teacher access to export progress reports
  • Access to Retool Database (built into all Retool plans) or a connected PostgreSQL/MySQL database for storing imported data
  • The Khan Academy progress export CSV file(s) from your admin dashboard
  • A Retool account with permission to create Resources and manage Retool Database
  • Basic familiarity with SQL for querying the imported data

Step-by-step guide

1

Export student progress data from Khan Academy

Log in to your Khan Academy teacher or admin account. For Khan Academy for Teams, navigate to your Teacher Dashboard (khanacademy.org/teacher/dashboard) and select the class you want to report on. Click on the 'Progress' tab to see the class's exercise and mastery data. Look for an Export or Download option — Khan Academy provides CSV exports of student progress data from the progress report views. The exact export path varies by interface version: look for a download icon or 'Export to CSV' link in the top-right of the progress table. The exported CSV typically includes columns for student email or anonymized ID, exercise name, skill domain, mastery level (Not Started / Attempted / Familiar / Proficient / Mastered), number of correct answers, number of problems attempted, time spent (seconds), and last activity date. For Khan Academy for Schools with district-level access, additional data exports may be available from the district admin portal including cross-class progress and SIS-matched student identifiers. Download the CSV and open it in a spreadsheet application to verify the column structure before importing into Retool. Note the column names exactly as they will become the table schema in Retool Database.

Pro tip: Schedule regular exports from Khan Academy (weekly or monthly) to keep your Retool dashboard data fresh. Set a calendar reminder for when to re-export and re-import. For Khan Academy for Schools district accounts, ask your Khan Academy account manager whether automated data delivery via SFTP is available as an alternative to manual CSV exports.

Expected result: You have a CSV file with student progress data including student identifiers, exercise names, mastery levels, and time spent. You know the column names and data types.

2

Create a table in Retool Database and import the CSV

Navigate to your Retool workspace and click on the 'Database' section in the left sidebar (or navigate to retool.com/database). Retool Database is a managed PostgreSQL instance included in all Retool plans with 5GB of storage. Click 'Create table' and name it 'khan_progress'. You can either define the schema manually by adding columns one by one, or use Retool Database's CSV import feature to auto-detect the schema from your export file. To use CSV import: in the Retool Database interface, click Import → Upload CSV, and select your Khan Academy export file. Retool will preview the detected columns and suggest data types — review these carefully. String columns like student_email, exercise_name, skill_domain, and mastery_level should be VARCHAR or TEXT. Numeric columns like correct_count, attempted_count, and time_spent_seconds should be INTEGER or BIGINT. Date columns like last_activity should be TIMESTAMP or DATE. Click 'Import' to create the table and populate it with the CSV data. After the initial import, note the table schema so you can append future exports consistently. Consider adding an 'imported_at' column (TIMESTAMP, default CURRENT_TIMESTAMP) to track when each batch of data was imported, enabling you to filter to the most recent import when multiple exports are loaded.

create_khan_progress_table.sql
1-- SQL: Create khan_progress table in Retool Database (or your PostgreSQL)
2CREATE TABLE IF NOT EXISTS khan_progress (
3 id SERIAL PRIMARY KEY,
4 student_email VARCHAR(255),
5 student_id VARCHAR(100),
6 exercise_name VARCHAR(500),
7 skill_domain VARCHAR(255),
8 mastery_level VARCHAR(50),
9 correct_count INTEGER DEFAULT 0,
10 attempted_count INTEGER DEFAULT 0,
11 time_spent_seconds INTEGER DEFAULT 0,
12 last_activity TIMESTAMP,
13 class_name VARCHAR(255),
14 course_name VARCHAR(255),
15 imported_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
16);

Pro tip: Add a UNIQUE constraint on (student_id, exercise_name, class_name) to prevent duplicate rows when re-importing updated CSV exports. Use INSERT ... ON CONFLICT DO UPDATE (upsert) when appending new exports so the table always reflects the latest mastery levels without accumulating stale rows.

Expected result: The khan_progress table exists in Retool Database with imported rows visible in Retool Database's spreadsheet view.

3

Create a Retool Database Resource and build progress queries

In Retool's Resources tab, click Add Resource and select Retool Database from the list — it appears as a built-in resource pre-configured for your workspace's Retool Database instance. Name it 'Khan Academy Data' and click Save. If you are using an external PostgreSQL database instead, select PostgreSQL and enter your connection details (host, port, database name, username, password). Open or create a Retool app. In the Code panel, click + to create a new query named 'getStudentProgress'. Select your Retool Database resource. In the query editor, write a SQL query that fetches progress data with filters for the class and date range controls you will add in the UI. The query uses Retool's {{ }} syntax for dynamic parameterization, and Retool automatically converts these to prepared statements to prevent SQL injection. For the mastery level filter, use a CASE statement to convert the text mastery level into a numeric score (e.g., Not Started=0, Attempted=1, Familiar=2, Proficient=3, Mastered=4) for sorting and charting. Add aggregation queries for class-level summaries using GROUP BY student_email or GROUP BY skill_domain.

student_progress_query.sql
1-- Query: student progress with filters
2SELECT
3 student_email,
4 student_id,
5 exercise_name,
6 skill_domain,
7 mastery_level,
8 CASE mastery_level
9 WHEN 'Mastered' THEN 4
10 WHEN 'Proficient' THEN 3
11 WHEN 'Familiar' THEN 2
12 WHEN 'Attempted' THEN 1
13 ELSE 0
14 END AS mastery_score,
15 correct_count,
16 attempted_count,
17 ROUND(time_spent_seconds / 60.0, 1) AS time_spent_minutes,
18 last_activity
19FROM khan_progress
20WHERE
21 ({{ classFilter.value }} = '' OR class_name = {{ classFilter.value }})
22 AND ({{ domainFilter.value }} = '' OR skill_domain = {{ domainFilter.value }})
23 AND last_activity >= {{ dateRange.start || '2020-01-01' }}
24 AND last_activity <= {{ dateRange.end || 'now()' }}
25ORDER BY student_email, skill_domain, mastery_score DESC;

Pro tip: Create a second query named 'getClassSummary' that aggregates progress by student email — showing each student's average mastery score, total exercises completed, and total time spent. Use this query to power a class ranking table and identify at-risk students whose average mastery score is below a configurable threshold.

Expected result: The getStudentProgress query returns filtered rows from the khan_progress table, visible in the Results panel with student progress data.

4

Build the student progress dashboard UI

In the Retool canvas, add a stat row at the top of the app with three Statistic components showing class-level summary metrics: Total Students (COUNT DISTINCT student_email), Average Mastery Score (ROUND(AVG(mastery_score), 2)), and Total Time Spent (SUM(time_spent_minutes) formatted as hours). Below the stats row, add filter controls: a Select for class_name (named 'classFilter', data from a DISTINCT class_name query), a Select for skill_domain (named 'domainFilter', data from a DISTINCT skill_domain query), and a Date Range Picker (named 'dateRange'). Add a Table component below the filters bound to {{ getStudentProgress.data }} with columns for student_email (or a display name if your data includes one), skill_domain, exercise_name, mastery_level (formatted with conditional coloring — red for Not Started, yellow for Attempted, light green for Familiar, green for Proficient, dark green for Mastered), time_spent_minutes, and last_activity. Add a Chart component below the table showing mastery distribution: a Bar chart with skill_domain on the x-axis and the count of exercises at each mastery level as stacked bars. Use a GROUP BY transformer to prepare the Chart data. Add a second Chart showing weekly activity trends — exercises completed per week over the last 8 weeks — using a DATE_TRUNC('week', last_activity) GROUP BY query.

mastery_chart_transformer.js
1// Transformer: prepare mastery distribution data for Chart component
2const rows = data || [];
3const domains = [...new Set(rows.map(r => r.skill_domain))];
4const levels = ['Mastered', 'Proficient', 'Familiar', 'Attempted', 'Not Started'];
5const colors = ['#16a34a', '#65a30d', '#ca8a04', '#f97316', '#dc2626'];
6
7return {
8 labels: domains,
9 datasets: levels.map((level, i) => ({
10 label: level,
11 backgroundColor: colors[i],
12 data: domains.map(domain =>
13 rows.filter(r => r.skill_domain === domain && r.mastery_level === level).length
14 )
15 }))
16};

Pro tip: Add a 'Download Report' button that triggers a Retool query using the SQL results and formats them into a CSV using JavaScript. Bind a download link to the generated CSV blob — this allows teachers to export custom-filtered progress reports from Retool in any format they need, independent of Khan Academy's fixed export templates.

Expected result: A functional student progress dashboard shows filterable data with mastery distribution charts, weekly activity trends, and individual student breakdowns.

5

Set up a Retool Workflow for scheduled data refresh

Rather than manually re-importing CSVs each week, you can partially automate the refresh process using Retool Workflows combined with any automated export delivery that Khan Academy may offer. Create a new Retool Workflow by navigating to Retool → Workflows → Create new Workflow. Name it 'Khan Academy Data Refresh'. For organizations where Khan Academy exports can be automatically delivered (via SFTP, Google Drive, or email attachment), configure the Workflow with a Schedule trigger (e.g., every Monday at 8 AM). Add a Resource Query block that reads from the data source where the latest export file lands (e.g., if you move the CSV to an S3 bucket via automation, use an S3 Resource Query to fetch it). Add a Code block with JavaScript that parses the CSV content into row objects. Add a second Resource Query block that performs a bulk upsert into the khan_progress table using Retool Database's INSERT ... ON CONFLICT DO UPDATE syntax to merge new progress data with existing records without creating duplicates. Add error handling with a Global Error Handler block that sends a Slack notification if the import fails. For fully manual refresh workflows, the Workflow can also serve as a reminder system — schedule it to send a Slack message to the admin each Monday asking them to run the export and upload the file. For complex multi-source education analytics pipelines integrating Khan Academy exports with your SIS, LMS, and HR data, RapidDev's team can help architect your Retool data operations solution.

csv_parser_workflow.js
1// Retool Workflow Code block: parse CSV and upsert into Retool Database
2// Assumes 'csvContent' is the raw CSV string from a previous block
3const lines = csvContent.split('\n').filter(l => l.trim());
4const headers = lines[0].split(',').map(h => h.trim().replace(/"/g, ''));
5
6const rows = lines.slice(1).map(line => {
7 const values = line.split(',').map(v => v.trim().replace(/"/g, ''));
8 const row = {};
9 headers.forEach((h, i) => row[h] = values[i] || null);
10 return row;
11});
12
13// rows is now an array of objects ready for bulk upsert
14return rows;

Pro tip: If your organization uses Google Classroom or an LMS alongside Khan Academy, build the Retool Workflow to import data from multiple sources into a unified 'student_learning' table. Add a 'source' column to distinguish Khan Academy rows from LMS rows, enabling cross-platform learning analytics in a single Retool dashboard.

Expected result: A Retool Workflow is configured to run on a schedule, automating the data refresh process and maintaining up-to-date Khan Academy progress data in Retool Database.

Common use cases

Build a student progress and mastery tracking dashboard

Create a Retool panel that shows individual student progress across Khan Academy courses — displaying mastery levels (Not Started, Attempted, Familiar, Proficient, Mastered) per skill area, time spent learning, and completion percentage. Enable filtering by class, grade, date range, and skill domain so teachers can quickly identify students who are falling behind and need intervention.

Retool Prompt

Build a Retool student progress dashboard querying the khan_progress table in Retool Database. Show a Table with student name, grade, course, mastery level, exercises completed, time spent (minutes), and last activity date. Include filters for class, mastery level threshold, and date range. Add a bar chart of mastery distribution across the class.

Copy this prompt to try it in Retool

Build a class-level learning analytics panel for teachers

Create a Retool class analytics view that aggregates Khan Academy progress data by class or cohort — showing class-average mastery per skill domain, exercises completed per week, and a comparison of current week vs previous week engagement. Display individual student standings in a ranked table so teachers can identify top performers and at-risk students in a single view.

Retool Prompt

Build a Retool analytics panel showing aggregated Khan Academy progress for a selected class. Show Charts for average mastery by skill area, weekly exercise completion trend, and a Table of students ranked by mastery score with columns for student name, total exercises, average mastery, and last activity date.

Copy this prompt to try it in Retool

Build an HR learning progress tracker for corporate training programs

Create a Retool employee training dashboard for organizations using Khan Academy as part of their L&D programs. Show employee completion rates by department, track mandatory course completions, and generate compliance reports for HR managers. Combine Khan Academy progress data with HRIS data from another connected database to add employee department and manager information.

Retool Prompt

Build a Retool corporate learning dashboard querying khan_progress data joined with an employees table. Show completion rates by department using a Chart, a Table of employees who haven't completed mandatory courses (filter by completion = 0 and course_id in mandatory list), and a summary metric for overall training completion percentage.

Copy this prompt to try it in Retool

Troubleshooting

CSV import to Retool Database fails with 'column type mismatch' error

Cause: Khan Academy CSV exports may include inconsistent data formats — for example, the time_spent_seconds column may contain empty strings instead of 0 for students who haven't started, or date columns may be in a non-standard format that Retool Database rejects during import.

Solution: Before importing, open the CSV in a spreadsheet application and clean the data: replace empty cells in numeric columns with 0, ensure date columns use ISO 8601 format (YYYY-MM-DD HH:MM:SS), and remove any rows with missing required fields. Alternatively, use Retool Database's manual column definition mode to set more permissive types (TEXT instead of INTEGER) and handle type conversion in SQL queries using CAST().

typescript
1-- Handle NULL/empty values in numeric columns during query
2SELECT
3 student_email,
4 COALESCE(NULLIF(time_spent_seconds, '')::INTEGER, 0) AS time_spent_seconds,
5 COALESCE(NULLIF(correct_count, '')::INTEGER, 0) AS correct_count
6FROM khan_progress;

Dashboard shows stale data — progress visible in Khan Academy but not in Retool

Cause: The Retool database still contains an older CSV import. Khan Academy data is only as current as the last exported and imported CSV file — there is no live API connection to pull real-time updates.

Solution: Re-export the progress report from Khan Academy's teacher dashboard and re-import the CSV into Retool Database. For the re-import, use a DELETE FROM khan_progress WHERE class_name = '...' statement first to clear old data for that class, then re-import. Or use the upsert pattern described in Step 5 to merge updates without deleting existing records. Add a 'last_imported' metadata display to your Retool app so teachers can see when the data was last refreshed.

typescript
1-- Upsert pattern: update on conflict for data refresh
2INSERT INTO khan_progress (student_id, exercise_name, class_name, mastery_level, correct_count, last_activity)
3VALUES ({{ row.student_id }}, {{ row.exercise_name }}, {{ row.class_name }}, {{ row.mastery_level }}, {{ row.correct_count }}, {{ row.last_activity }})
4ON CONFLICT (student_id, exercise_name, class_name)
5DO UPDATE SET
6 mastery_level = EXCLUDED.mastery_level,
7 correct_count = EXCLUDED.correct_count,
8 last_activity = EXCLUDED.last_activity,
9 imported_at = CURRENT_TIMESTAMP;

SQL query throws 'column does not exist' error for columns in the CSV

Cause: Khan Academy CSV export column names may contain spaces, special characters, or capitalization that differs from the column names created during Retool Database import. PostgreSQL is case-sensitive for quoted identifiers.

Solution: In Retool Database, open the table and inspect the actual column names — they may have been sanitized during import (spaces replaced with underscores, lowercase forced). Update your SQL queries to use the exact column names shown in the table schema. If column names are problematic, rename them using ALTER TABLE khan_progress RENAME COLUMN 'old name' TO new_name in the Retool Database SQL editor.

Best practices

  • Document the Khan Academy CSV export column names and maintain a consistent schema version in Retool Database — when Khan Academy updates their export format, update your table schema to match before re-importing
  • Add a 'data_as_of' or 'imported_at' column to your Retool dashboard UI so teachers and managers always know the date of the underlying data and can request a fresh export if needed
  • Use upsert (INSERT ... ON CONFLICT DO UPDATE) rather than delete-and-re-insert when refreshing Khan Academy data to preserve the import history and enable trend analysis across multiple export snapshots
  • Combine Khan Academy progress data with student roster data from your SIS (Student Information System) in a JOIN to display student names and grade levels instead of just email addresses — this makes the dashboard usable for non-technical teachers
  • Build role-based access controls in Retool so teachers can only see their own class's data, while administrators can see all classes — use Retool's Groups and Permissions settings to restrict app access and add WHERE class_name IN ('{{ retoolContext.currentUser.groups }}') filters
  • Cache summary/aggregation queries (class averages, mastery distribution counts) for 5-10 minutes since they are computationally expensive and change only when new data is imported, not between user interactions
  • Use Retool Workflows for automated alerting — schedule a weekly Workflow that queries for students whose average mastery score has declined below a threshold and sends an alert email to the teacher with the at-risk student list

Alternatives

Frequently asked questions

Is Khan Academy's API still available?

Khan Academy's public REST API (api.khanacademy.org) was officially deprecated and shut down. New integrations cannot use the old public API endpoints. For organizations with Khan Academy for Schools district partnerships, a separate district data API may be available through Khan Academy's enterprise team — contact your Khan Academy account manager to request access. For all other use cases, the CSV export approach described in this guide is the primary integration path.

How do I get student names instead of email addresses in my Retool dashboard?

Khan Academy CSV exports may include student email addresses or anonymized IDs depending on your organization's privacy settings. If your school uses a Student Information System (SIS) like PowerSchool or Infinite Campus, connect Retool to your SIS database or API as a second Resource and JOIN the student records to the khan_progress table on the email or student ID field. Retool's ability to combine data from multiple Resources is ideal for this enrichment pattern.

Can I track which specific exercises students need help with?

Yes. The Khan Academy CSV export includes exercise-level mastery data with a mastery_level per exercise. In your SQL query, filter for rows where mastery_level is 'Not Started' or 'Attempted' (mastery score 0 or 1) to identify exercises where students are struggling. GROUP BY exercise_name and COUNT(student_id) to find exercises with the most struggling students — these are intervention priorities for teachers.

How often should I re-import Khan Academy data?

For active classes, weekly re-imports provide a reasonable balance between data freshness and administrative overhead. For summative reporting periods (quarter end, semester end), re-import before generating final reports. For ongoing monitoring of at-risk students, consider setting up email or Slack alerts via a Retool Workflow that queries the most recently imported data and flags students whose mastery scores have not improved since the previous import.

Can I combine Khan Academy data with other learning tools in the same Retool dashboard?

Yes, this is one of Retool's strongest use cases. Import data from Khan Academy, your LMS (Canvas, Moodle, Schoology), and reading platforms into separate tables in Retool Database or PostgreSQL. Write JOIN queries across these tables to build a unified student progress dashboard that shows performance across all learning platforms in a single view — something none of the individual platforms can do natively.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.