1<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /><meta name="csrf-token" content="6B0jnIqs2f4NCpM5P2ZO7r1wxYDdN2n7NlgV2K8K" /><meta name="bolt-enabled" content="true" /><title>API Documentations – OnSend</title><link rel="icon" type="image/png" href="https://onsend.io/images/favicon.h9fbefb90e4d5.png" /> <style type="text/css">@font-face {font-family:'Poppins';font-style:normal;font-weight:300;src:url(/cf-fonts/s/poppins/5.2.7/devanagari/300/normal.woff2);unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF,U+11B00-11B09;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:300;src:url(/cf-fonts/s/poppins/5.2.7/latin/300/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:300;src:url(/cf-fonts/s/poppins/5.2.7/latin-ext/300/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:400;src:url(/cf-fonts/s/poppins/5.2.7/devanagari/400/normal.woff2);unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF,U+11B00-11B09;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:400;src:url(/cf-fonts/s/poppins/5.2.7/latin/400/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:400;src:url(/cf-fonts/s/poppins/5.2.7/latin-ext/400/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:500;src:url(/cf-fonts/s/poppins/5.2.7/latin/500/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:500;src:url(/cf-fonts/s/poppins/5.2.7/devanagari/500/normal.woff2);unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF,U+11B00-11B09;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:500;src:url(/cf-fonts/s/poppins/5.2.7/latin-ext/500/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:600;src:url(/cf-fonts/s/poppins/5.2.7/devanagari/600/normal.woff2);unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF,U+11B00-11B09;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:600;src:url(/cf-fonts/s/poppins/5.2.7/latin-ext/600/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:600;src:url(/cf-fonts/s/poppins/5.2.7/latin/600/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:700;src:url(/cf-fonts/s/poppins/5.2.7/devanagari/700/normal.woff2);
1unicode-range:U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF,U+11B00-11B09;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:700;src:url(/cf-fonts/s/poppins/5.2.7/latin/700/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Poppins';font-style:normal;font-weight:700;src:url(/cf-fonts/s/poppins/5.2.7/latin-ext/700/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}</style> <link rel="stylesheet" type="text/css" href="https://onsend.io/css/app.h0e32fc01708e.css" bolt-pin /><link rel="stylesheet" href="https://onsend.io/jsdelivr/npm/@fortawesome/[email protected]/css/all.min.css" integrity="sha256-dABdfBfUoC8vJUBOwGVdm8L9qlMWaHTIfXt+7GnZCIo=" crossorigin="anonymous" bolt-pin /> <style type="text/css">body{overflow-x:hidden}.row{margin-left:-15.5px}.api-container{padding-right:0}.content-container{padding-right:5px}nav a{color:#000447}.nav-tabs{border-bottom:none}.nav .nav-link.active{color:#72b52b;border-top-left-radius:35px;border-top-right-radius:35px;border-bottom-left-radius:35px;border-bottom-right-radius:35px}.nav .nav-link:hover{color:#87c04a!important;border-top-left-radius:35px;border-top-right-radius:35px;border-bottom-left-radius:35px;border-bottom-right-radius:35px}.code-samples{margin-top:8%}.nav .nav-link{color:#fff;padding:7px 15px;background-color:#6d709687;border-top-left-radius:35px;border-top-right-radius:35px;border-bottom-left-radius:35px;border-bottom-right-radius:35px}@media screen and (max-width:768px){.api-container{padding-right:8px}}.shiki{font-size:92.5%}</style><link rel="stylesheet" type="text/css" href="https://onsend.io/views/s9.h97b86db578b1.css" bolt-pin> <link rel="modulepreload" href="https://onsend.io/jsdelivr/npm/@shikijs/[email protected]/shellscript/+esm" crossorigin="anonymous" fetchpriority="low" bolt-pin> <link rel="modulepreload" href="https://onsend.io/jsdelivr/npm/@shikijs/[email protected]/andromeeda/+esm" crossorigin="anonymous" fetchpriority="low" bolt-pin> <link rel="stylesheet" type="text/css" href="https://onsend.io/views/s2.h0a359603a4d5.css" /> <link rel="modulepreload" href="https://onsend.io/jsdelivr/npm/@shikijs/[email protected]/php/+esm" crossorigin="anonymous" fetchpriority="low" bolt-pin> <link rel="modulepreload" href="https://onsend.io/jsdelivr/npm/@shikijs/[email protected]/json/+esm" crossorigin="anonymous" fetchpriority="low" bolt-pin>
1<script bolt-pin>const noop=()=>{}</script>
1</head><body ><div id="app-container"><nav class="navbar navbar-expand-sm navbar-light shadow-none bg-navy"><a class="navbar-brand" href="https://onsend.io"> <img class="logo-w-200" src="https://onsend.io/images/logo.h8e2bee192c08.png" /> </a> <button class="navbar-toggler mr-4 bg-green" data-toggle="collapse" data-target="#navbar-menu"> <span class="navbar-toggler-icon"></span> </button><div class="collapse navbar-collapse" type="button" id="navbar-menu"><ul class="navbar-nav ml-auto text-center"><li class="nav-item"><a href="https://onsend.io#features" class="nav-link">Features</a></li><li class="nav-item"><a href="https://onsend.io#testimonies" class="nav-link">Testimonies</a></li><li class="nav-item"><a href="https://onsend.io#packages" class="nav-link">Packages</a></li><li class="nav-item"><a href="https://onsend.io#faqs" class="nav-link">FAQs</a></li><li class="nav-item"><a href="https://onsend.io/wordpress-plugins" class="nav-link ">WP Plugins</a></li><li class="nav-item"><a href="https://onsend.io/tutorials" class="nav-link ">Tutorials</a></li><li class="nav-item"><a href="https://onsend.io/api/docs" class="nav-link active">API Docs</a></li><li class="nav-item"><a href="https://onsend.io/user/login" class="nav-link"> <span class="far fa-user text-lime"></span> Sign In </a></li><li class="nav-item mx-1"><a href="https://onsend.io/user/register" class="btn btn-sm btn-register rounded-pill bg-green mt-1">Get Free Trial</a></li></ul></div></nav><div><div class="container-fluid api-container"><div class="row"><div class="col-lg-2 d-none d-lg-block mt-5"><nav class="flex-column sticky-top" style="top:1rem"><a class="nav-link" href="#authentication">Authentication</a> <a class="nav-link" href="#rate-limits">Rate Limits</a> <a class="nav-link" href="#status">Status</a> <a class="nav-link" href="#send">Send</a></nav></div><div class="col-lg-10 pl-0"><div id="page-content-wrapper"><div class="container-fluid content-container"><div class="row"><div class="col-lg-7 mt-5"><section class="mt-3"><h1>API Documentations</h1><hr /></section><section id="authentication"><h3 class="mb-5">Authentication</h3><h4>Introduction</h4><p>This API is authenticated by using <b>Bearer Token</b> authentication for each endpoint request. The HTTP client must send this token in the Authorization header when making requests to protected resources:</p><code>Authorization: Bearer [API_TOKEN]</code> <br /> <br /><p>For example, your authentication header will look something like this:</p><code>Authorization: Bearer 8d162cc813ce4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code> <br /> <br /><h4>Obtaining API token</h4><p>API token is set per device. You can get your token by the steps:</p><ol><li>Log into your account.</li><li>Navigate to the device page by clicking on "Devices" on the sidebar.</li><li>In the actions column, click "View" button to view device.</li><li>The token is shown under the "Token" column.</li></ol></section><hr /><section id="rate-limits"><h3>Rate Limits</h3><p>There are 2 types of rate limits:</p><ol><li><b>Per minute</b> 60 calls.</li><li><b>Per day</b> Based on the user's subscribed package.</li></ol><br /><h4>Monitoring Rate Limits</h4><p>You can monitor your current rate limit usage by checking the following headers in the API response:</p><ul><li><code>X-RateLimit-Limit</code> : The maximum number of requests allowed per time window</li><li><code>X-RateLimit-Remaining</code> : The number of requests remaining in the current time window</li></ul><p>When a rate limit is exceeded, the API will return a <code>429 Too Many Requests</code> response with a message indicating which limit was exceeded.</p><br /><h5>Example of checking rate limits using cURL:</h5><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda p-2" x-prop:lang="'shellscript'" x-prop:theme="'andromeeda'"> 2curl -i "Authorization: Bearer YOUR_API_TOKEN" https://onsend.io/api/status" 3</pre> </section></div><div class="col-lg-5" style="background-color:#000447"></div></div><div class="row"><div class="col-lg-7"><hr /><section id="status"><h3>Status</h3><p>This endpoint is to retrieve the status of the device. It provides information about whether your WhatsApp device is connected, not connected, or connecting.</p><h5><code> <b>GET</b> https://onsend.io/api/v1/status </code></h5><br /><h4>Response Description</h4><table class="table table-bordered table-striped table-responsive"><thead><tr><th>
3Field</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>The name of the device.</td></tr><tr><td>phone_number</td><td>The phone number associated with the device.</td></tr><tr><td>status</td><td>The current status of the device <code>(connected, not_connected, connecting, disabled, disconnected, logged_out).</code></td></tr></tbody></table></section></div><div class="col-lg-5" style="background-color:#000447"><h4 class="text-white code-samples">Code Samples</h4><ul id="myTab" class="nav nav-tabs" style="color:blue"><li class="nav-item"><a href="#status-php" class="nav-link active" data-toggle="tab">PHP</a></li><li class="nav-item"><a href="#status-laravel-php" class="nav-link" data-toggle="tab">Laravel PHP</a></li><li class="nav-item"><a href="#status-curl" class="nav-link" data-toggle="tab">cURL</a></li></ul><div class="tab-content pt-2"><div class="tab-pane show active" id="status-php"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'php'" x-prop:theme="'andromeeda'"> 4<?php 5 6$curl = curl_init(); 7 8curl_setopt_array($curl, [ 9 CURLOPT_URL => 'https://onsend.io/api/v1/status', 10 CURLOPT_RETURNTRANSFER => true, 11 CURLOPT_ENCODING => '', 12 CURLOPT_MAXREDIRS => 10, 13 CURLOPT_TIMEOUT => 30, 14 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 15 CURLOPT_CUSTOMREQUEST => 'GET', 16 CURLOPT_POSTFIELDS => '', 17 CURLOPT_HTTPHEADER => [ 18 'Accept: application/json', 19 'Authorization: Bearer [API_TOKEN]', 20 ], 21]); 22 23$response = curl_exec($curl); 24$err = curl_error($curl); 25 26curl_close($curl); 27 28if ($err) { 29 echo 'cURL Error #:' . $err; 30} else { 31 echo $response; 32} 33</pre> </div><div class="tab-pane" id="status-laravel-php"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'php'" x-prop:theme="'andromeeda'"> 34<?php 35 36$response = \Illuminate\Support\Facades\Http::accept('application/json') 37 ->withToken('[API_TOKEN]') 38 ->get('https://onsend.io/api/v1/status'); 39 40dump($response->body()); 41</pre> </div><div class="tab-pane" id="status-curl"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'shellscript'" x-prop:theme="'andromeeda'"> 42curl --header "Accept: application/json" \ 43 --header "Authorization: Bearer [API_TOKEN]" \ 44 https://onsend.io/api/v1/status 45</pre> </div></div><h4 class="text-white code-samples">Response Samples</h4><ul id="myTab" class="nav nav-tabs" style="color:blue"><li class="nav-item"><a href="#connected-status-json" class="nav-link active m-1" data-toggle="tab">Connected (200 OK)</a></li><li class="nav-item"><a href="#unconnected-status-json" class="nav-link m-1" data-toggle="tab">Not Connected (200 OK)</a></li><li class="nav-item"><a href="#connecting-status-json" class="nav-link m-1" data-toggle="tab">Connecting (200 OK)</a></li><li class="nav-item"><a href="#disabled-status-json" class="nav-link m-1" data-toggle="tab">Disabled (200 OK)</a></li><li class="nav-item"><a href="#disconnected-status-json" class="nav-link m-1" data-toggle="tab">Disconnected (200 OK)</a></li><li class="nav-item"><a href="#logged-out-status-json" class="nav-link m-1" data-toggle="tab">Logged Out (200 OK)</a></li><li class="nav-item"><a href="#rate-limited-status-json" class="nav-link m-1" data-toggle="tab">Rate Limited (429 Too Many Requests)</a></li></ul><div class="tab-content pt-2 mb-5"><div class="tab-pane show active" id="connected-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 46{ 47 "name": "Samsung A32", 48 "phone_number": "60123456789", 49 "status": "connected" 50} 51</pre> </div><div class="tab-pane" id="unconnected-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-
51prop:lang="'json'" x-prop:theme="'andromeeda'"> 52{ 53 "name": "iphone 12", 54 "phone_number": null, 55 "status": "not_connected" 56} 57</pre> </div><div class="tab-pane" id="connecting-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 58{ 59 "name": "huawei", 60 "phone_number": "60133106490", 61 "status": "connecting" 62} 63</pre> </div><div class="tab-pane" id="disabled-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 64{ 65 "name": "xiaomi", 66 "phone_number": null, 67 "status": "disabled" 68} 69</pre> </div><div class="tab-pane" id="disconnected-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 70{ 71 "name": "huawei", 72 "phone_number": "60123456789", 73 "status": "disconnected" 74} 75</pre> </div><div class="tab-pane" id="logged-out-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 76{ 77 "name": "Samsung S22", 78 "phone_number": "60123456789", 79 "status": "logged_out" 80} 81</pre> </div><div class="tab-pane" id="rate-limited-status-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 82{ 83 "message": "Too Many Attempts." 84} 85</pre> </div></div></div></div><div class="row"><div class="col-lg-7"><hr /><section id="send"><h3>Send</h3><p>Send a message to specified receiver.</p><h5><code> <b>POST</b> https://onsend.io/api/v1/send </code></h5><br /><h4>Parameters</h4><table class="table table-bordered table-striped table-responsive"><thead><tr><th>Attribute</th><th>Description</th></tr></thead><tbody><tr><td>phone_number</td><td><b class="text-success">string</b> <br /> <b class="text-danger">required</b> <br /> Intended phone number of the message receiver with country code. <br /> <b class="text-primary">Example:</b> 60123456789</td></tr><tr><td>message</td><td><b class="text-success">string</b> <br /> <b class="text-danger">required IF</b> user wants to send text message only <br /> Text message to be sent. Sent as caption if an image or video is sent. <br /> <b class="text-primary">Example:</b> Hello world</td></tr><tr><td>type</td><td><b class="text-success">string</b> <br /> <b class="text-danger">required</b> <br /> Type of message to send. Can be either <code>text, image, video,</code> or <code>document</code> . <br /> <b class="text-primary">Example:</b> image</td></tr><tr><td>url</td><td><b class="text-success">string</b> <br /> <b class="text-danger">required IF</b> user wants to send media <code>[image, video, document]</code> <br /> The media URL. Currently only suppot URL from live servers. <br /> <b class="text-primary">Example:</b> https://example.com/logo.png</td></tr><tr><td>mimetype</td><td><b class="text-success">string</b> <br /> <b class="text-danger">required IF</b> user wants to send document <br /> MIME type or media type of the document to be sent. <br /> <b class="text-primary">Example:</b> application/pdf</td></tr><tr><td>filename</td><td><b class="text-success">string</b> <br /> <b class="text-secondary">optional</b> <br /> The file name of document to be sent. <br /> <b class="text-primary">Example:</b> invoice.pdf</td></tr></tbody></table><h4 class="mt-5">Response Description</h4><table class="table table-striped table-responsive table-bordered"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td>success</td><td>Boolean indicating if the request was successful. <code>true</code> if the message was sent successfully, <code>false</code> otherwise.</td></tr><tr><td>message</td><td>A message describing the result of the operation. Contains success confirmation or error details.</td></tr><tr><td>message_id</td><td>Unique ID of the message. This can be used to track the message status or for reference in future API calls.</td></tr></tbody></table><h4 class="mt-5">Common Error Responses</h4><table class="table table-striped table-responsive table-bordered"><thead><tr><th>
85Scenario</th><th>Description</th></tr></thead><tbody><tr><td>Device Not Connected</td><td>This error occurs when your WhatsApp device is not connected. Go to the Devices section in your dashboard and scan the QR code to connect your device.</td></tr><tr><td>Invalid Parameters</td><td>This error occurs when required parameters are missing or invalid. Check that all required fields are provided and in the correct format. Common validation errors include:<ul><li>Missing or invalid phone number</li><li>Missing message</li><li>Missing URL for media types</li><li>Missing mimetype for document</li></ul></td></tr><tr><td>No Active Subscription</td><td>This error occurs when your device doesn't have an active subscription package. Check your subscription status in the dashboard and renew if necessary.</td></tr></tbody></table></section></div><div class="col-lg-5" style="background-color:#000447"><h4 class="text-white code-samples">Data Samples</h4><ul class="nav nav-tabs" style="color:blue"><li class="nav-item"><a href="#send-text" class="nav-link active" data-toggle="tab">Text</a></li><li class="nav-item"><a href="#send-image" class="nav-link" data-toggle="tab">Image</a></li><li class="nav-item"><a href="#sendvideo" class="nav-link" data-toggle="tab">Video</a></li><li class="nav-item"><a href="#send-document" class="nav-link" data-toggle="tab">Document</a></li></ul><div class="tab-content pt-2"><div class="tab-pane show active" id="send-text"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 86{ 87 "phone_number": "60123456789", 88 "message": "Hello world" 89} 90</pre> </div><div class="tab-pane" id="send-image"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 91{ 92 "phone_number": "60123456789", 93 "message": "Logo", 94 "type": "image", 95 "url": "https://example.com/logo.png" 96} 97</pre> </div><div class="tab-pane" id="sendvideo"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 98{ 99 "phone_number": "60123456789", 100 "message": "My video", 101 "type": "video", 102 "url": "https://example.com/myvideo.mp4" 103} 104</pre> </div><div class="tab-pane" id="send-document"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 105{ 106 "phone_number": "60123456789", 107 "type": "document", 108 "url": "https://example.com/invoice.pdf", 109 "mimetype": "application/pdf", 110 "filename": "invoice.pdf" 111} 112</pre> </div></div><br /><h4 class="text-white">Code Samples</h4><ul id="myTab" class="nav nav-tabs" style="color:blue"><li class="nav-item"><a href="#send-php" class="nav-link active" data-toggle="tab">PHP</a></li><li class="nav-item"><a href="#send-laravel-php" class="nav-link" data-toggle="tab">Laravel PHP</a></li><li class="nav-item"><a href="#send-curl" class="nav-link" data-toggle="tab">cURL</a></li></ul><div class="tab-content pt-2"><div class="tab-pane show active" id="send-php"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'php'" x-prop:theme="'andromeeda'"> 113<?php 114 115$curl = curl_init(); 116 117$data = [ 118 'phone_number' => '60123456789', 119 'message' => 'Hello world', 120]; 121 122curl_setopt_array($curl, [ 123 CURLOPT_URL => 'https://onsend.io/api/v1/send', 124 CURLOPT_RETURNTRANSFER => true, 125 CURLOPT_ENCODING => '', 126 CURLOPT_MAXREDIRS => 10, 127 CURLOPT_TIMEOUT => 30, 128 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, 129 CURLOPT_CUSTOMREQUEST => 'POST', 130 CURLOPT_POSTFIELDS => json_encode($data), 131 CURLOPT_HTTPHEADER => [ 132 'Accept: application/json', 133 'Authorization: Bearer [API_TOKEN]', 134 'Content-Type: application/json', 135 ], 136]); 137 138$response = curl_exec($curl); 139$err = curl_error($curl); 140 141curl_close($curl); 142 143if ($err) { 144 echo 'cURL Error #:' . $err;
145} else { 146 echo $response; 147} 148</pre> </div><div class="tab-pane" id="send-laravel-php"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'php'" x-prop:theme="'andromeeda'"> 149<?php 150 151$data = [ 152 'phone_number' => '60123456789', 153 'message' => 'Hello world', 154]; 155 156$response = \Illuminate\Support\Facades\Http::accept('application/json') 157 ->withToken('[API_TOKEN]') 158 ->post('https://onsend.io/api/v1/send', $data); 159 160dump($response->body()); 161</pre> </div><div class="tab-pane" id="send-curl"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'shellscript'" x-prop:theme="'andromeeda'"> 162curl --header "Accept: application/json" \ 163 --header "Content-Type: application/json" \ 164 --header "Authorization: Bearer [API_TOKEN]" \ 165 --request POST \ 166 --data '{"phone_number":"60123456789","message":"Hello world"}' \ 167 https://onsend.io/api/v1/send 168</pre> </div></div><h4 class="text-white code-samples">Response Samples</h4><ul id="myTab" class="nav nav-tabs" style="color:blue"><li class="nav-item"><a href="#send-successful-json" class="nav-link active m-1" data-toggle="tab">Success (200 OK)</a></li><li class="nav-item"><a href="#failed-send-json" class="nav-link m-1" data-toggle="tab">Failed (200 OK)</a></li><li class="nav-item"><a href="#device-disconnected-send-json" class="nav-link m-1" data-toggle="tab">Device disconnected (422 Unprocessable Entity)</a></li><li class="nav-item"><a href="#invalid-parameters-send-json" class="nav-link m-1" data-toggle="tab">Invalid parameters (422 Unprocessable Entity)</a></li><li class="nav-item"><a href="#no-subscription-send-json" class="nav-link m-1" data-toggle="tab">No active subscription (422 Unprocessable Entity)</a></li><li class="nav-item"><a href="#rate-limited-send-json" class="nav-link m-1" data-toggle="tab">Rate limit (429 Too Many Requests)</a></li></ul><div class="tab-content pt-2 mb-5"><div class="tab-pane show active" id="send-successful-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 169{ 170 "success": true, 171 "message": "The message has been sent successfully.", 172 "message_id": 38 173} 174</pre> </div><div class="tab-pane" id="failed-send-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 175{ 176 "success": false, 177 "message": "Failed to send the message.", 178 "message_id": 39 179} 180</pre> </div><div class="tab-pane" id="device-disconnected-send-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 181{ 182 "message": "This device is not connected." 183} 184</pre> </div><div class="tab-pane" id="invalid-parameters-send-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 185{ 186 "message": "The phone number field must be a valid phone number. (and 3 more errors)", 187 "errors": { 188 "phone_number": [ 189 "The phone number field must be a valid phone number." 190 ], 191 "message": [ 192 "The message field must be a string." 193 ], 194 "url": [ 195 "The url field is required when type is image." 196 ], 197 "mimetype": [ 198 "The mimetype field must be a string." 199 ] 200 } 201} 202</pre> </div><div class="tab-pane" id="no-subscription-send-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-
202prop:lang="'json'" x-prop:theme="'andromeeda'"> 203{ 204 "message": "This device does not have an active subscription." 205} 206</pre> </div><div class="tab-pane" id="rate-limited-send-json"><pre x-data="window.AlpineComponents.Shiki()" x-intersect="instantiate()" class="shiki andromeeda" x-prop:lang="'json'" x-prop:theme="'andromeeda'"> 207{ 208 "message": "Too Many Attempts." 209} 210</pre> </div></div></div></div></div></div></div></div></div></div><section id="contact-us"><div class="bg-navy justify-content-center"><div class="container-fluid"><div class="col-md-12 text-white mx-auto"><div class="row"><div class="col-md-3 mt-4"><a href="https://onsend.io"> <img class="logo-w-200" src="https://onsend.io/images/logo.h8e2bee192c08.png" /> <br /> </a><p class="text-uppercase font-weight-semibold">OnPay Solutions Sdn Bhd</p><p>SSM: 201401032677</p><p>53A-1, Jln Warisan Sentral 2, KIP Central Kota Warisan, 43900 Sepang, Selangor</p></div><div class="col-md-2 mt-4"><p class="font-weight-semibold mt-3">Useful Links</p><p class="footer-link"><a href="https://onsend.io#features">Features</a></p><p class="footer-link"><a href="https://onsend.io#testimonies">Testimonies</a></p><p class="footer-link"><a href="https://onsend.io#packages">Packages</a></p><p class="footer-link"><a href="https://onsend.io#faqs">FAQs</a></p></div><div class="col-md-2 mt-4"><p class="font-weight-semibold mt-3">Information</p><p class="footer-link"><a class="" href="https://onsend.io/tutorials">Tutorials</a></p><p class="footer-link"><a class="active" href="https://onsend.io/api/docs">API Docs</a></p><p class="footer-link"><a class="" href="https://onsend.io/privacy">Privacy Policy</a></p><p class="footer-link"><a class="" href="https://onsend.io/terms">Terms of Service</a></p></div><div class="col-md-2 mt-4"><p class="font-weight-semibold mt-3">Contact Us</p><p><span class="fas fa-phone-volume text-lime mr-2"></span> <span>+603-2770 2774</span></p><p><a href="https://www.facebook.com/onpaysb/" target="_blank"><span class="fab fa-facebook text-lime"></span></a> <a href="https://www.instagram.com/onpay.my/" target="_blank"><span class="fab fa-instagram text-lime"></span></a> <span class="ml-2">Follow Us</span></p></div><div class="col-md-2 mt-4"><div class="d-flex flex-column intro-app-links"></div></div></div></div></div></div></section> </div>
210<script type="text/javascript" src="https://onsend.io/js/app.h05c5680680f0.js" bolt-pin></script>
210
210<script type="text/javascript" src="https://onsend.io/lang/en/all.h1977dd461b94.js" bolt-pin></script>
210
210<script type="text/javascript" bolt-pin>App.configure({url:"https:\/\/onsend.io",topOffset:130,serviceWorker:{url:"https:\/\/onsend.io\/service-worker.h144b88a2e32d.js",enabled:true,unregister:false},routes:{}})</script>
210<script type="text/javascript" bolt-pin="app_dynamic">App.configure({authed:false,locale:"en",notification:null,errors:{}})</script>
210
210<script type="text/javascript" bolt-pin>window.Tawk_API=window.Tawk_API||{},Tawk_API.onLoad=()=>{Bolt.on("unload",a=>{"admin"!==new URL(a.detail.target).pathname.split("/")[1]?Tawk_API.showWidget():Tawk_API.hideWidget()})},Tawk_LoadStart=new Date</script>
210<script type="text/javascript" src="https://embed.tawk.to/62944b087b967b117991e152/1g49ka6n4" crossorigin="*" charset="UTF-8" async defer bolt-pin></script>
vendor: 94 bytes, line 210
210 <script src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "
210ad354b3b14cc445e84a5ff74739b413e
vendor: 28 bytes, line 210
210"}' defer bolt-pin></script>
210</body></html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.