Documentación de endpoints HTTP
GET /health
{ "status": "ok", "timestamp": "2024-01-01T00:00:00.000Z", "activePins": 5, "instance": "mi-instancia" }
POST /register-pin Content-Type: application/json { "pin": "ABC123", "emojiString": "🔐🔑🔒" }
{ "success": true, "message": "PIN registrado correctamente", "pinId": "abc123", "expiresIn": 180 }
POST /check-login Content-Type: application/json { "pin": "ABC123" }
{ "success": true, "verified": false, "message": "Login pendiente" }
{ "success": true, "verified": true, "token": "eyJhbGciOiJIUzI1NiIs...", "refreshToken": "eyJhbGciOiJIUzI1NiIs...", "user": { "id": "123", "name": "Juan", "phone": "+1234567890", "roles": ["user"] } }
POST /refresh-token Authorization: Bearer {access_token} Content-Type: application/json { "refreshToken": "eyJhbGciOiJIUzI1NiIs..." }
{ "success": true, "token": "eyJhbGciOiJIUzI1NiIs...", "refreshToken": "eyJhbGciOiJIUzI1NiIs..." }
POST /whatsapp-endpoint Content-Type: application/json X-Hub-Signature-256: sha256={signature} { "event": "messages.upsert", "instance": "mi-instancia", "data": { "key": { "remoteJid": "1234567890@s.whatsapp.net", "fromMe": false }, "message": { "conversation": "PIN: 🔐🔑🔒" } } }
200 OK
GET /profile Authorization: Bearer {access_token}
{ "success": true, "user": { "id": "123", "name": "Juan", "surname": "Pérez", "phone": "+1234567890", "roles": ["user"] } }
POST /logout Authorization: Bearer {access_token} Content-Type: application/json { "userId": "123" }
{ "success": true, "message": "Logout exitoso" }
POST /send-message Authorization: Bearer {access_token} Content-Type: application/json { "phoneNumber": "+1234567890", "message": "Hola, tu código es ABC123" }
{ "success": true, "message": "Mensaje enviado" }
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...