Source: https://dinakar-pageloop-knowledge-base.docs-staging.pageloop.ai/quickstart

# Quickstart

# Quickstart

By the end of this page you will have published an event and watched Kestrel deliver it
to an endpoint running on your laptop.

## 1. Install the SDK

#### bash

```bash npm
npm install @kestrel/sdk@2.4.0
```

#### bash

```bash pip
pip install kestrel-sdk==2.4.0
```

#### bash

```bash go
go get github.com/kestrel/kestrel-go@v2.4.0
```

## 2. Set your API key

Kestrel reads the key from `KESTREL_API_KEY` if you do not pass one explicitly.

```bash
export KESTREL_API_KEY="sk_test_4eC39HqLyjWDarjtT1zdp7dc"
```

## 3. Publish an event

#### Node

```js
import { Kestrel } from '@kestrel/sdk';

const kestrel = new Kestrel();

await kestrel.events.publish({
  type: 'invoice.paid',
  streamKey: 'customer_9f2a',
  payload: { invoiceId: 'in_1024', amountCents: 4900, currency: 'usd' },
});
```

#### Python

```python
from kestrel import Kestrel

kestrel = Kestrel()

kestrel.events.publish(
    type="invoice.paid",
    stream_key="customer_9f2a",
    payload={"invoiceId": "in_1024", "amountCents": 4900, "currency": "usd"},
)
```

#### cURL

```bash
curl https://api.kestrel.dev/v1/events \
  -H "Authorization: Bearer $KESTREL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "invoice.paid",
    "streamKey": "customer_9f2a",
    "payload": { "invoiceId": "in_1024", "amountCents": 4900, "currency": "usd" }
  }'
```

## 4. Receive it

Point a subscription at a tunnel to your laptop, then verify the signature on every request:

```js
import express from 'express';
import { verifySignature } from '@kestrel/sdk';

const app = express();

app.post('/webhooks/kestrel', express.raw({ type: 'application/json' }), (req, res) => {
  const ok = verifySignature({
    payload: req.body,
    header: req.get('X-Kestrel-Signature'),
    secret: process.env.KESTREL_SIGNING_SECRET,
  });

  if (!ok) return res.status(400).send('bad signature');

  console.log('received', JSON.parse(req.body).type);
  res.sendStatus(200);
});

app.listen(4000);
```

> [!TIP]
>
> Respond `2xx` before doing slow work. Kestrel gives your endpoint 10 seconds to respond
> before it counts the delivery as failed.

## What next

- [Delivery and retries](/concepts/delivery-and-retries)

  What happens when your endpoint is down.
- [Limits and quotas](/reference/limits-and-quotas)

  Rate limits, payload caps, and retention by plan.
