{"name":"WhatsApp API","version":"v1","base_url":"https:\/\/whatsapp.theonesystemco.com\/api\/v1","authentication":{"type":"Bearer Token","header":"Authorization: Bearer YOUR_API_TOKEN","token_formats":{"permanent":"wavex_XXXXX (never expires)","sanctum":"ID|HASH (session-based)"},"get_token":"GET \/api\/client\/api-token","regenerate":"POST \/api\/client\/api-token\/regenerate"},"rate_limits":{"per_minute":60,"per_hour":1000,"headers":["X-RateLimit-Limit","X-RateLimit-Remaining"]},"endpoints":{"sessions":[{"method":"GET","path":"\/sessions","description":"List all sessions"},{"method":"POST","path":"\/sessions","description":"Create new session","body":{"name":"string","connection_method":"qr|code"}},{"method":"GET","path":"\/sessions\/{id}","description":"Session details with health"},{"method":"DELETE","path":"\/sessions\/{id}","description":"Delete session"},{"method":"GET","path":"\/sessions\/{id}\/qr","description":"Get QR code image"},{"method":"POST","path":"\/sessions\/{id}\/pair","description":"Request pairing code","body":{"phone_number":"string (required, min 9 digits)"}},{"method":"POST","path":"\/sessions\/{id}\/start","description":"Start session"},{"method":"POST","path":"\/sessions\/{id}\/stop","description":"Stop session"},{"method":"POST","path":"\/sessions\/{id}\/restart","description":"Restart session"},{"method":"GET","path":"\/sessions\/{id}\/status","description":"Real-time status from WhatsApp"},{"method":"GET","path":"\/sessions\/{id}\/health","description":"Health metrics and heartbeat data"}],"messages":[{"method":"GET","path":"\/sessions\/{id}\/messages","description":"Message history (paginated)","query":{"per_page":"int (max 100)","status":"sent|failed|queued","to":"phone filter"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/text","description":"Send text message","body":{"to":"phone (required)","message":"string (required)"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/image","description":"Send image","body":{"to":"phone","image_url":"URL (or image_base64)","caption":"string"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/document","description":"Send document","body":{"to":"phone","document_url":"URL (or document_base64)","mime_type":"string","filename":"string"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/video","description":"Send video","body":{"to":"phone","video_url":"URL (or video_base64)","caption":"string"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/audio","description":"Send audio\/voice","body":{"to":"phone","audio_url":"URL (or audio_base64)"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/location","description":"Send location","body":{"to":"phone","latitude":"number","longitude":"number","description":"string"}},{"method":"POST","path":"\/sessions\/{id}\/messages\/contact","description":"Send contact card","body":{"to":"phone","contact_name":"string","contact_phone":"phone"}}],"campaigns":[{"method":"GET","path":"\/campaigns","description":"List campaigns"},{"method":"POST","path":"\/campaigns","description":"Create campaign (bulk message)","body":{"name":"string (required)","session_id":"int (required \u2014 connected session ID)","message":"string (required if no template_id)","template_id":"int (optional \u2014 if set, uses the template content + media)","type":"immediate|scheduled (default: immediate)","scheduled_at":"ISO datetime (required if type=scheduled)","delay_seconds":"int (delay between messages, default ~200)","media_options":{"media_url":"URL of image\/video\/document (optional)","media_type":"MIME type e.g. image\/jpeg, video\/mp4, application\/pdf","filename":"Original filename e.g. photo.jpg"},"recipients":"[{phone: \"201234567890\", name: \"Ahmed\", variables: {key: value}}]"},"notes":"If template_id is set AND the template has media (media_url), the template media is automatically included \u2014 you don't need to also pass media_options. Explicitly passing media_options overrides the template media."},{"method":"GET","path":"\/campaigns\/{id}","description":"Campaign details with progress"},{"method":"POST","path":"\/campaigns\/{id}\/start","description":"Start campaign (triggers message sending)"},{"method":"POST","path":"\/campaigns\/{id}\/pause","description":"Pause running campaign"},{"method":"POST","path":"\/campaigns\/{id}\/resume","description":"Resume paused campaign"},{"method":"DELETE","path":"\/campaigns\/{id}","description":"Cancel and delete campaign"},{"method":"GET","path":"\/campaigns\/{id}\/stats","description":"Campaign analytics (sent, failed, pending counts)"}],"templates":[{"method":"GET","path":"\/templates","description":"List templates"},{"method":"POST","path":"\/templates","description":"Create template (with optional media)","body":{"name":"string (required)","content":"string with {{variables}} (required)","category":"marketing|transactional|otp|general","media_url":"URL of attached media (optional \u2014 from upload-media endpoint)","media_type":"MIME type e.g. image\/png, video\/mp4","media_filename":"Original filename e.g. promo.jpg"}},{"method":"GET","path":"\/templates\/{id}","description":"Template details (includes media_url, media_type, media_filename)"},{"method":"PUT","path":"\/templates\/{id}","description":"Update template (can add\/remove media)"},{"method":"DELETE","path":"\/templates\/{id}","description":"Delete template"},{"method":"POST","path":"\/templates\/{id}\/preview","description":"Preview with variables","body":{"variables":"{key: value}"}},{"method":"POST","path":"\/templates\/{id}\/send","description":"Send template message (includes template media)","body":{"session_id":"int","to":"phone","variables":"{key: value}"}}],"contacts":[{"method":"GET","path":"\/contacts","description":"List contacts","query":{"search":"string","session_id":"int"}},{"method":"GET","path":"\/contacts\/{id}","description":"Contact details"},{"method":"POST","path":"\/contacts\/sync","description":"Sync from WhatsApp","body":{"session_id":"int"}},{"method":"POST","path":"\/contacts\/import","description":"Import contacts","body":{"contacts":"[{phone, name}]"}},{"method":"GET","path":"\/contacts\/{phone}\/check","description":"Check if number is on WhatsApp","query":{"session_id":"int"}}],"groups":[{"method":"GET","path":"\/groups","description":"List groups"},{"method":"GET","path":"\/groups\/{id}","description":"Group details with contacts"},{"method":"GET","path":"\/groups\/{id}\/participants","description":"List group participants"},{"method":"POST","path":"\/groups\/{id}\/message","description":"Send message to group"},{"method":"POST","path":"\/groups\/sync","description":"Sync groups from WhatsApp"}],"webhooks":[{"method":"GET","path":"\/webhooks\/events","description":"List available webhook events"},{"method":"GET","path":"\/webhooks","description":"List registered webhooks"},{"method":"POST","path":"\/webhooks","description":"Register webhook","body":{"url":"URL","events":"[\"message.received\", ...]"}},{"method":"PUT","path":"\/webhooks\/{id}","description":"Update webhook"},{"method":"DELETE","path":"\/webhooks\/{id}","description":"Delete webhook"},{"method":"POST","path":"\/webhooks\/{id}\/test","description":"Test webhook delivery"}]},"webhook_events":{"message.received":"Incoming message from WhatsApp","message.sent":"Message successfully sent","message.delivered":"Message delivered to recipient","message.read":"Message read by recipient","message.failed":"Message sending failed","session.connected":"WhatsApp session connected","session.disconnected":"WhatsApp session disconnected","session.qr":"New QR code generated for session","campaign.started":"Campaign started sending","campaign.completed":"Campaign finished (all messages sent)","campaign.failed":"Campaign failed with errors"},"error_codes":[{"code":401,"error":"Unauthenticated","description":"Missing or invalid API token"},{"code":403,"error":"security_violation","description":"SSRF or restricted URL detected"},{"code":404,"error":"not_found","description":"Resource not found or not owned by user"},{"code":422,"error":"validation_failed","description":"Request body validation error"},{"code":429,"error":"rate_limit_exceeded","description":"Too many requests"},{"code":500,"error":"server_error","description":"Internal error - check error message"}],"examples":{"send_text":{"description":"Send a text message","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/sessions\/1\/messages\/text -H \"Authorization: Bearer YOUR_TOKEN\" -H \"Content-Type: application\/json\" -d '{\"to\":\"201234567890\",\"message\":\"Hello from API!\"}'"},"create_campaign":{"description":"Create and start a bulk campaign with text","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/campaigns -H \"Authorization: Bearer YOUR_TOKEN\" -H \"Content-Type: application\/json\" -d '{\"name\":\"Welcome Campaign\",\"session_id\":1,\"message\":\"Hello {{name}}!\",\"recipients\":[{\"phone\":\"201234567890\",\"name\":\"Ahmed\",\"variables\":{\"name\":\"Ahmed\"}}]}'"},"create_campaign_with_template":{"description":"Create campaign using a template (includes template media automatically)","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/campaigns -H \"Authorization: Bearer YOUR_TOKEN\" -H \"Content-Type: application\/json\" -d '{\"name\":\"Promo Campaign\",\"session_id\":1,\"template_id\":5,\"recipients\":[{\"phone\":\"201234567890\",\"name\":\"Ahmed\",\"variables\":{\"name\":\"Ahmed\"}}]}'","notes":"template_id points to a template that already has media attached \u2014 the image\/video\/document is included automatically."},"create_campaign_with_media":{"description":"Create campaign with explicit media attachment","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/campaigns -H \"Authorization: Bearer YOUR_TOKEN\" -H \"Content-Type: application\/json\" -d '{\"name\":\"Image Campaign\",\"session_id\":1,\"message\":\"Check this out {{name}}!\",\"media_options\":{\"media_url\":\"https:\/\/your-domain.com\/storage\/media\/promo.jpg\",\"media_type\":\"image\/jpeg\",\"filename\":\"promo.jpg\"},\"recipients\":[{\"phone\":\"201234567890\",\"name\":\"Ahmed\",\"variables\":{\"name\":\"Ahmed\"}}]}'"},"start_campaign":{"description":"Start a created campaign (triggers message sending)","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/campaigns\/1\/start -H \"Authorization: Bearer YOUR_TOKEN\""},"register_webhook":{"description":"Register a webhook for incoming messages","curl":"curl -X POST https:\/\/whatsapp.theonesystemco.com\/api\/v1\/webhooks -H \"Authorization: Bearer YOUR_TOKEN\" -H \"Content-Type: application\/json\" -d '{\"url\":\"https:\/\/your-server.com\/webhook\",\"events\":[\"message.received\",\"message.sent\"]}'"}}}