Skip to content

Quick Start

Interne Entwickler-Dokumentation

Diese Dokumentation richtet sich ausschließlich an das interne Entwicklerteam. Sie ist nicht für Endbenutzer oder externe Entwickler bestimmt.

In this tutorial, you will create your first subscriber and assign tags -- in under 5 minutes.

Prerequisites

  • Local Setup completed
  • Server running on localhost:8000 (via make dev)
  • Org-scoped API key available (see below)

1. Start the Development Environment

Bash
1
2
3
4
5
# Komplettes Setup (einmalig)
make setup

# Entwicklungsumgebung starten (Backend + Frontend + Celery Worker)
make dev

2. Create a Bootstrap API Key

After setup, create an org-scoped API key:

Bash
make api-key-bootstrap

Org-scoped API Keys

API Keys sind immer an eine Organisation gebunden. Der Bootstrap-Key erstellt automatisch eine Default-Organisation für die lokale Entwicklung.

Bash
export API_KEY="your-api-key-here"

3. Health Check

Verify that the API is reachable:

Bash
curl http://localhost:8000/health

Expected response:

JSON
1
2
3
4
{
  "status": "healthy",
  "version": "0.1.0"
}

4. Create a Tag

Create a tag for newsletter categories:

Bash
1
2
3
4
5
6
7
8
9
curl -X POST http://localhost:8000/api/v1/tags \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "product-updates",
    "display_name": "Product Updates",
    "description": "New features and improvements",
    "category": "newsletter"
  }'
Python
import os
import httpx

API_KEY = os.environ["API_KEY"]

client = httpx.Client(
    base_url="http://localhost:8000/api/v1",
    headers={"X-API-Key": API_KEY}
)

response = client.post("/tags", json={
    "name": "product-updates",
    "display_name": "Product Updates",
    "description": "New features and improvements",
    "category": "newsletter"
})
print(response.json())

5. Create a Subscriber

Register a new subscriber:

Bash
1
2
3
4
5
6
7
8
9
curl -X POST http://localhost:8000/api/v1/subscribers \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "first_name": "Max",
    "last_name": "Mustermann",
    "tags": ["product-updates"]
  }'
Python
1
2
3
4
5
6
7
8
9
response = client.post("/subscribers", json={
    "email": "user@example.com",
    "first_name": "Max",
    "last_name": "Mustermann",
    "tags": ["product-updates"]
})
result = response.json()
subscriber = result["data"]
print(f"Subscriber ID: {subscriber['id']}")

6. Update Preferences

The subscriber wants to subscribe to an additional newsletter:

Bash
1
2
3
4
5
6
7
curl -X PATCH http://localhost:8000/api/v1/subscribers/{subscriber_id}/tags \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "add": ["weekly-digest"],
    "remove": []
  }'
Python
1
2
3
4
5
6
7
8
response = client.patch(
    f"/subscribers/{subscriber['id']}/tags",
    json={
        "add": ["weekly-digest"],
        "remove": []
    }
)
print(response.json())

7. Query Preferences

View current subscriptions:

Bash
curl http://localhost:8000/api/v1/subscribers/{subscriber_id} \
  -H "X-API-Key: $API_KEY"

Response:

JSON
{
  "data": {
    "id": "uuid",
    "email": "user@example.com",
    "first_name": "Max",
    "last_name": "Mustermann",
    "status": "active",
    "tags": [
      {
        "name": "product-updates",
        "subscribed_at": "2024-01-15T10:30:00Z"
      },
      {
        "name": "weekly-digest",
        "subscribed_at": "2024-01-15T10:35:00Z"
      }
    ],
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Summary

You have learned how to:

  • Start the development environment with make dev
  • Create an org-scoped bootstrap API key
  • Perform an API health check
  • Create tags for newsletter categories
  • Register a subscriber with initial tags
  • Update subscriber preferences
  • Query current subscriptions

Next Steps

  • Authentication


    Understand API keys and Magic Link auth.

    Go to Guide

  • Subscriber Management


    Advanced subscriber operations.

    Go to Guide

  • Tag Management


    Manage tags and categories.

    Go to Guide