API di Sloted
Una semplice API REST e webhook firmati per prenotazioni, clienti e pagamenti, più Zapier e Make. Disponibile con il piano Pro.
Autenticazione
Crea una chiave API in Impostazioni → API e integrazioni e inviala come bearer token. Le chiavi appartengono a una sola attività.
curl https://sloted.app/api/v1/services \
-H "Authorization: Bearer sk_live_…"120 richieste al minuto per chiave. Tutti gli orari sono UTC ISO 8601; gli importi sono in unità minori (centesimi) con il codice valuta.
Endpoint
| GET | /api/v1/me | L'attività a cui appartiene la chiave (test di connessione). |
| GET | /api/v1/services | Servizi prenotabili con durata e prezzo. |
| GET | /api/v1/availability?service_id=…&from=2026-10-01&to=2026-10-07 | Orari liberi per un servizio tra due date. |
| GET | /api/v1/bookings?from=…&to=…&status=confirmed&cursor=… | Prenotazioni che iniziano in un intervallo, con paginazione a cursore. |
| POST | /api/v1/bookings | Prenota un orario libero. Confermata subito; il pagamento avviene in sede. |
| GET | /api/v1/bookings/{id} | Una prenotazione. |
| POST | /api/v1/bookings/{id}/reschedule | Sposta una prenotazione: { "start": "…" }. |
| POST | /api/v1/bookings/{id}/cancel | Annulla una prenotazione (il cliente viene avvisato). |
| GET | /api/v1/clients?email=… | Cerca clienti, es. per email. |
| POST | /api/v1/clients | Crea un cliente, o restituisce quello esistente con quell'email/telefono. |
| POST | /api/v1/hooks | Iscrivi un URL a un evento (REST hook di Zapier/Make). |
| DELETE | /api/v1/hooks/{id} | Rimuovi un'iscrizione. |
Creare una prenotazione
curl -X POST https://sloted.app/api/v1/bookings \
-H "Authorization: Bearer sk_live_…" -H "Content-Type: application/json" \
-d '{
"service_id": "…",
"start": "2026-10-06T09:00:00Z",
"staff_id": null,
"client": { "first_name": "Anna", "email": "anna@example.com" },
"idempotency_key": "order-1234"
}'Passa idempotency_key per rendere sicuri i tentativi ripetuti. Un orario non più libero restituisce 409, quindi niente doppie prenotazioni.
Errori
{ "error": { "code": "slot_unavailable", "message": "That time is not available." } }
401 unauthorized · 403 plan_limit · 404 not_found · 409 slot_unavailable
422 validation_error · 429 rate_limitedWebhook
Aggiungi endpoint dalla dashboard o tramite /api/v1/hooks. Ogni consegna è un POST JSON firmato con il segreto dell'endpoint.
- booking.created
- booking.updated
- booking.cancelled
- booking.completed
- booking.no_show
- payment.succeeded
- payment.refunded
- client.created
- form.submitted
POST https://your-app.example.com/sloted
Sloted-Event: booking.created
Sloted-Signature: t=1791234567,v1=5f2b…
{ "id": "evt_…", "type": "booking.created", "created": "2026-10-01T08:00:00Z",
"data": { "booking": { "id": "…", "status": "confirmed", "start": "…", "client": { … } } } }Verifica della firma
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(secret, rawBody, header) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false; // replay window
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
return timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}Rispondi con un qualsiasi 2xx entro 10 secondi. Le consegne non riuscite vengono ritentate con backoff (8 tentativi in circa 4 ore). I payload non includono mai le risposte dei moduli.
Zapier e Make
Entrambi usano la tua chiave API. I trigger si iscrivono con REST hook; le azioni chiamano gli endpoint di prenotazioni e clienti.
POST /api/v1/hooks { "target_url": "https://hooks.zapier.com/…", "event": "booking.created" }
→ 201 { "id": "…", "secret": "whsec_…" }
DELETE /api/v1/hooks/{id} → 204