Skip to content
RelayDocumentation

GuidesGet started

Quickstart

Send your first event and receive it on a test endpoint in under five minutes.

This guide takes you from zero to a delivered, signed webhook. You'll need a Relay account and Node.js 20 or newer.

Get an API key

In the dashboard, open Settings → API keys and create a key. Keys that start with rk_test_ only work in test mode, so they are safe to use while you build.

.env
RELAY_API_KEY=rk_test_51Hx9a2f7c1d

Never commit API keys or expose them in client-side code. Read them from an environment variable on your server.

Install the SDK

npm install @relay/sdk

Create a test endpoint

Every account has a built-in inspector you can use as a first endpoint. Create one and subscribe it to all event types:

setup.ts
import { Relay } from "@relay/sdk";
 
const relay = new Relay(process.env.RELAY_API_KEY);
 
const endpoint = await relay.endpoints.create({
  url: "https://inspect.relay.dev/acme-test",
  events: ["*"],
  description: "Quickstart inspector",
});
 
console.log(endpoint.id); // ep_2kq8XcV1

Send an event

Send an event with a type and any JSON payload. Relay responds right away and delivers in the background.

send.ts
import { Relay } from "@relay/sdk";
 
const relay = new Relay(process.env.RELAY_API_KEY);
const event = await relay.events.send({
  type: "invoice.paid",
  data: { invoice_id: "in_1042", amount: 4900, currency: "usd" },
  idempotencyKey: "invoice-1042-paid",
});
 
console.log(event.status); // "queued"

Check the delivery

Open the inspector URL or Events in the dashboard. You'll see the request Relay sent, its headers and the response. Each delivery has a Relay-Signature header: the next step is to verify it in your own endpoint.

Next steps