API Documentation
Integrate world-class coding education into your platform. The Efiwe Open API enables schools, bootcamps, and developers to deliver interactive coding challenges with AI-powered feedback, directly within their platforms!
https://efiwe.com/api/api.php No API key needed for the default limit of 60 requests per minute per IP.
Need more? Purchase an API key for higher limits.
Quick Start Guide
Option 1: Use Our SDK (Recommended for Most Use Cases)
The easiest way to integrate Efiwe is using our JavaScript SDK, which handles UI, offline caching, and user progress tracking.
Step 1: Add the SDK to your webpage
<script src="https://efiwe.com/api/sdk.js"></script> Step 2: Add a container for challenges
<div id="efiwe-challenge"></div> Step 3: Initialize with one line of JavaScript
Display a single challenge. This example shows Challenge 1 from our HTML program.
<script>
EfiweSDK.renderChallenge('efiwe-challenge', 'html', 1);
</script> - Change
'html'to'css','js','tailwind','py','sql','php', or'prompt'to load a challenge from our CSS, JavaScript, Tailwind, Python, SQL, PHP, or Prompt Engineering program. - Change
'1'to any other number to display a different challenge. - Our HTML program has a maximum of 191 challenges.
- Our CSS program has a maximum of 298 challenges.
- Our JavaScript program has a maximum of 488 challenges.
- Our Tailwind program has a maximum of 154 challenges.
- Our Python program has a maximum of 420 challenges.
- Our SQL program has a maximum of 251 challenges.
- Our PHP program has a maximum of 435 challenges.
- Our Prompt Engineering program has a maximum of 200 challenges.
Or display a range of challenges with navigation. This example shows challenges 1 to 50 from our HTML program, with navigation at the bottom.
<script>
EfiweSDK.renderChallengeList('efiwe-challenge', 'html', '1-50');
</script> View a live sample of this range rendered on a webpage to see how it looks in action.
- Change
'html'to'css','js','tailwind','py','sql','php', or'prompt'to load challenges from our CSS, JavaScript, Tailwind, Python, SQL, PHP, or Prompt Engineering program. - Change
'1-50'to any other range to display a different set of challenges. For example,'51-100'shows challenges 51 to 100. - Change
'1-50'to'-80'to display challenges 1 to 80. - Change
'1-50'to'50-'to display challenges from 50 to the last available challenge. - Remove the range parameter entirely to display all challenges in the program. For example:
EfiweSDK.renderChallengeList('efiwe-challenge', 'html'); - Pass a number instead of a range to start at a specific challenge:
EfiweSDK.renderChallengeList('efiwe-challenge', 'html', 25);
That's it! Right on your platform, your users now have access to interactive coding challenges with:
- Real-time code editor with syntax highlighting
- AI-powered hints and Find My Mistake
- Easy words or Normal words, and Auto difficulty that changes with the learner
- How I learn: Step by step, Skip as I go, or Pick my own
- A starting check and a final check that show how much learners grew
- Progress tracking in browser storage
Option 2: Direct API Integration (For Custom Implementations)
If you need more control or want to build your own UI, you can call the API directly.
Fetch a specific challenge:
// This fetches Challenge 1 from our HTML program. Update the program shortcode and challenge number as needed.
const response = await fetch('https://efiwe.com/api/api.php/api/html/challenge/1');
const challenge = await response.json();
console.log(challenge);
// Returns:
// {
// id: 1,
// topic: "Document Type Declaration",
// difficulty: "easy",
// introduction: "<p>HTML stands for HyperText Markup Language, and it's the fundamental building block of every website on the internet...",
// description: "Using the code example above, write the...",
// hints: ["Start with <!DOCTYPE and end with >."],
// explanation: "The doctype declaration tells the browser what type of document to expect."
// } Validate user's code:
// Sample user code submission
const userCode = '<p>Hello World</p>';
// Update the program shortcode as needed.
const response = await fetch('https://efiwe.com/api/api.php/api/html/validate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: 1, code: userCode, mode: 'default' })
});
const result = await response.json();
// Returns:
// {
// correct: true,
// feedback: "Great job!",
// diagnostics: []
// } List all challenges (for building navigation):
// Update the program shortcode as needed.
const response = await fetch('https://efiwe.com/api/api.php/api/html/challenges');
const challenges = await response.json();
// Returns array of all challenges without solutions
// Use this to build custom challenge selectors or progress trackers API Endpoints
The Efiwe API provides endpoints for accessing coding challenges, validating submissions, reading levels, Auto difficulty, and the starting and final checks:
GET: /api/{type}/challenges
Description: Retrieve challenges for a specific program. You can fetch all challenges or specify a range.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt
Endpoint Variations:
/api/html/challenges- All challenges/api/html/challenges/1-50- Challenges 1 to 50/api/html/challenges/51-- Challenge 51 to the last challenge/api/html/challenges/-50- First challenge to challenge 50
Examples:
// Fetch all HTML challenges
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges'
);
const allChallenges = await response.json();
// Fetch challenges 1-50 only
const rangeResponse = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges/1-50'
);
const challenges1to50 = await rangeResponse.json();
// Fetch from challenge 51 to the end
const fromResponse = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges/51-'
);
const challenges51toEnd = await fromResponse.json();
// Fetch first 50 challenges
const toResponse = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges/-50'
);
const firstFifty = await toResponse.json(); GET: /api/{type}/challenge/{id}
Description: Get a specific challenge by ID. Perfect for displaying individual challenges.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt{id}- Challenge ID (integer)
Optional query parameters (also accepted by /api/{type}/challenges):
reading_level-simple(Easy words: short sentences and everyday words) orstandard(Normal words, the default). Only the words change: the code, task, answer and grading are the same. The response'sreading_levelfield says which version was served, so a course without Easy words falls back safely.learner- A stable, non-personal id for the learner (a hash, never a phone number or email). With it, Auto difficulty can show fewer hints to a learner who is doing well, and the response includes anadaptiveobject.mode- The learner's difficulty mode (see validate below).fields- Comma-separated fields to return, e.g.fields=id,topic,difficulty_labelfor a lightweight list.
Example:
// Fetches Challenge 1 in our HTML program.
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/challenge/1'
);
const challenge = await response.json();
console.log(challenge);
// Returns:
// {
// id: 1,
// topic: "Document Type Declaration",
// difficulty: "easy",
// difficulty_label: "Easy", // Easy, Medium or Hard
// introduction: "<p>HTML stands for HyperText Markup Language, and it's the fundamental building block of every website on the internet...",
// description: "Using the code example above, write the...",
// hints: ["Start with <!DOCTYPE and end with >."],
// explanation: "The doctype declaration tells the browser what type of document to expect.",
// reading_level: "standard", // or "simple" (Easy words)
// unit: { n: 1, id: "HTML-01", name: "Page basics" } // the topic it belongs to
// } Program completion: Requesting an {id} past the last challenge in a program (e.g. asking for challenge 192 in a 191-challenge program) does not return a 404. It returns an HTTP 200 with a completed response instead, so it's easy to detect and show a "program finished" message rather than a generic error:
// Fetches HTML Challenge 192, which is past the last challenge (191).
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/challenge/192'
);
const challenge = await response.json();
console.log(challenge);
// Returns:
// {
// completed: true,
// type: "html",
// total: 191,
// message: "You have finished the HTML program! You completed all 191 challenges. Congratulations! 🎉",
// endline_available: true // offer the final check now
// } POST: /api/{type}/validate
Description: Validate user's code submission. Returns Efiwe 1.5 AI-powered diagnostics and feedback. The mode parameter sets how strictly code is checked. Learners see these names: default is Auto (changes with you), easy is Easy (70%), intermediate is Medium (80%), difficult is Hard (90%) and master is Very hard (100%).
Auto difficulty (default) moves in both directions. Every learner starts with answers needing a full match. A learner who struggles (several misses in a row, or four misses on one challenge) gets a lower pass mark, down to 70%. A learner who keeps solving challenges on the first try, without hints, gets harder: the pass mark stays at 100% and fewer built-in hints are shown (two, then one). It rises slowly and falls quickly, and the adaptive.note field says when it changes. Send learner_id so this follows the learner rather than their IP address.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt
Request Body:
// Sample user code submission
{
"id": 1,
"code": "<p>Hello World</p>",
"mode": "default",
"learner_id": "a1b2c3", // optional: a stable, non-personal id
"reading_level": "simple", // optional: "simple" (Easy words) or "standard"
"hint_used": false, // optional: true if you showed a built-in hint
"record": true // optional: false when you only want the diagnostics (Find My Mistake)
} Example:
// Update the program shortcode as needed.
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/validate',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 1,
code: '<p>Hello World</p>',
mode: 'default'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// correct: true,
// feedback: "Great job!",
// diagnostics: [],
// mode: "default",
// mode_label: "Auto (changes with you)",
// adaptive: {
// band: 2, // -2 (most help) to 3 (least help); everyone starts at 1
// pass_mark: 100,
// hints_allowed: 2, // null means all hints
// changed: "up", // "up", "down" or null
// note: "You are getting the hang of this, so you will see fewer hints for now...",
// attempts: 0 // misses on this challenge before this answer
// }
// } Prompt Engineering (prompt)
In this program the learner writes a prompt, not code. Send the prompt as code. It gets a score out of 100 from the same checklist our course page uses, and the difficulty sets the pass mark (Easy 70, Medium 80, Hard 90, Very hard 100, Auto moves with the learner). A prompt written in another language is translated and checked too. A prompt that tells the AI not to do the task scores 0.
With a valid API key, our AI also grades the prompt. It can raise the score by at most 25 points, never past what the checklist allows when something required is missing. Send "ai_grading": false to use the checklist only. Without an API key, the checklist alone decides.
// POST /api/prompt/validate
// { id: 1, code: "Write a Python function that adds up a list of numbers.", mode: "easy" }
// Returns the usual fields, plus:
// {
// score: 82, // 0-100
// pass_mark: 70,
// strengths: ["Language", "Task"],
// still_needed: [{ issue: "Input: Your prompt doesn't specify what goes into the function.", solution: "..." }],
// requirements_met: "2 of 3 requirements met",
// commentary: null, // a short note from the AI, when it graded
// grading: "offline" // "offline", "online", "online-bounded", "online+required", ...
// } Challenges in this program have "answer_type": "prompt". ai-hint, ai-feedback and ai-diagnose work the same way, and when the AI is not available they answer from the checklist instead of failing.
POST: /api/{type}/ai-feedback
Description: Get Efiwe 2.0 AI-powered feedback on user's code submission. Provides a short sentence of analysis. If this cloud-based AI is unavailable, it falls back to Efiwe 1.5 (offline AI) responses. Responses are limited to 15 words maximum.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt
Request Body:
{
"id": 1,
"code": "<p>Hello World</p>"
} Example:
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/ai-feedback',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 1,
code: '<p>Hello World</p>'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// feedback: "Correct! Your paragraph tag is properly opened and closed."
// } POST: /api/{type}/ai-hint
Description: Request Efiwe 2.0 AI-generated hints for a specific challenge. Provides a short sentence of guidance. If this cloud-based AI is unavailable, it falls back to Efiwe 1.5 (offline AI) hints. Responses are limited to 15 words maximum.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt
Request Body:
{
"id": 1,
"code": "<p Hello World</p>"
} Example:
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/ai-hint',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 1,
code: '<p Hello World</p>'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// hint: "Remember that HTML tags need opening and closing brackets."
// } POST: /api/{type}/ai-diagnose
Description: Powers Find My Mistake (formerly Diagnose Issue). Get Efiwe 2.0 AI-powered diagnostics for incorrect code submissions. Returns an array of issues with solutions. If this cloud-based AI is unavailable, it falls back to Efiwe 1.5 (offline AI) diagnostics: call /validate with "record": false so the lookup is not counted as another try. Send reading_level: "simple" on any ai-* endpoint to get the answer in Easy words.
Parameters:
{type}- Challenge type:html,css,js,tailwind,py,sql,php, orprompt
Request Body:
{
"id": 1,
"code": "<p>Hello World"
} Example:
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/ai-diagnose',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 1,
code: '<p>Hello World'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// diagnostics: [
// {
// issue: "Missing closing tag",
// solution: "Add </p> to close the paragraph tag"
// }
// ]
// } POST: /api/translate
Description: Translate one or more text strings (plain text or HTML fragments) into any supported language. Protected zones such as <code>, <pre>, <script>, <style>, <kbd>, <var>, and <samp>, as well as any element with translate="no" or class="notranslate", are left untouched. When the target language is en, the original texts are returned as-is with no translation call made.
Request Body:
{
"texts": ["Hello", "World"],
"target": "fr"
} Body Parameters:
texts(required) — Array of strings to translate. Each item may be plain text or an HTML fragment.target(required) — BCP 47 language code for the target language (e.g.fr,es,yo). Passento skip translation and receive the original texts back.
Example (plain text):
const response = await fetch(
'https://efiwe.com/api/api.php/api/translate',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
texts: ['Hello', 'World'],
target: 'fr'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// translations: ["Bonjour", "Monde"]
// } Example (HTML fragments):
const response = await fetch(
'https://efiwe.com/api/api.php/api/translate',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
texts: ['<p>Write a <code translate="no"><h1></code> tag.</p>'],
target: 'es'
})
}
);
const result = await response.json();
console.log(result);
// Returns:
// {
// translations: ["<p>Escribe una etiqueta <code translate=\"no\"><h1></code>.</p>"]
// }
// Note: content inside <code translate="no"> is preserved verbatim. GET: /api/{type}/reading-levels
Description: Which reading levels a course offers. Every challenge can come in Easy words (simple) and Normal words (standard). Pass reading_level on the challenge endpoints to choose.
// Returns:
// {
// type: "html",
// default: "standard",
// levels: [
// { id: "simple", name: "Easy words", available: true, description: "..." },
// { id: "standard", name: "Normal words", available: true, description: "..." }
// ]
// } GET: /api/{type}/adaptive?learner={id}
Description: Where Auto difficulty has this learner now, in the same shape as the adaptive object returned by validate.
GET: /api/{type}/assessment/baseline and /api/{type}/assessment/endline
Description: The 12 questions of the starting check (baseline) or the final check (endline). Each has four options plus "I don't know yet" (send -1). Answers are not included. There is no pass mark: the checks measure, they do not test. Use no lives for them.
// Returns:
// {
// stage: "baseline",
// title: "Starting check",
// count: 12,
// dont_know: { value: -1, label: "I don't know yet" },
// items: [
// { id: "HTML-B01", difficulty: "easy", difficulty_label: "Easy",
// question: "Which line must come first in an HTML5 document?",
// code: null, options: ["<!DOCTYPE html>", "<html>", "<body>", "<head>"] },
// ...
// ]
// } POST: /api/{type}/assessment/baseline
Description: Scores the starting check and gives the learner's starting point: New to HTML, Know some HTML or Know a lot of HTML. It is based on the Easy, Medium and Hard questions scored separately, not one total. known_challenges lists the challenges below the starting point, which you can pass over (anyone can still do them). Offer it only to learners who have not started the course: a check taken after learning cannot measure a starting point.
// Request body: answers in question order (0-3, or -1 for "I don't know yet")
{ "learner_id": "a1b2c3", "answers": [0, 0, 2, -1, 1, 3, 0, 2, 1, 0, -1, 3] }
// Returns:
// {
// score: 9, total: 12,
// by_difficulty: { easy: { correct: 4, total: 4 }, medium: { correct: 4, total: 5 }, hard: { correct: 1, total: 3 } },
// starting_point: {
// level: "Intermediate", name: "Know some HTML",
// known_difficulty: ["Easy"], known_challenges: [1, 2, 3, ...], known_count: 58,
// accepted: true
// },
// saved: true
// } POST: /api/{type}/assessment/starting-point
Description: Saves the learner's choice: { "learner_id": "...", "accepted": true } leaves out the challenges they already know, false keeps every challenge.
POST: /api/{type}/assessment/endline
Description: Scores the final check, compares it with the starting check, and returns a review of what the learner got wrong. Offer it before any capstone or certificate. With learner_id the saved starting check is used; otherwise send baseline_score.
// Returns:
// {
// score: 11, total: 12, baseline_score: 6,
// gain: { raw: 5, normalized: 0.83 }, // share of the gap to full marks closed
// review: [{ id: "HTML-E07", question: "...", options: [...], choice: -1, answer: 2, explanation: "..." }],
// saved: true
// } GET: /api/{type}/assessment?learner={id}
Description: A learner's saved results: baseline, starting_point and endline, plus which checks the course has (available).
API Keys & Rate Limits
Default Rate Limits
By default, our API allows 60 requests per minute per IP address. This is sufficient for most educational use cases, but if you need higher limits, you can purchase an API key.
Purchasing an API Key
API keys unlock higher rate limits based on your selected package. For example, a 500 request/minute package allows 500 requests per minute from your IP address.
Contact us at developer@efiwe.com to discuss API key packages that fit your needs.
Using Your API Key
With Direct API Calls:
Append your API key as a query parameter to any endpoint:
// Fetch challenges with API key
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges?api_key=YOUR-KEY-HERE'
);
// Validate with API key
const validateResponse = await fetch(
'https://efiwe.com/api/api.php/api/html/validate?api_key=YOUR-KEY-HERE',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: 1, code: '<!DOCTYPE html>' })
}
); With the SDK:
Set your API key once before rendering any challenges:
<script src="https://efiwe.com/api/sdk.js"></script>
<script>
// Set your API key first
EfiweSDK.config.apiKey = 'YOUR-KEY-HERE';
// Now render challenges - all API calls will use your key
EfiweSDK.renderChallengeList('efiwe-challenge', 'html', '1-50');
</script> Checking Rate Limit Status
Rate limit information is not returned in response headers. If you exceed the limit, you'll receive a 429 status with error message: {'error': 'Rate limit exceeded. Try again later.'}.
Important: Keep your API key secure. Never expose it in client-side code for public websites. For production use, proxy API calls through your backend server.
Advanced SDK Features
SDK Configuration
// Set API key for higher rate limits
EfiweSDK.config.apiKey = 'YOUR-KEY-HERE';
// Optionally override the API base URL
EfiweSDK.apiBase = 'https://your-custom-api.com/api.php';
// Remove the "Powered by Efiwe" line under the challenges
EfiweSDK.config.showPoweredBy = false;
// Your own id for the learner (or a hash of it), so Auto difficulty and
// the starting and final checks follow them across devices
EfiweSDK.config.learnerId = 'student-4821';
// Fix the reading level: 'simple' (Easy words) or 'standard' (Normal words).
// Leave it out to let learners choose in How I learn.
EfiweSDK.config.readingLevel = 'simple'; How I learn
renderChallengeList shows a How I learn button beside the language picker. New learners first see a short start screen: they choose a reading level (Easy words or Normal words), can take the 12-question starting check (or skip it for now), and choose how they move through the challenges:
- Step by step - every challenge, in order. Next opens once the current challenge is done.
- Skip as I go - the same order, with a Skip button. Skipped challenges are recorded, and solving one later counts it as completed.
- Pick my own - the learner sees every challenge title, searches and ticks the ones they want, and sees only those. After three misses or four minutes on one, a "Remove from my list" button appears.
Switching never costs progress. Challenges below an accepted starting point are passed over in every mode. When a course is finished, learners are offered the final check and see both scores and a review of what they got wrong.
// All optional:
EfiweSDK.config.howILearn = false; // old behaviour: free Previous/Next, no start screen
EfiweSDK.config.defaultLearningMode = 'skip'; // 'step' (default), 'skip' or 'pick'
EfiweSDK.config.startingCheck = false; // don't offer the starting check
EfiweSDK.config.finalCheck = false; // don't offer the final check
// Read or change the learner's choices yourself
EfiweSDK.setReadingLevel('simple');
EfiweSDK.setLearningMode('html', 'pick');
EfiweSDK.getSkipped('html'); // [4, 9]
EfiweSDK.getPicked('html'); // [1, 2, 3, 12]
EfiweSDK.getAssessment('html'); // { baseline, starting_point, endline }
// Run a check in any element
EfiweSDK.runCheck(document.getElementById('box'), 'html', 'baseline', result => { /* ... */ }); Managing User Progress
// Check if a challenge is completed
const isCompleted = EfiweSDK.isCompleted('html', 5);
// Get user's submitted answer
const userAnswer = EfiweSDK.getAnswer('html', 5);
// Find next unanswered challenge in the full program
const nextChallenge = EfiweSDK.findFirstUnanswered('html');
// Note: Uses maxChallenges configuration for program limits
// Find next in range
const nextInRange = EfiweSDK.findFirstUnansweredInRange('html', 10, 50);
// Get all completed challenges
const completed = EfiweSDK.getCompleted('html');
// Returns:
// {
// 1: "<p>Hello</p>",
// 2: "<h1>Title</h1>", ...
// } Using Your Own Custom Challenges
Want to use your own challenges instead of Efiwe's curated library? You can host your own challenge JSON file and point the SDK to it. Validation uses Efiwe's API endpoint and requires the 'solution' field in your JSON for comparison. If the JSON structure doesn't match (missing required fields like id, topic, difficulty, introduction, description, hints, solution), the SDK will fail to load challenges. Custom JSON must be publicly accessible via HTTPS with CORS enabled.
Custom JSON is not available for Prompt Engineering ('prompt'): those challenges are marked against a checklist that only Efiwe's library has, so the SDK shows a message instead of loading your file. Use Efiwe's Prompt Engineering challenges.
Challenge JSON Format (all fields required):
[
{
"id": 1,
"topic": "Your First Tag",
"difficulty": "easy", // Valid values: easy, intermediate, advanced
"introduction": "<p>Welcome to your first challenge!</p>", // Max 1000 chars recommended
"description": "<p>Write a paragraph tag with the text 'Hello World'.</p>", // Max 1000 chars
"hints": [
"Start with <p>",
"End with </p>"
], // Array of strings, max 5 hints
"solution": "<p>Hello World</p>", // Required for validation
"explanation": "<p>The <p> tag defines a paragraph in HTML.</p>" // Max 500 chars
},
{
"id": 2,
"topic": "Heading Tags",
"difficulty": "easy",
// ... more challenges
}
] Loading Custom Challenges:
<div id="custom-challenges"></div>
<script src="https://efiwe.com/api/sdk.js"></script>
<script>
// Parameters: (containerId, type, range, showNavigation, customJsonUrl)
EfiweSDK.renderChallengeList(
'custom-challenges',
'html', // Challenge type
'1-90', // Range: display challenges 1-90
true, // Show navigation (true/false)
'https://example.com/my-challenges.json' // URL to your JSON file
);
</script> Without Navigation:
<script>
// Display challenges 1-50 without Previous/Next buttons
EfiweSDK.renderChallengeList(
'custom-challenges',
'html',
'1-50',
false // Hide navigation
);
</script> Requirements for Custom Challenges:
- JSON file must be publicly accessible via HTTPS
- CORS must be enabled on your server
- All challenges must have unique sequential IDs
- The
solutionfield is required for validation to work - When using custom challenges, validation still uses Efiwe's API endpoint (applies to rate limits)
Customizing the Interface
The SDK applies default styles, but you can override them with your own. If your custom styles are not taking effect, it is likely due to CSS specificity conflicts with the default Efiwe styles. In such cases, use !important or more specific selectors to ensure your styles are applied.
/* Override Efiwe's default styles in your CSS */
.efiwe-container {
font-family: 'Your Custom Font', sans-serif;
max-width: 1200px;
background: #f9f9f9;
}
.efiwe-container button#submitCode {
background: #your-brand-color;
}
/* Customize the code editor appearance */
.CodeMirror {
font-size: 16px;
height: 400px !important;
} Disabling Features
After SDK loads, you can hide specific buttons. Once applied, normal JavaScript toggling will not work unless !important is removed.
document
.getElementById('readAloud')
.style.setProperty('display', 'none', 'important');
document
.getElementById('showHints')
.style.setProperty('display', 'none', 'important');
// Find My Mistake keeps its old element id
document
.getElementById('diagnoseIssue')
.style.setProperty('display', 'none', 'important');
Understanding Rate Limits
Our API allows 60 requests per minute per IP address by default. Here's how to work within these limits:
Best Practices:
// GOOD: Fetch all challenges once and cache them
const allChallenges = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges'
).then(r => r.json());
// Then use the cached data
localStorage.setItem('html_challenges', JSON.stringify(allChallenges));
// GOOD: Use range endpoints to fetch only what you need
const response = await fetch(
'https://efiwe.com/api/api.php/api/html/challenges/1-50'
);
// GOOD: The SDK handles caching automatically
EfiweSDK.renderChallengeList('container', 'html', '1-50'); Avoid:
// BAD: Fetching challenges one by one in a loop
for (let i = 1; i <= 191; i++) { // 191 = max HTML challenges; adjust per program
await fetch(`https://efiwe.com/api/api.php/api/html/challenge/${i}`);
// This will will hit rate limits!
}
// BAD: Making unnecessary repeated requests
setInterval(() => {
fetch('https://efiwe.com/api/api.php/api/html/challenges');
}, 1000); // Don't do this! Need Higher Limits? If 60 requests/minute isn't enough for your use case, consider purchasing an API key.
Integration Examples for Different Use Cases
For Schools: Classroom Dashboard
<!-- Create a classroom view where students work through challenges -->
<div class="classroom-header">
<h1>Period 3: Introduction to Web Development</h1>
<p>Today's lesson: HTML Basics (Challenges 1-20)</p>
</div>
<div id="student-workspace"></div>
<script src="https://efiwe.com/api/sdk.js"></script>
<script>
// Students start at first unanswered challenge in range
EfiweSDK.renderChallengeList('student-workspace', 'html', '1-20');
</script> For NGOs: Mobile-First Community Program
<!-- Optimized for smartphones with limited connectivity -->
<div id="mobile-coding-app"></div>
<script src="https://efiwe.com/api/sdk.js"></script>
<script>
// Find first incomplete challenge automatically
const startChallenge = EfiweSDK.findFirstUnanswered('html');
EfiweSDK.renderChallenge('mobile-coding-app', 'html', startChallenge);
</script> For Bootcamps: Custom Learning Platform
// Build your own UI with direct API calls
class BootcampLearningPlatform {
async loadCurriculum() {
const htmlChallenges = await this.fetchChallenges('html');
const cssChallenges = await this.fetchChallenges('css');
const jsChallenges = await this.fetchChallenges('js');
const tailwindChallenges = await this.fetchChallenges('tailwind');
const pyChallenges = await this.fetchChallenges('py');
const sqlChallenges = await this.fetchChallenges('sql');
const phpChallenges = await this.fetchChallenges('php');
return { html: htmlChallenges, css: cssChallenges, js: jsChallenges, tailwind: tailwindChallenges, py: pyChallenges, sql: sqlChallenges, php: phpChallenges };
}
async fetchChallenges(type) {
const response = await fetch(
`https://efiwe.com/api/api.php/api/${type}/challenges`
);
return response.json();
}
async validateStudentWork(type, challengeId, code) {
const response = await fetch(
`https://efiwe.com/api/api.php/api/${type}/validate`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: challengeId, code })
}
);
const result = await response.json();
// Track student progress in your database
if (result.correct) {
await this.recordCompletion(studentId, type, challengeId);
}
return result;
}
} Efiwe on Messenger, WhatsApp, Telegram & SMS
A live example of what this API makes possible
The Efiwe Open API doesn't just power websites, it powers conversations. Efiwe's Facebook Messenger, WhatsApp, Telegram, and SMS bots are built entirely on top of this API, delivering the same interactive coding and Prompt Engineering challenges, AI-powered feedback, hints, and diagnostics across messaging apps and basic SMS — no smartphone required. No app download. No signup. Just send "hi" and start learning.
Facebook Messenger
Message the Efiwe Facebook Page
Tap interactive buttons to choose your topic. Receive challenges with full introduction, code examples, and AI feedback — all inside Messenger.
Try on Messenger →Message +234 816 271 5246
Choose your topic from a native list menu. Submit code as a reply. Get instant AI feedback, hints, and diagnostics with tap-to-use action buttons.
Try on WhatsApp →Telegram
Message @EfiweLearnBot
Chat with the Efiwe bot directly in Telegram. Choose your topic, submit code, and get instant AI feedback and hints — all inside Telegram.
Try on Telegram →SMS
Text EFIWE to 34461 (MTN Nigeria)
No internet. No smartphone. Just text EFIWE to get started. Receive challenges, submit code, and get AI feedback — all over standard SMS.
Try on SMS →Built entirely on this API. All four bots use the same /api/{type}/challenge/{id}, /api/{type}/validate, /api/{type}/ai-hint, /api/{type}/ai-diagnose, and /api/translate endpoints documented on this page, plus the reading level, Auto difficulty and starting and final check endpoints. Every bot offers How I learn (Step by step, Skip as I go, Pick my own), Easy words, the two checks and Find My Mistake. They are a live proof of concept for what you can build with the Efiwe Open API.
Response Formats
Success Responses
All successful responses are in JSON format with HTTP 200 status.
// Challenge list or single challenge
[
{
"id": 1,
"topic": "Document Type Declaration",
"difficulty": "easy",
"introduction": "...",
"description": "...",
"hints": ["..."],
"explanation": "..."
},
// ...
]
// Efiwe 1.5 AI Validation
{
"correct": true,
"feedback": "Great job!",
"diagnostics": [],
"mode": "default",
"mode_label": "Auto (changes with you)",
"adaptive": { "band": 1, "pass_mark": 100, "hints_allowed": null, "changed": null, "note": null, "attempts": 0 }
}
// Efiwe 2.0 AI Feedback/Hint
{
"feedback": "One short sentence." // or "hint"
}
// Efiwe 2.0 AI Diagnose (Find My Mistake)
{
"diagnostics": [
{
"issue": "...",
"solution": "..."
}
]
}
// Program completion (GET /api/{type}/challenge/{id}, id past the last challenge)
{
"completed": true,
"type": "html",
"total": 191,
"message": "You have finished the HTML program! You completed all 191 challenges. Congratulations! 🎉"
} Error Responses
Error responses use appropriate HTTP status codes with JSON body.
// 400 Bad Request (invalid type, missing fields)
{
"error": "Invalid challenge type"
}
// 404 Not Found (invalid id, not the same as finishing a program — see "Program completion" above)
{
"error": "Challenge not found"
}
// 429 Rate Limit Exceeded
{
"error": "Rate limit exceeded. Try again later."
}
// 503 AI Unavailable
{
"error": "AI unavailable"
} HTTP Status Codes
- 200 OK: Successful request
- 400 Bad Request: Invalid parameters or missing fields
- 404 Not Found: Challenge or endpoint not found
- 429 Too Many Requests: Rate limit exceeded
- 503 Service Unavailable: AI service temporarily down
Need Help?
Looking for assistance integrating our API into your platform? Email us at the address below, and a member of our Engineering team will get in touch. We’re excited to help you join us in making coding education accessible to everyone.



or