Introducing the Inngest TypeScript / JavaScript SDK
Join our Discord
Sign up for free

HTTP-based Functions

As an alternative to deploying your function code directly to the Inngest platform, you can also use Inngest to trigger any one of your application's exisitng HTTP endpoints. This is a great way to quickly get started with some of your existing code.

How it works

Inngest will sent an HTTP POST request to the URL of your choosing with your event payload.

A diagram showing a HTTP request to a signup endpoint and a background job being dispatched via Inngest

Let's take a look at an example Next.js API endpoints that grabs the event payload JSON from the POST request body and sends an email:

export default async function handler(req, res) {
// `event` is the event payload
const { event } = req.body;
// Here's an example of using the event payload to send an email
const result = await sendEmail({
template: "welcome-email",
data: {
// The template will use this to show useful content to our new user
const messasge = result.ok ? "Successfully sent" : result.error;
res.status(result.ok ? 200 : 500).json({ message });

Any HTTP response that is a 2xx status code will be considered a success. All others will be considered a failure. The response payload will be visible as the function's result in the Inngest dashboard. We'll capture the status code, the response body and any error that we capture:

status: int
body: string
error?: string

Request headers

All requests sent from Inngest will be POST requests with the following headers:

  • Content-Type: application/json
  • User-Agent: Inngest/1.0 (+

Soon we'll be adding header(s) for authentication - want to test them early? ping us in Discord