Base URL: https://api.lionvoice.app/api/v1. Mowa, Lion-AI i telefonia — jeden produkt. Mózg w całym produkcie to Lion-AI; identyfikatory silnika są wewnętrzne i opcjonalne w odpowiedziach API.
Base URL: https://api.lionvoice.app/api/v1
API nie ma parametru wyboru modelu — Lion-AI to jedyny widoczny mózg.
5-minutowy Quick Start dla programisty
1. W panelu utwórz klucz API (API keys) — sekret widać tylko raz. 2. Utwórz agenta. 3. Podłącz numer (E.164) i przypisz do agenta. 4. Wykonaj testowe połączenie wychodzące.
export LV_KEY='lv_live_…'
# 1) who am I
curl -sS https://api.lionvoice.app/api/v1/tenant \
-H "Authorization: Bearer $LV_KEY"
# 2) create an agent
curl -sS https://api.lionvoice.app/api/v1/agents \
-H "Authorization: Bearer $LV_KEY" \
-H "Content-Type: application/json" \
-d '{
"name":"Reception",
"language":"en",
"voice":"Lion-AI Warm",
"prompt":"You are a receptionist. Address the caller as you.",
"first_message":"Hi, how can I help?",
"max_duration_sec":600
}'
# 3) attach a number
curl -sS https://api.lionvoice.app/api/v1/phone-numbers \
-H "Authorization: Bearer $LV_KEY" \
-H "Content-Type: application/json" \
-d '{"number_e164":"+37052636333","label":"Reception"}'
# 4) test outbound (use your own test line)
curl -sS https://api.lionvoice.app/api/v1/calls \
-H "Authorization: Bearer $LV_KEY" \
-H "Content-Type: application/json" \
-d '{"to_number":"+447554522255","agent_id":1}'
Uwierzytelnianie
Create a key in the dashboard (API keys) or POST /keys. The secret is shown once. Send it as Bearer or X-LV-Api-Key. Ping does not need a key. A revoked key returns 401.
Not a public REST write (password stays in the vault). Dashboard → SIP / VoIP: host, port, username, password, transport. LionVoice registers like a softphone. Then map the DID under Phone numbers.
POST/keys{"label"} — full secret only on create. DELETE /keys?id=.
POST /webhook-secret/regenerate
Headers: Authorization: Bearer lv_live_…. Rotates the HMAC key used for X-LV-Signature. The full secret is returned once (same pattern as POST /keys). GET /tenant never returns it. After rotate, the previous secret stops verifying immediately — update your receiver first.
curl -sS -X POST https://api.lionvoice.app/api/v1/webhook-secret/regenerate \
-H "Authorization: Bearer $LV_KEY"
# Response 201
{
"ok": true,
"webhook_secret": "hex64…",
"prefix": "269d7d4b",
"note": "Save this secret now — it is not returned on GET /tenant."
}
Webhooki
Ustaw webhook_url na agencie (tylko https). Po każdym zakończonym połączeniu LionVoice wysyła JSON raz (8 s). Sprawdź X-LV-Signature sekretem z POST /webhook-secret/regenerate (pokazywany raz; GET /tenant tylko prefix). Zdarzenie: call.completed.
Beginner — Create a webhook
Dashboard → Webhooks: URL + events → Create. Secret shown once. Test webhook. Snippet to verify HMAC.
HTTPS only. HMAC header X-LV-Signature: t=<unix>,v1=<hex> over timestamp + "." + raw body. Reject timestamps older than five minutes. Return 2xx. Deduplicate on id (event_id). A retry is a new delivery_id. Delivery logs store status, HTTP, time, event_id, delivery_id — not the payload.
# Headers
X-LV-Event: call.ended
X-LV-Delivery-Id: del_01J…
X-LV-Timestamp: 1757232000
X-LV-Signature: t=1757232000,v1=hexhmac
# Body (no transcript / phone in test events)
{
"id": "evt_01J…",
"type": "call.ended",
"created_at": "2026-09-07T09:00:00+00:00",
"data": {
"call_id": "6c202718-…",
"duration_sec": 84,
"status": "completed"
}
}
Developer — Webhook API
POST /v1/webhooks
GET /v1/webhooks
DELETE /v1/webhooks/{id}
POST /v1/webhooks/{id}/test
POST /v1/webhooks/{id}/rotate-secret
GET /v1/webhooks/{id}/deliveries
GET /v1/webhooks/snippet?lang=php
Same engine as the dashboard. Agent webhook_url remains a legacy subscriber for call.ended.
Błędy
Kształt: {"ok":false,"error":"kod","message":"…"}. Do ponowienia: 429 i 5xx. Nie: 400, 401, 403, 404. 409 zwykle nie.
{
"ok": false,
"error": "insufficient_balance",
"message": "Your wallet balance is too low."
}
HTTP
Retry?
Typical error
400
No
valid_to_number_required
401
No
unauthorized
403
No
plan / cap
404
No
not_found
409
Usually no
conflict
429
Yes, exponential backoff
rate_limited
500
Yes
engine
SDK
Oficjalne klienty są w planie. Dziś: kopiuj przykłady curl, PHP, JavaScript i Python poniżej. Importuj OpenAPI (/openapi.json) do Postmana.