# Getting Started

> One page of the LogDuck documentation. Every page is listed in https://logduck.com/llms.txt, and https://logduck.com/llms-full.txt is all of them in one file.

LogDuck is an event logging and notification service for developers. Send events from your applications and receive push notifications when important things happen.

## Quick Start

**1. ****Create an Organization** - Sign up and create your first organization in the dashboard.

**2. ****Create a Project** - Projects represent your apps or services. Each project has its own API keys and event types.

**3. ****Generate an API Key** - Create an API key in your project settings to authenticate your requests.

**4. ****Send Events** - Post events to the API when things happen in your application.

## Your First Event

Ready to send your first event? You only need two fields: `type` and `source`.

**curl**

```bash
curl -X POST https://api.logduck.com/v1/events \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json" \
  -d '{"type": "user.signup", "source": "my-backend"}'
```

**JavaScript**

```javascript
await fetch('https://api.logduck.com/v1/events', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    type: 'user.signup',
    source: 'my-backend',
  }),
});
```

**Python**

```python
import requests
import uuid

requests.post(
    'https://api.logduck.com/v1/events',
    headers={
        'X-API-Key': 'YOUR_API_KEY',
        'Idempotency-Key': str(uuid.uuid4()),
    },
    json={
        'type': 'user.signup',
        'source': 'my-backend',
    }
)
```

**Swift**

```swift
var request = URLRequest(url: URL(string: "https://api.logduck.com/v1/events")!)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-API-Key")
request.setValue(UUID().uuidString, forHTTPHeaderField: "Idempotency-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: [
    "type": "user.signup",
    "source": "my-backend"
])
URLSession.shared.dataTask(with: request).resume()
```

**Kotlin**

```kotlin
val client = OkHttpClient()
val body = """{"type": "user.signup", "source": "my-backend"}"""
    .toRequestBody("application/json".toMediaType())
val request = Request.Builder()
    .url("https://api.logduck.com/v1/events")
    .post(body)
    .addHeader("X-API-Key", "YOUR_API_KEY")
    .addHeader("Idempotency-Key", UUID.randomUUID().toString())
    .build()
client.newCall(request).execute()
```

**C#**

```csharp
using System.Net.Http.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Idempotency-Key", Guid.NewGuid().ToString());
await client.PostAsJsonAsync(
    "https://api.logduck.com/v1/events",
    new { type = "user.signup", source = "my-backend" }
);
```

`type` identifies what happened (e.g., `user.signup`, `payment.completed`). `source` identifies where it came from (e.g., `web-backend`, `mobile-app`).

Want to add more context? See the [Events Reference](https://logduck.com/docs/events-reference.md) for optional fields like `subject`, `data` and `emoji`.

## Raw HTTP or an SDK?

The examples above are plain HTTPS calls with no dependency — that is the whole API, and it works from any language. Official SDKs are a convenience on top of it: they generate the `Idempotency-Key` for you, reuse it across a retry so a retry can never double-post, honour `Retry-After` on a rate limit, and validate an event before it leaves your process.

There are SDKs for .NET, JavaScript/TypeScript, Python, Swift and Kotlin/JVM — see [Client SDKs](https://logduck.com/docs/sdks-overview.md). Going direct is a first-class option; you just take on those four things yourself.
