RunKit Endpoint Build APIs without any servers

Note: This is a beta release! We may make changes as Endpoint develops.

Endpoint is a fast and simple way to write code with Node.js that can respond to HTTP requests from anywhere. There's no need to manage servers or deployments, instead just write code in RunKit. Getting started is as easy as implementing one function. Here's a simple example:

exports.endpoint = function(request, response) { response.end("Hello world!"); }

The code above is now a real running endpoint. Changes will be reflected in real time. And just like with any notebook, you can (and should!) publish permanent versions as you develop your APIs. Go ahead, try curling it:

The Details

Any RunKit document that exports a function called endpoint can serve requests. The function should have the same signature as the callback passed to server.listen in node directly. The only change here is removing the explicit server creation and port binding.

exports.endpoint = function(request, response) { // your code goes here }


Every RunKit Notebook has a main url like:

as well as specific revision URLs like:

Notebooks access through endpoint are hosted on and each user has their own subdomain. Unlike the main notebook page, which has a shorthand for accessing the latest revision, you'll just need to specifically reference /branches/master. Being explicit has an advantage; it means that not only will your notebook respond to urls like:

It also responds to any sub-paths like these:

You can use the environment variable process.env.RUNKIT_MOUNT_PATH to programatically check the base path of your endpoint, and process.env.RUNKIT_ENDPOINT_URL to get the base URL of your endpoint.



Want to build a simple API that sends/receives JSON messages, without dealing with HTTP at all? We built a simple helper for this that sets it up for you. You can see how the helper is implemented, or check out this usage example. You can also return a promise directly, or use a done callback.

var endpoint = require("@runkit/runkit/json-endpoint/1.0.0"); endpoint(exports, async function(incomingData) { var result = await doSomething(incomingData.body) return result })

Using Endpoint with Express

We've built a simple wrapper to set up a fully compatible Express app with Endpoint. Just require our wrapper instead of express, and pass in the exports object to your app constructor. You can see how the helper is implemented, or check out this usage example.

var express = require("@runkit/runkit/express-endpoint/1.0.0"); var app = express(exports); app.get("/:name", (req, res) => res.send(`hey ${}`))


Endpoint is only available over https.

Although RunKit lets you use a top level await at any time, you can't use a top level await before exporting your endpoint function.

Requests must terminate within 60 seconds. Endpoints are rate limited, and during the beta period they are restricted to non-commercial use. If you need to raise rate limits, or would like to use Endpoint commercially, just get in touch.