> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praeto.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Send your first Praeto Dispatcher event and inspect the resulting deliveries.

# Quickstart

This guide walks through the basic Praeto Dispatcher flow:

1. Set an API key
2. Create an endpoint destination
3. Publish an event
4. Verify idempotency
5. Inspect deliveries and attempts
6. Check usage and metrics

## Prerequisites

You need:

* A Praeto tenant API key
* A webhook receiver URL such as `https://webhook.site/...`
* PowerShell, curl, or any HTTP client

## Set your API key

```powershell theme={null}
$BaseUrl = "https://api.praeto.dev"
$ApiKey = "praeto_live_YOUR_TENANT_KEY"
```

For your development Worker, use:

```powershell theme={null}
$BaseUrl = "https://api.praeto.dev"
```

## Create an endpoint

```powershell theme={null}
$EndpointUrl = "https://webhook.site/YOUR-UUID"

$endpoint = Invoke-RestMethod -Method POST `
  -Uri "$BaseUrl/v1/endpoints" `
  -Headers @{ Authorization = "Bearer $ApiKey" } `
  -ContentType "application/json" `
  -Body (@{
    url = $EndpointUrl
    description = "Production webhook endpoint"
    subscribed_events = @("order.created", "invoice.paid")
  } | ConvertTo-Json -Depth 5)

$endpoint
```

The create response returns the endpoint signing secret once. Store it immediately.

## Publish an event

```powershell theme={null}
$event = Invoke-RestMethod -Method POST `
  -Uri "$BaseUrl/v1/events" `
  -Headers @{
    Authorization = "Bearer $ApiKey"
    "Idempotency-Key" = "order-123-created"
  } `
  -ContentType "application/json" `
  -Body (@{
    event_type = "order.created"
    payload = @{
      order_id = "ord_123"
      customer_id = "cus_456"
      total = 149.00
    }
  } | ConvertTo-Json -Depth 5)

$event
```

curl version:

```bash theme={null}
curl -X POST https://api.praeto.dev/v1/events \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-123-created" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "order.created",
    "payload": {
      "order_id": "ord_123",
      "customer_id": "cus_456",
      "total": 149.00
    }
  }'
```

## Inspect delivery attempts

```powershell theme={null}
$DeliveryId = $event.delivery_ids[0]

Invoke-RestMethod `
  -Uri "$BaseUrl/v1/deliveries/$DeliveryId/attempts" `
  -Headers @{ Authorization = "Bearer $ApiKey" }
```

## Check usage

```powershell theme={null}
Invoke-RestMethod `
  -Uri "$BaseUrl/v1/usage/current" `
  -Headers @{ Authorization = "Bearer $ApiKey" }
```
