Overview
The API provides four main endpoints which you can utilize to execute DSA coding labs over Fermion API.Request DSA code execution
Submit a single code execution request.
Get DSA code execution result
Retrieve the result of a single code execution.
Request DSA code execution [batch]
Submit multiple code execution requests in one batch.
Get DSA code execution result [batch]
Retrieve results of multiple code executions submitted in a batch.
Prerequisites
Before you begin using the DSA Execution API, make sure you’ve set up the following essential components.Fermion API Key
Fermion API Key
You must have a valid Fermion API key to run these coding labs. Create a Fermion account and go to Settings → API access in your instructor dashboard to get the key.
Learn how to get your API key here.
Learn how to get your API key here.
Base64URL Encoded source code
Base64URL encoding is critical for proper API usage.The DSA execution API requires Base64URL encoding (not standard Base64) for several fields including source code, expected output, stdin input, and file attachments for SQL labs. Base64URL encoding is a URL-safe variant of the standard Base64 format. It’s designed to ensure that encoded data can be safely transmitted in URLs, JSON, and APIs without introducing reserved or invalid characters. Base64URL encoding is a URL-safe variant of Base64 that:
- Replaces
+with-(dash) - Replaces
/with_(underscore) - Removes padding
=characters - Ensures the encoded string is safe for use in URLs and JSON
Supported languages
Fermion currently supports the following runtimes for code execution:C / C++
Java
Python
Node.js (JavaScript)
SQLite / MySQL 8
Go (1.19)
Rust (1.87)
.NET 8
How to execute IO/DSA labs over API?
You can utilize the following steps to execute DSA over API. If you wish to test how a request is structured for any given language, head over to the compile API section of this documentation to learn more.
1
Submit code for execution
Use the Request DSA code execution [batch] endpoint to submit one or more code executions.For detailed API specification, request/response schemas, and interactive examples, see the official API documentation: Request DSA code execution [batch]Here is an empty sample request body for executing C code over API. Head over to the runConfig documentation to know more about each fieldThe API returns an array of task IDs in the same order of challenges that you submitted, that you can use to retrieve results later.
2
Retrieve execution results
Use the Get DSA code execution result [batch] endpoint to retrieve results of submitted executions. You will have to pass the Fermion API key so that we can authenticate your requestHere’s a sample cURL request to get the execution results of the task IDs returned from the previous endpointFor detailed API specification, request/response schemas, and interactive examples, see the official API documentation: Get DSA code execution result [batch]
Request DSA code execution
The request to the Request DSA code execution endpoint contains a language field, runConfig object, source code as base64URL encoded, and additional files if we are executing SQL over API Here is a description of these fields to be provided while sending a request.Run Configuration (runConfig)
The runConfig object defines execution parameters and resource limits for each code run. These settings control performance, safety, and sandbox behavior during code execution.Required Fields
The following fields must be Base64URL encoded and sent as part of the request body:
The response from this API provides us with
taskId which we can use to get the result from the Get DSA code execution result endpoint
Get DSA code execution result
After we have received thetaskId from the previous endpoint, we can send this task ID to the Get DSA code execution result and get the execution result. The API returns a taskUniqueId, language and the runConfig provided at the time of request. Apart from this, the response has codingTaskStatus which tells us if the code has been executed or not, a runResult object which tells us about the execution of the code.
codingTaskStatus Values
Each submitted coding task in Fermion’s DSA execution API has acodingTaskStatus that indicates its current stage of processing. The codingTaskStatus can have the following values:
runResult object
The runResult object contains information regarding the execution of the code and the program data after the code execution. The following fields are part of the runResult object.runStatus Values
TherunStatus field inside runResult provides detailed feedback about the outcome of code execution. The runStatus field can have the following values:
This was an example flow for single DSA code execution request. The same flow can be followed for batch execution of codes using the batch endpoints.
Using webhook URLs for instant results (recommended)
Instead of polling for results, it’s recommended to use thecallbackUrlOnExecutionCompletion parameter in your runConfig. This
webhook URL will receive a POST request with the execution results immediately when processing completes, eliminating the need for repeated
polling and providing faster response times.
The Compile API allows you to execute arbitrary code in a secure, sandboxed environment directly through Fermion’s backend. This is ideal for online coding exercises, testing snippets, or building coding playgrounds on your platform. You can send a POST request with your source code and configuration details, and the API returns the program’s output, error messages, and execution metadata, right inside your instructor dashboard.
Before you start, make sure Coding labs are enabled under Manage Features in your instructor dashboard. Learn how to enable features at Fermion here
How does compile API work?
We discussed how we can execute DSA / IO codes over API in the previous sections. You can test how a request body would look like right inside your Fermion instructor dashboard with the help of the following steps. You can access compile API tab directly inside your instructor dashboard by heading over to Coding labs → Compile API.
Select the language you want to test the compile API for. After accessing this section, you will be presented with the following two panes:
Write and Run Code
On the left side, you can write and edit your source code in the built-in editor using any of the supported languages.
Simply choose the language from the dropdown and click Run code to execute it securely in Fermion’s sandboxed environment.
API Preview
On the right side, you can view the automatically generated cURL request: showing exactly how to call the Fermion Compile API programmatically. As you can see the source code is Base64URL encoded inside the request body.
After clicking Run code, you will see the execution results, including status, timing, memory usage, and program output. Example:
Industry Pricing Comparison
Fermion offers the best infrastructure and extremely competitive prices compared to industry standards. For example, consider Judge0’s pricing on RapidAPI vs Fermion’s base plan pricing.Planning to execute more than 1 million runs per month? Contact our
team at support@codedamn.com for special enterprise pricing and higher rate limits.
- Better Performance: Optimized specifically for DSA problems
- Batch Operations: Execute multiple problems in a single API call
- Enterprise Support: Dedicated support for high-volume users
- Competitive Pricing: Better rates for volume usage
Fermion’s DSA execution API is a production-ready, enterprise-grade
replacement for Judge0 with better performance, reliability, and pricing.
