The Compiler API

The Compiler API runs code on our machines and returns the result to yours. You send a program, we run it, you get the output back.

Your product keeps its own interface, its own data and its own logic. What you hand over is the part that is hard to do safely: running code somebody else wrote.

Two ways to call it

  • REST

    One request, one response with the final output. Simple to call, simple to reason about.

    Good for grading, fixed input, and anything where you want the result.

  • WebSocket

    A connection that streams output as it appears, and lets your user answer a program while it runs.

    Good for terminals, interactive exercises, and programs that ask questions.

Start with REST. Most products need nothing else, and the socket builds on the same request.

What it costs

Only running your code costs credits, and one run is one credit. Checking your usage is free, and you are charged only when we actually ran something.

Opening a WebSocket connection, uploading a multi-file project, and giving your code internet access each add one credit. Credits reset daily.

The credits and pricing page has the detail, including what each plan includes.

Getting started

The free plan gives you credits every day, which is enough to work through this documentation.

For higher volumes, the pricing page lists what each API plan includes.

What next

One REST request runs a program, and it is the foundation for everything else here.

This website uses cookies to ensure you get the best experience on our website.