📡 PRO API Reference¶
REST API für manniPhone PRO Backend.
Base URL: https://api.manniphone.app/v1
🔐 Authentication¶
Alle API-Endpunkte (außer /auth/*) erfordern einen JWT Token.
Auth Endpoints¶
POST /auth/register¶
Neuen Account erstellen.
POST /auth/login¶
Einloggen.
POST /auth/refresh¶
Access Token erneuern.
Voice Token¶
POST /token/voice¶
Twilio Access Token für WebRTC generieren.
Token Lebensdauer
Der Voice Token ist 1 Stunde gültig. Die App sollte ihn rechtzeitig erneuern.
Calls¶
GET /calls¶
Anrufhistorie abrufen.
Query Parameter
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Max. Anzahl |
offset | number | 0 | Pagination Offset |
from | date | - | Start-Datum |
to | date | - | End-Datum |
GET /calls/:id¶
Einzelnen Anruf abrufen.
{
"id": "call_xyz789",
"to": "+49170123456",
"from": "+4915123456789",
"direction": "outbound",
"status": "completed",
"duration": 125,
"credits_used": 5,
"started_at": "2026-01-23T14:32:00Z",
"ended_at": "2026-01-23T14:34:05Z",
"recording": {
"id": "rec_abc123",
"url": "https://...",
"duration": 125
}
}
DELETE /calls/:id¶
Anruf aus Historie löschen.
Billing¶
GET /billing/credits¶
Aktuelles Guthaben abrufen.
GET /billing/transactions¶
Transaktionshistorie.
{
"transactions": [
{
"id": "txn_123",
"type": "purchase",
"amount": 250,
"description": "Credit Purchase",
"created_at": "2026-01-20T10:00:00Z"
},
{
"id": "txn_124",
"type": "usage",
"amount": -5,
"description": "Call to +49170123456",
"call_id": "call_xyz789",
"created_at": "2026-01-23T14:34:05Z"
}
]
}
POST /billing/checkout¶
Stripe Checkout Session erstellen.
Produkte
| ID | Credits | Preis |
|---|---|---|
credits_100 | 100 | 10 € |
credits_250 | 250 | 25 € |
credits_500 | 550 | 45 € |
credits_1000 | 1200 | 80 € |
GET /billing/subscription¶
Aktives Abo abrufen.
Recordings¶
GET /recordings¶
Aufnahmen abrufen.
GET /recordings/:id/download¶
Aufnahme herunterladen.
DELETE /recordings/:id¶
Aufnahme löschen.
Webhooks (Server-to-Server)¶
Diese Endpunkte werden von Twilio aufgerufen.
POST /webhook/voice/outbound¶
TwiML für ausgehende Anrufe.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="+4915123456789">
<Number>+49170123456</Number>
</Dial>
</Response>
POST /webhook/call-status¶
Status-Updates für Anrufe.
Status-Werte
| Status | Beschreibung |
|---|---|
initiated | Anruf gestartet |
ringing | Zieltelefon klingelt |
in-progress | Verbunden |
completed | Beendet |
busy | Besetzt |
no-answer | Keine Antwort |
failed | Fehler |
Error Responses¶
Format¶
{
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "Not enough credits for this call",
"details": {
"required": 5,
"available": 2
}
}
}
Error Codes¶
| Code | HTTP | Description |
|---|---|---|
UNAUTHORIZED | 401 | Token ungültig/fehlt |
FORBIDDEN | 403 | Keine Berechtigung |
NOT_FOUND | 404 | Ressource nicht gefunden |
INSUFFICIENT_CREDITS | 402 | Nicht genug Guthaben |
RATE_LIMITED | 429 | Zu viele Anfragen |
INTERNAL_ERROR | 500 | Server-Fehler |
Rate Limits¶
| Endpoint | Limit |
|---|---|
/auth/* | 10 req/min |
/token/* | 30 req/min |
/calls/* | 60 req/min |
/billing/* | 30 req/min |
Bei Überschreitung:
SDKs¶
JavaScript¶
import { ManniPhoneClient } from '@manniphone/sdk';
const client = new ManniPhoneClient({
accessToken: 'your-access-token'
});
// Anruf starten
await client.calls.create({
to: '+49170123456'
});
// Guthaben abrufen
const balance = await client.billing.getCredits();