Introduction
Lovense offers several solutions for integrating with our products and services. Web camming and games are the most common integrations of our technology.
If you are in the camming industry, choose from our Cam Solutions. For other integrations, choose from our Standard Solutions. For a mobile integration, choose our Native SDK.
If you have any questions or additional requirements, please contact [email protected]
Cam Solutions (with Lovense Connect)
Whether you run a cam site or a service for the camming industry, our Cam Solutions will let you easily integrate our best-in-class technology into your platform. Add tip-activated vibrations to your platform and let your users join the 90,000+ models using Lovense on cam.
Cam Extension for Chrome
Our Chrome extension - the most powerful camming tool for tip-activated toy control.
Broadcast with any Lovense toy(s) and access a full range of custom features like tip vibrations, games, chatroom notifications, video overlays, and more.
Cam sites we've integrated with this way:
Cam Kit for Web
Integrate a JS file into your webpage to embed our core features and get basic functions like tip-activated vibrations.
Offers you more control over the user's setup process, but fewer features for models.
Cam sites we've integrated with this way:
Custom Cam Solution
Our Basic APIs offer more customization.
- For a desktop camming app, check out our Basic API.
- For a web-based service, use the Basic JS API.
Cam sites we've integrated with this way:
Standard Solutions (with Lovense Remote)
Our Standard Solutions enable sending commands to Lovense toys by HTTP request. This is most commonly used by developers of games and other apps.
Standard API
A simple method to send commands to Lovense toys.
For integrating withPC GamesPC ApplicationsStandard JS API
A quick and convenient option for web-based games and apps.
For integrating withWeb GamesWeb Applications
Native SDK
Integrate Lovense features into your app using one of our SDKs.
Cam Solutions
Cam Extension for Chrome
The Cam Extension for Chrome is the best solution for cam models to stream with Lovense toys, featuring:
- Highly customizable vibration levels and patterns
- Lovense widget for quick access to settings while streaming
- Video overlay support for OBS, Streamster, SplitCam
- Games and tools to increase interactivity and earn more tips
- Frequent updates, improvements, and new features
Step 1: Configure the developer dashboard
Field | Description |
---|---|
Website Name | The name that will be displayed in our cam site list (in the Cam Extension). Contact us if you want to change it. |
Website URL | Your home page URL. |
Model Broadcasting Page Prefix | The URL prefix of your model broadcasting page. |
Status | The status of your website. |
Go to the developer dashboardopen in new window and fill in your settings.
Status Meaning:
Pending - The website is being tested. Use test:{Website Name}
name in order to add your website to the Cam Extension during the testing phase.
Active - The website is live and public. All models can see your cam site in the Cam Extension.
Step 2: Integration
Import the Javascript file
Import the Javascript file to your model’s broadcasting page. This Javascript will declare a global variable CamExtension
on the page.
<script src="https://api.lovense.com/cam-extension/static/js-sdk/broadcast.js"></script>
Initialize the instance object
Initialize a CamExtension instance on the model’s live page.
/**
* @param {string} websiteName this is the Website Name shown in the developer dashboard
* @param {string} modelName this is the model's name
* @returns {object} CamExtension instance object
*/
const camExtension = new CamExtension(websiteName, modelName)
2
3
4
5
6
Listen for ready event
Listen for the ready event, which will be called after successful initialization. You can communicate with the Cam Extension after this event is triggered.
/**
* readyCallback
* @param {object} ce CamExtension instance object
*/
const readyCallback = function (ce) {
// Handle the CamExtension instance object
// e.g. await ce.getCamVersion()
}
camExtension.on("ready", readyCallback)
2
3
4
5
6
7
8
9
10
Step 3: Methods & events
Methods
receiveTip
Call this method when the model receives a tip. The Cam Extension will trigger a response in the toy according to these parameters:
/** * receiveTip * @param {number} amount tip amount that the model receives * @param {string} tipperName this is the tipper’s Screen Name */ camExtension.receiveTip(amount, tipperName)
1
2
3
4
5
6receiveMessage
Call this method when the model receives a message in the chat room.
/** * receiveMessage * @param {string} userName the sender’s Screen Name * @param {string} content the message just sent by the sender */ camExtension.receiveMessage(userName, content)
1
2
3
4
5
6getSettings
Get the model's Lovense Settings.
/** * getSettings * @returns {object} model's Lovense Settings */ const data = await camExtension.getSettings() // data = { // levels: { // level1: { // min: 1, // max: 9, // time: 2, // rLevel: 0, // vLevel: 0, // }, // level2: {...} // level3: {...} // }, // special: { // earthquake: { // time: "22", // token: "120", // }, // fireworks: (...), // giveControl: (...), // pause: (...), // pulse: (...), // random: (...), // twowaves: (...), // wave: (...), // } // }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31getToyStatus
Get the model's Lovense Toys status.
/** * getToyStatus * @returns {array} model's Lovense Toys status. */ const data = await camExtension.getToyStatus() // data = [ // { // id: "l58f167da065", // name: "", // type: "lush", // status: "on" // }, // {...} // ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14getCamVersion
Get the Cam Extension version.
/** * getCamVersion * @returns {string} Cam Extension version */ const data = await camExtension.getCamVersion() // data = "30.4.4"
1
2
3
4
5
6
Events
You can listen for certain events to get the latest real-time data
postMessage
We will trigger this event when we need to send a message to you or the chat room, and you will need to help us handle it accordingly.
camExtension.on("postMessage", (message) => { // Process the message to be sent // Send the message to chat room // e.g. message = "My LOVENSE Lush is now reacting to john's tip. It will stop after 5 sec!" })
1
2
3
4
5toyStatusChange
We will trigger this event when the toy status changes.
camExtension.on("toyStatusChange", (data) => { // Handle toy information data // data = [{ // id: "d6c35fe83348", // name: "toy's name", // type: "lush", // status: "on", // version: "", // battery: "80" // }] })
1
2
3
4
5
6
7
8
9
10
11tipQueueChange
We will trigger this event when the tip queue updates.
camExtension.on("tipQueueChange", (data) => { // handle queue information data // data = { // running: [ // { // amount: 100, // tipperName: "john", // time: 20, // module: "Special Command", // cParameter: {}, // level: "", // specialType: "earthquake", // modelName: "coco", // reactToys: [, // toyId: "d6c35fe83348", // specialType: "earthquake", // status: 1, // toyType: "lush", // ] // } // ], // queue: [...], // waiting: [...] // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25settingsChange
We will trigger this event when the model’s Lovense Settings are updated.
camExtension.on("settingsChange", (data) => { // handle configuration information data // data = { // levels: { // level1: { // min: 1, // max: 9, // time: 2, // rLevel: 0, // vLevel: 0, // }, // level2: {...} // level3: {...} // }, // special: { // earthquake: { // enable: true, // time: "20", // token: "100", // }, // fireworks: ( // enable: true, // time: "22", // token: "120", // ), // giveControl: ( // enable: false, // time: "", // tokensBegin: "", // tokensEnd: "", // ), // randomTime: ( // enable: true, // tokens: "38", // minTime: 10, // maxTime: 50, // level: 5, // ), // pause: (...), // pulse: (...), // random: (...), // wave: (...), // } // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Cam Kit for Web
Work Flow
Step 1: Configure the developer dashboard
Go to the developer dashboardopen in new window
- Get your dToken (Developer Token).
- Click "Cam Kit Developer settings (v2.0)", configure your settings.
Step 2: Generate an mToken for your model
Get a unique token for your model. You only need to do this once for each model.
API URL: https://api.lovense.com/api/cam/model/getToken
Notice: For security reasons, the developer token should be always used on the server side. You should never use it in your JS code from the client side.
HTTP Request: POST
Content Type: application/x-www-form-urlencoded; charset=UTF-8
Parameters:
Name | Description |
---|---|
dToken | Developer Token |
mInfo | Model's Information (UTF-8 encoded JSON) |
Sample request:
// content-type: application/x-www-form-urlencoded; charset=UTF-8
{
"dToken": "xxxx", // developer token
"mInfo": "{'mId':'b799e042b','mName':'test123'}" //
}
2
3
4
5
Return:
{
"result": true, // true or false
"message": "SuccessFully",
"code": 200, // 200: OK 401: Invalid token 402: Invalid user information 505: Other Errors
"data": {
"mId": "b799e042b",
"mToken": "95116bd2af44b753da2a1e4cd55cf965" // got mToken
}
}
2
3
4
5
6
7
8
9
Name | Description |
---|---|
result | true if successful, false if failed |
message | Request result |
data | Detailed description |
code | 200: OK, 401: Invalid token, 402: Invalid user information, 505: Other Errors |
Step 3: Model configures their Lovense settings
Display the Lovense settings page on the model's side. You can put this page in a new window or an iframe.
After you modify your settings, the new settings will take around 10 seconds to take effect.
Settings page: https://api.lovense.com/api/cam/model/v2/setting?mToken={mToken}
Sample code:
lovense.settingPage = window.open(
"https://api.lovense.com/api/cam/model/v2/setting?mToken={mToken}"
)
2
3
or
<iframe
id="lovense-setting"
width="100%"
height="1500px"
scrolling="no"
src="https://api.lovense.com/api/cam/model/v2/setting?mToken={mToken}"
></iframe>
2
3
4
5
6
7
Step 4: Broadcasting process & methods
Include the model.js on your broadcasting page.
<script src="https://api.lovense.com/api/cam/model/v2/model.js?mToken={mToken}"></script>
Call lovense.addMessageListener(callback)
after the live page is loaded, and handle these types of messages in the callback function:
Events
message
lovense.addMessageListener(function (data) { // data = { // type: "message", // detail: "some customized messages to be sent to the public chat room." // e.g. detail = "My LOVENSE Lush is now reacting to john's tip. It will stop after 5 sec!" //} })
1
2
3
4
5
6
7settings
lovense.addMessageListener(function (data) { // Handle settings information // data = { // type: "settings", // detail: { // levels: { // level1: { // min: "1", // max: "9", // time: "2", // rLevel: 0, // vLevel: 0, // }, // level2: {...} // level3: {...} // }, // special: { // earthquake: { // time: "22", // token: "120", // }, // fireworks: (...), // giveControl: (...), // pause: (...), // pulse: (...), // random: (...), // twowaves: (...), // wave: (...), // } // } // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32toy
lovense.addMessageListener(function (data) { // Handle toy information data // data = { // type: "toy", // status: "on" // detail: [ // { // id: "l58f167da065", // name: "", // type: "lush", // status: "on" // } // ] // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15tipQueueStatus
lovense.addMessageListener(function (data) { // handle queue information data // data = { // type: "tipQueueStatus", // detail: { // running: [ // { // amount: 20, // tipperName: "john", // time: 30, // cParameter: {}, // level: 5, // module: "Basic Level" // specialType: undefined, // name: "coco", // reactToys: [, // toyId: "d6c35fe83348", // specialType: "earthquake", // status: 1, // toyType: "lush", // vibrate: 20, // rotate: 0, // airpump: 0, // ] // } // ], // queue: [ // { // amount: 20, // tipperName: "john", // } // ], // waiting: [...] // } // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36tipRunning
lovense.addMessageListener(function (data) { // handle running tip information // data = { // type: "tipRunning", // detail: { // running: [ // { // amount: 20, // tipperName: "john", // time: 30, // cParameter: {}, // level: 5, // module: "Basic Level" // specialType: undefined, // name: "coco", // reactToys: [, // toyId: "d6c35fe83348", // specialType: "earthquake", // status: 1, // toyType: "lush", // vibrate: 20, // rotate: 0, // airpump: 0, // ] // } // ] // } // } })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Methods
initCamApi
If your website is a single page application, when the model enters the broadcasting page call
initCamApi
./** * initCamApi * @param {string} mToken model token */ lovense.initCamApi(mToken)
1
2
3
4
5destroyCamApi
When the model ends the live broadcast or signs out, call
destroyCamApi
.lovense.destroyCamApi()
1receiveTip
Once a tip is received, call
Lovense.receiveTip(cname,amount)
. Toys will respond according to the settings./** * receiveTip * @param {string} cname this is the tipper’s Screen Name * @param {number} amount token amount */ lovense.receiveTip(cname, amount) // e.g. lovense.receiveTip('cname', 1)
1
2
3
4
5
6
7getToys
Use
getToys()
to get the toy info of models/** * getToys * @returns {array} toy information */ lovense.getToys()
1
2
3
4
5Return:
[ { "id": "XXXXXXXXXXXX", "name": "", "status": "on", "type": "lush" } ]
1
2
3
4
5
6
7
8getSettings
Use getSettings to get the settings info of models
/** * getSettings * @returns {object} settings information */ lovense.getSettings()
1
2
3
4
5Return:
{ levels: { level1: { max: 10, // tip level range maximum min: 3, // tip level range minimum rLevel: 0, // rotation level time: 3, // duration (seconds) vLevel: 5 // vibration level }, ... }, special: { clear: { token: 20 // number of tokens }, earthquake: (...), fireworks: (...), giveControl: (...), pause: (...), pulse: (...), random: (...), twowaves: (...), wave: (...) } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Display Panel (optional)
The Lovense Display Panel makes the show much more interactive compared to simple text based tip activation. We currently provide 2 panels for your tippers/viewers.
- Control Panel - This enables a new tip menu item called Give Control. It automatically generates a control link for the tipper when they tip for this item, allowing models to give direct control of their toys to tippers much more easily.
- Tip Panel - Show the model's tip menu directly on the viewer's page.
Step 1: Turn on the Display Panel on your Lovense Developer Dashboard
You will get a default AES KEY and AES IV that are used for encryption. Use them to encrypt the model name and the tipper name.
Step 2: Import the tipper.js to your tipper's page
<script src="https://api.lovense.com/api/cam/tipper/v2/tipper.js"></script>
Step 3: Initialize
Lovense.init(platform, modelKey, tipperKey)
Parameters
Name | Description | Required |
---|---|---|
platform | Your Website Name (shown in the Developer Dashboard) | yes |
modelKey | The model name encrypted on your server side using the AES KEY and AES IV. Do not expose your Key/IV in your JS code. (There is a demo on how to encrypt text using AES in JAVA below) | yes |
tipperKey | The tipper name encrypted using the AES KEY and AES IV (The tipper name should be the Display Name showing in the public broadcasting room) | yes |
⚠️ Display Panels are only available when the model is using Cam Extension version 30.0.8+
If your website is a single page application, when the tipper leaves the model's room, call:
Lovense.destroy()
Here is the demo on how to encrypt text using AES in JAVA:
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.AlgorithmParameters;
import java.security.Key;
public class AESDemo {
private static Key getKey(String key) throws Exception{
byte[] keyBytes = key.getBytes("UTF-8");
SecretKeySpec newKey = new SecretKeySpec(keyBytes, "AES");
return newKey;
}
private static AlgorithmParameters getIV(String iv) throws Exception {
byte[] ivs = iv.getBytes("UTF-8");
AlgorithmParameters params = AlgorithmParameters.getInstance("AES");
params.init(new IvParameterSpec(ivs));
return params;
}
public static String encrypt(String key,String iv,String text) throws Exception {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, getKey(key), getIV(iv));
byte[] encryptedBytes = cipher.doFinal(text.getBytes());
return new String(Base64.encodeBase64(encryptedBytes, false,true),"UTF-8");
}
public static String decrypt(String key,String iv,String text) throws Exception {
byte[] textBytes = Base64.decodeBase64(text);
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, getKey(key), getIV(iv));
byte[] decodedBytes = cipher.doFinal(textBytes);
return new String(decodedBytes, "UTF-8");
}
public static void main(String[] args) throws Exception{
String key="jHZZwiizsAF2qTAY"; //use your own Key here
String iv="zijknVpNWeeTYGPV"; //use your own IV here
String test="Hello World!";
System.out.println(encrypt(key,iv,test));;
System.out.println(decrypt(key,iv,encrypt(key,iv,test)));;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Step 4: Data Forwarding
Lovense will notify you when the Model Status has changed, and you should send the Model Status back to the tipper.js. Here is the Flow Chart:
How does it work?
Contact us to provide your callback URL. Lovense will post ModelStatus to your callback URL when necessary (for example, when the model enables/disables features during their broadcast). You forward the ModelStatus
to the tipper/viewer's page and reply to the callback request with "OK". Then call Lovense.recieveData(data)
on the tipper/viewer's page.
Description of the Callback Request
URL: your callback url
Request Protocol: HTTPS Request
Method: POST
Content Type: application/json
the ModelStatus Object::
{
"from":"ABCDxxxxxxxxxxxx", //Encrypted String using your AES KEY and IV
"to": {
"type":"customersOfModel", //which group of people you should forward to
"target":"Lucy,Tony" // users you should forward the data to
},
"data": data // the data you should forward
}
2
3
4
5
6
7
8
Attributes in ModelStatus
from
[String]: Encrypted string of "Lovense" using your AES KEY. If you can decrypt it with your AES KEY, you can confirm that the data is from Lovense. It is a static string until you changed your AES KEY in Lovense Dashboard.to
[Object]: Whom you should forward the data toto.type
[String]: Which group of people you should forward the data to. Possible values:customersOfModel
,customers
to.target
[String]: Users you should forward to- If the
to.type
iscustomersOfModel
, theto.target
is the model's name (separated with commas if there are multiple values), and you should forward the data to all the customers in the specified model's broadcasting room. - If the
to.type
iscustomer
, theto.target
is the tipper/viewer's screen name (separated with commas if there are multiple values), and you should forward the data to the specified tipper/viewer
- If the
data
[String]: the data that you should forward
Here is a sample written in JAVA for handling the callback from Lovense:
private final String KEY = "Your KEY";
private final String IV = "Your IV";
private final String AESFrom = AESUtil.encrypt("Lovense",KEY,IV);
@RequestMapping(value = "/lovense/callback")
public @ResponseBody String callback(@RequestBody Map<String,Object> modelStatus) {
//1. If from is same as AESFrom
if(AESFrom.equals(modelStatus.get("from"))){
Map<String,String> to = (Map<String, String>) modelStatus.get("to");
String data = (String) modelStatus.get("data");
//2. Handle different target groups
switch (to.get("type")){
case "customersOfModel":
String modelName = to.get("target");
//3.1 TODO forward `data` to the tippers/viewers in the model's room
break;
case "customer":
String customerScreenName = to.get("target");
//TODO forward `data` to the tippers/viewers
break;
default:
break;
}
}
//4. Reply "OK"
return "OK";
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Custom Cam Solution
Basic API
This API allows developers to access Lovense toys through simple HTTPS request. Configure your settings on our developer dashboard before getting started.
Step 1: Configure the developer dashboard
Go to the developer dashboardopen in new window, select "Standard API" tab, enter your application info.
Website Name: The name that will be displayed in Lovense Connect. Contact us if you want to change it.
Callback URL: This is the URL from your server where our app sends callback information.
Heartbeat: The callback interval for our app to update your server with the latest status.
Step 2: Connect to Lovense toy(s)
We offer 2 ways to connect to our toys.
Connect by Lovense Connect (iOS & Android version)
Users need to install Lovense Connect mobile app on their iOS/Android devices.
The user pairs their Lovense toy to the Lovense Connect app.
Get the QR code to connect to Lovense Connect.
Call Lovense Server API from your server
API URL:
https://api.lovense.com/api/lan/getQrCode
Notice: For security reasons, the developer token should be always used on the server side. You should never use it in your JS code from the client side.
Request Protocol: HTTPS Request
Method: POST
Content Type: application/json
Parameters:
Name Description Required token Developer Token yes uid User ID on your application yes uname User ID on your application no utoken User token from your website. This is for your own verification purposes. We suggest you generate a unique token for each user. This allows you to verify the user and avoid others faking the calls. no v version yes Request Example:
{ "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "42425232242", "v": 2 }
1
2
3
4
5Return:
{ code: 0 result: true message: "Success" data: { "qr": "https://test2.lovense.com/UploadFiles/qr/20220106/xxxx.jpg", // qrcode picture "code": "xxxx" } }
1
2
3
4
5
6
7
8
9API will return a JSON object that contains the QR code image URL. You will get:
Name Description code Error code message result result true if successful, false if failed data qrcode picture, code Display the QR code image to the user
Users scan the QR code using Lovense Connect.
Once the user scans the QR code with the Lovense Connect app, the app will invoke the callback URL you provided on the developer dashboard.
Here's the JSON data Lovense Connect app will post to your server:
{ uid: User ID utoken: xxx, // User token on your application domain: 192-168-0-11.lovense.club, // the domain name of the Lovense Connect app httpPort: 34567, // HTTP server port wsPort: 34567, // HTTP server port httpsPort: 34568, //HTTPS server port wssPort: 34568, // HTTPS server port platform: 'ios', // the Lovense Connect platform e.g. Android/iOS appVersion: '2.3.6', //the Lovense Connect version version: 101, // the protocol version e.g. 101 toys:{ toyId:{ id: xxxxxx, // Toy's ID name:"lush", // toy's name nickName: "nickName" status: 1 // e.g. 1/0 } } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20The domain and httpPort used to connect to Lovense Connect (iOS & Android) are returned.
Connect by Lovense Connect (PC & Mac version) on the same computer
Windows computers - Users need the Lovense USB Bluetooth Adapter.
Mac - Users can connect our toys directly to their Mac via Bluetooth.
- The user pairs their Lovense toy to Lovense Connect for PC/Mac.
Step 3: Command the toy(s)
Once everything is set up, you can command our toys:
- Local APIs: These APIs are exposed by Lovense Connect app through HTTPS. The connections are in the same LAN or the same computer.
- Server APIs: If your application can’t establish a LAN connection to the user’s Lovense Connect, you can use the Server API to connect the user’s toy.
By local application
⚠️ iOS Connect v2.6.4, Android Connect v2.7.7, PC Connect 1.5.4 are required.
If the user's device is in the same LAN environment, a POST request to Lovense Connect can be used to trigger a toy response. In this case, both your server and Lovense's server are not required.
If the user has Lovense Connect mobile, the domain
and httpsPort
are accessed from the callback information. If the user has Lovense Connect for PC/Mac, the domain
is 127-0-0-1.lovense.club
, and the httpsPort
is 30010
.
With the same command line, different parameters will lead to different results as below.
GetToys Request
Get the user's toy(s) information.
API URL:
https://{domain}:{httpsPort}/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes Request Example:
{ "command": "GetToys" }
1
2
3Response Example:
{ "code": 200, "data": { "toys": "{ \"fc9f37e96593\" : { \"id\" : \"fc9f37e96593\", \"status\" : \"1\", \"version\" : \"\", \"name\" : \"nora\", \"battery\" : 100, \"nickName\" : \"\" }}", "platform": "ios", "appType": "connect" }, "type": "OK" }
1
2
3
4
5
6
7
8
9Function Request
API URL:
https://{domain}:{httpsPort}/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes action Control the function and strength of the toy string Actions can be Vibrate, Rotate, Pump or Stop. Use Stop to stop the toy’s response.
Range:
Vibrate
:0
~20
Rotate
:0
~20
Pump
:0
~3
yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes loopRunningSec Running time double Should be greater than 1 no loopPauseSec Suspend time double Should be greater than 1 no toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate toy ff922f7fd345 at 16th strength, run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "command": "Function", "action": "Vibrate:16", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10// Vibrate 9 seconds at 2nd strength // Rotate toys 9 seconds at 3rd strength // Pump all toys 9 seconds at 4th strength // For all toys, it will run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "command": "Function", "action": "Vibrate:2,Rotate:3,Pump:4", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11
12Pattern Request
If you want to change the way the toy responds very frequently you can use a pattern request. To avoid network pressure and obtain a stable response, use the commands below to send your predefined patterns at once.
API URL:
https://{domain}:{httpsPort}/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes rule "V:1;F:vrp;S:1000#"
V:1; Protocol version, this is static;
F:vrp; Features: v is vibrate, r is rotate, p is pump, this should match the strength below;
S:1000; Intervals in Milliseconds, should be greater than 100.string The strength of r and p will automatically correspond to v. yes strength The pattern
For example: 20;20;5;20;10string No more than 50 parameters. Use semicolon ;
to separate each strength.yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will apply to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy as defined. The interval between changes is 1 second. Total running time is 9 seconds. { "command": "Pattern", "rule": "V:1;F:v;S:1000#", "strength": "20;20;5;20;10", "timeSec": 9, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8
9// Vibrate the toys as defined. The interval between changes is 0.1 second. Total running time is 9 seconds. // If the toys include Nora or Max, they will automatically rotate or pump, you don't need to define it. { "command": "Pattern", "rule": "V:1;F:vrp;S:100#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9Preset Request
API URL: https://{domain}:{httpsPort}/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes name Preset pattern name string We provide four preset patterns in the Lovense Connect app: pulse, wave, fireworks, earthquake yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy with pulse pattern, the running time is 9 seconds. { "command": "Preset", "name": "pulse", "timeSec": 9, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8
Response Example:
{
"code": 200,
"type": "ok"
}
2
3
4
Error Codes:
Code | Message |
---|---|
500 | HTTP server not started or disabled |
400 | Invalid Command |
401 | Toy Not Found |
402 | Toy Not Connected |
403 | Toy Doesn't Support This Command |
404 | Invalid Parameter |
506 | Server Error. Restart Lovense Connect. |
By server
If your application can’t establish a LAN connection to the user’s Lovense Connect, you can use the Server API to connect the user’s toy.
⚠️ Coming soon to PC Connect.
Function Request
API URL:
https://api.lovense.com/api/lan/v2/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Request Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string To send commands to multiple users at the same time, add all the user IDs separated by commas. The toy parameter below will be ignored and the commands will go to all user toys by default. yes command Type of request String / yes action Control the function and strength of the toy string Actions can be Vibrate, Rotate, Pump or Stop. Use Stop to stop the toy’s response.
Range:
Vibrate
:0
~20
Rotate
:0
~20
Pump
:0
~3
yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes loopRunningSec Running time double Should be greater than 1 no loopPauseSec Suspend time double Should be greater than 1 no toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate toy ff922f7fd345 at 16th strength, run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1132fsdfsd", "command": "Function", "action": "Vibrate:16", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11// Vibrate 9 seconds at 2nd strength // Rotate toys 9 seconds at 3rd strength // Pump all toys 9 seconds at 4th strength // For all toys, it will run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1132fsdfsd", "command": "Function", "action": "Vibrate:2,Rotate:3,Pump:4", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11
12
13
14// Stop all toys { "command": "Function", "action": "Stop", "timeSec": 0, "apiVer": 1 }
1
2
3
4
5
6
7Pattern Request
If you want to change the way the toy responds very frequently you can use a pattern request. To avoid network pressure and obtain a stable response, use the commands below to send your predefined patterns at once.
API URL:
https://api.lovense.com/api/lan/v2/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string To send commands to multiple users at the same time, add all the user IDs separated by commas. The toy parameter below will be ignored and the commands will go to all user toys by default. yes command Type of request String / yes rule "V:1;F:vrp;S:1000#"
V:1; Protocol version, this is static;
F:vrp; Features: v is vibrate, r is rotate, p is pump,this should match the strength below;
S:1000; Intervals in Milliseconds, should be greater than 100.string The strength of r and p will automatically correspond to v. yes strength The pattern
For example: 20;20;5;20;10string No more than 50 parameters. Use semicolon ;
to separate every strength.yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will apply to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy as defined. The interval between changes is 1 second. Total running time is 9 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1ads22adsf", "command": "Pattern", "rule": "V:1;F:v;S:1000#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10// Vibrate the toys as defined. The interval between changes is 0.1 second. Total running time is 9 seconds. // If the toys include Nora or Max, they will automatically rotate or pump, you don't need to define it. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1ads22adsf", "command": "Pattern", "rule": "V:1;F:vrp;S:100#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11Preset Request
API URL:
https://api.lovense.com/api/lan/v2/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Request Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string To send commands to multiple users at the same time, add all the user IDs separated by commas. The toy parameter below will be ignored and the commands will go to all user toys by default. yes command Type of request String / yes name Preset pattern name string We provide four preset patterns in the Lovense Remote app: pulse, wave, fireworks, earthquake yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy with pulse pattern, the running time is 9 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1adsf2323", "command": "Preset", "name": "pulse", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
Response Example:
{
"result": true,
"code": 200,
"message": "Success"
}
2
3
4
5
Server Error Codes:
Code | Message |
---|---|
200 | Success |
400 | Invalid command |
404 | Invalid Parameter |
501 | Invalid token |
502 | You do not have permission to use this API |
503 | Invalid User ID |
507 | Lovense APP is offline |
Basic JS API
This solution allows you to control Lovense toys through your webpage.
Your users must pair their toy(s) to the Lovense Connect app for mobile or PC.
⚠️ iOS Connect v2.6.4+, Android Connect v2.7.7+, or PC Connect 1.5.4+ is required.
⚠️ User's devices must be in the same LAN.
Step 1: Set your callback URL
Go to the developer dashboardopen in new window and set your Callback URL.
Step 2: Import the LAN.JS to your user's page
Add our LAN.JS to your user's page.
<script src="https://api.lovense.com/api/lan/v2/lan.js"></script>
Step 3: Handle the callback data from Lovense Connect
You can listen to the callback from Lovense Connect as below:
// the path should be the same as you set in the Lovense developer dashboard
@RequestMapping(value = "/api/lovense/callback")
public @ResponseBody
MessageResponse callback(@RequestBody Map body) {
//TODO
//send the callback data to the user's page and call `lovense.setConnectCallbackData` there
return new MessageResponse(true, "success");
}
2
3
4
5
6
7
8
Call lovense.setConnectCallbackData
with the callback data you received from Lovense Connect in the user's page to initialize the LAN.JS.
lovense.setConnectCallbackData(callbackData)
⚠️ If the user uses Lovense Connect for PC, this step can be skipped because a QR code is not required.
Step 4: Command the toy(s)
Send commands to Lovense toy(s) by calling lovense.sendCommand(parameters)
.
For the parameters list, see Command the toy(s).
Example:
lovense.sendCommand({
command: "Function",
action: "Vibrate:16",
timeSec: 20,
loopRunningSec: 9,
loopPauseSec: 4,
toy: "ff922f7fd345",
apiVer: 1,
})
2
3
4
5
6
7
8
9
Other methods
getToys
Get all toys, it will return all toys as an array
lovense.getToys()
1getOnlineToys
Get all online toys, it will only return the connected toys as an array
lovense.getOnlineToys()
1isToyOnline
Determine whether the toy is connected, it will return
true
as long as there is a toy connected.lovense.isToyOnline()
1openMobileConnect
Open Lovense Mobile Connect.
lovense.openMobileConnect()
1
Standard Solutions
These solutions allow you to control users' Lovense toys by simple HTTPS request.
If you want to integrate with your website or web app, we suggest you use our Standard JS API.
If you integrate a Standard Solution, your users must use Lovense Remote to pair their toys. Lovense Remote is available on Google Play and the App Store.
Standard API
This API allows any application to access its users Lovense toys from the developer side.
Step 1: Configure the developer dashboard
Go to the developer dashboardopen in new window and set your Callback URL.
Step 2: Find your user's toy(s)
Get your developer token from the Lovense developer dashboard.
Your server calls Lovense server's API (use POST request)
For example:
String url= "https://api.lovense.com/api/lan/getQrCode"; Map<String, String> requestParameter = new HashMap<String, String>(); //TODO initialize your parameters: requestParameter.put("token", "{Lovense developer token}"); requestParameter.put("uid", "{user ID on your website}"); requestParameter.put("uname", "{user nickname on your website}"); requestParameter.put("utoken", "{Encrypted user token on your application. This is a security consideration, to avoid others stealing control of the toy.}"); requestParameter.put("v", 2); HttpPost httpPost = new HttpPost(url); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); if (requestParameter != null && !requestParameter.isEmpty()) { Set<String> keys = requestParameter.keySet(); for (String key : keys) { nameValuePairs.add(new BasicNameValuePair(key, requestParameter.get(key))); } } httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8"));
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17const result = async axios.post('https://api.lovense.com/api/lan/getQrCode', { token: 'your developer token', // Lovense developer token uid: '11111', // user ID on your website uname: 'user name', // user nickname on your website utoken: md5(uid + 'salt') // This is for your own verification purposes. We suggest you to generate a unique token/secret for each user. This allows you to verify the user and avoid others faking the calls. v: 2 } )
1
2
3
4
5
6
7
8
9You will get:
{ code: 0 message: "Success" result: true data: { "qr": "https://test2.lovense.com/UploadFiles/qr/20220106/xxx.jpg", // QR code picture "code": "xxxxxx" } }
1
2
3
4
5
6
7
8
9Once the user scans the QR code with the Lovense Remote app, the app will invoke the Callback URL you've provided in the developer dashboard. The Lovense server is no longer required. All communications will go from the app to your server directly.
Here's the JSON data Lovense Remote app will post to your server:
{ "uid": "xxx", "appVersion": "4.0.3", "toys": { "xxxx": { "nickName": "", "name": "max", "id": "xxxx", "status": 1 } }, "wssPort": "34568", "httpPort": "34567", "wsPort": "34567", "appType": "remote", "domain": "192-168-1-44.lovense.club", "utoken": "xxxxxx", "httpsPort": "34568", "version": "101", "platform": "android" }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Step 3: Command the toy(s)
Note: iOS Remote 5.1.4+, Android Remote 5.1.1+, or PC Remote 1.5.8+ is required.
By local application
If the user's device is in the same LAN environment, a POST request to Lovense Remote can trigger a toy response. In this case, your server and Lovense's server are not required.
If the user uses the mobile version of Lovense Remote app, the domain
and httpsPort
are accessed from the callback information. If the user uses Lovense Remote for PC, the domain
is 127-0-0-1.lovense.club
, and the httpsPort
is 30010
With the same command line, different parameters will lead to different results as below.
GetToys Request
Get the user's toy(s) information.
API URL:
https://{domain}:{httpsPort}/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes Request Example:
{ "command": "GetToys" }
1
2
3Response Example:
{ "code": 200, "data": { "toys": "{ \"fc9f37e96593\" : { \"id\" : \"fc9f37e96593\", \"status\" : \"1\", \"version\" : \"\", \"name\" : \"nora\", \"battery\" : 100, \"nickName\" : \"\" }}", "platform": "ios", "appType": "remote" }, "type": "OK" }
1
2
3
4
5
6
7
8
9Function Request
API URL:
https://{domain}:{httpsPort}/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes action Control the function and strength of the toy string Actions can be Vibrate, Rotate, Pump or Stop. Use Stop to stop the toy’s response.
Range:
Vibrate
:0
~20
Rotate
:0
~20
Pump
:0
~3
yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes loopRunningSec Running time double Should be greater than 1 no loopPauseSec Suspend time double Should be greater than 1 no toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate toy ff922f7fd345 at 16th strength, run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "command": "Function", "action": "Vibrate:16", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10// Vibrate 9 seconds at 2nd strength // Rotate toys 9 seconds at 3rd strength // Pump all toys 9 seconds at 4th strength // For all toys, it will run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "command": "Function", "action": "Vibrate:2,Rotate:3,Pump:4", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11
12// Stop all toys { "command": "Function", "action": "Stop", "timeSec": 0, "apiVer": 1 }
1
2
3
4
5
6
7Pattern Request
If you want to change the way the toy responds very frequently you can use a pattern request. To avoid network pressure and obtain a stable response, use the commands below to send your predefined patterns at once.
API URL:
https://{domain}:{httpsPort}/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes rule "V:1;F:vrp;S:1000#"
V:1; Protocol version, this is static;
F:vrp; Features: v is vibrate, r is rotate, p is pump,this should match the strength below;
S:1000; Intervals in Milliseconds, should be greater than 100.string The strength of r and p will automatically correspond to v. yes strength The pattern
For example: 20;20;5;20;10string No more than 50 parameters. Use semicolon ;
to separate every strength.yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will apply to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy as defined. The interval between changes is 1 second. Total running time is 9 seconds. { "command": "Pattern", "rule": "V:1;F:v;S:1000#", "strength": "20;20;5;20;10", "timeSec": 9, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8
9// Vibrate the toys as defined. The interval between changes is 0.1 second. Total running time is 9 seconds. // If the toys include Nora or Max, they will automatically rotate or pump, you don't need to define it. { "command": "Pattern", "rule": "V:1;F:vrp;S:100#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9Preset Request
API URL: https://{domain}:{httpsPort}/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required command Type of request String / yes name Preset pattern name string We provide four preset patterns in the Lovense Remote app: pulse, wave, fireworks, earthquake yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy with pulse pattern, the running time is 9 seconds. { "command": "Preset", "name": "pulse", "timeSec": 9, "toy": "ff922f7fd345", "apiVer": 1 }
1
2
3
4
5
6
7
8Response Example:
{ "code": 200, "type": "ok" }
1
2
3
4Error Codes:
Code Message 500 HTTP server not started or disabled 400 Invalid Command 401 Toy Not Found 402 Toy Not Connected 403 Toy Doesn't Support This Command 404 Invalid Parameter 506 Server Error. Restart Lovense Connect.
By server
If your application can’t establish a LAN connection to the user’s Lovense Remote app, you can use the Server API to connect the user’s toy.
⚠️ If you are using Lovense Remote for PC, you need to enter a code to establish connection. Use the code generated alongside the QR code in step 2 above.
Function Request
API URL:
https://api.lovense.com/api/lan/v2/command
Request Protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Request Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string To send commands to multiple users at the same time, add all the user IDs separated by commas. The toy parameter below will be ignored and the commands will go to all user toys by default. yes command Type of request String / yes action Control the function and strength of the toy string Actions can be Vibrate, Rotate, Pump or Stop. Use Stop to stop the toy’s response.
Range:
Vibrate
:0
~20
Rotate
:0
~20
Pump
:0
~3
yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes loopRunningSec Running time double Should be greater than 1 no loopPauseSec Suspend time double Should be greater than 1 no toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate toy ff922f7fd345 at 16th strength, run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1132fsdfsd", "command": "Function", "action": "Vibrate:16", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11// Vibrate 9 seconds at 2nd strength // Rotate toys 9 seconds at 3rd strength // Pump all toys 9 seconds at 4th strength // For all toys, it will run 9 seconds then suspend 4 seconds. It will be looped. Total running time is 20 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1132fsdfsd", "command": "Function", "action": "Vibrate:2,Rotate:3,Pump:4", "timeSec": 20, "loopRunningSec": 9, "loopPauseSec": 4, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11
12
13
14Pattern Request
If you want to change the way the toy responds very frequently you can use a pattern request. To avoid network pressure and obtain a stable response, use the commands below to send your predefined patterns at once.
API URL:
https://api.lovense.com/api/lan/v2/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Response Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string yes command Type of request String / yes rule "V:1;F:vrp;S:1000#"
V:1; Protocol version, this is static;
F:vrp; Features: v is vibrate, r is rotate, p is pump,this should match the strength below;
S:1000; Intervals in Milliseconds, should be greater than 100.string The strength of r and p will automatically correspond to v. yes strength The pattern
For example: 20;20;5;20;10string No more than 50 parameters. Use semicolon ;
to separate every strength.yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will apply to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy as defined. The interval between changes is 1 second. Total running time is 9 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1ads22adsf", "command": "Pattern", "rule": "V:1;F:v;S:1000#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10// Vibrate the toys as defined. The interval between changes is 0.1 second. Total running time is 9 seconds. // If the toys include Nora or Max, they will automatically rotate or pump, you don't need to define it. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1ads22adsf", "command": "Pattern", "rule": "V:1;F:vrp;S:100#", "strength": "20;20;5;20;10", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
10
11Preset Request
API URL:
https://api.lovense.com/api/lan/v2/command
Request protocol: HTTPS Request
Method: POST
Request Content Type: application/json
Request Format: JSON
Parameters:
Name Description Type Note Required token Your developer token string yes uid Your user’s ID string yes command Type of request String / yes name Preset pattern name string We provide four preset patterns in the Lovense Remote app: pulse, wave, fireworks, earthquake yes timeSec Total running time double 0 = indefinite length
Otherwise, running time should be greater than 1.yes toy Toy ID string Optional, if you don’t include this, it will be applied to all toys no apiVer The version of the request int Always use 1 yes Request Example:
// Vibrate the toy with pulse pattern, the running time is 9 seconds. { "token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n", "uid": "1adsf2323", "command": "Preset", "name": "pulse", "timeSec": 9, "apiVer": 1 }
1
2
3
4
5
6
7
8
9
Response Example:
{
"result": true,
"code": 200,
"message": "Success"
}
2
3
4
5
Server Error Codes:
Code | Message |
---|---|
200 | Success |
400 | Invalid command |
404 | Invalid Parameter |
501 | Invalid token |
502 | You do not have permission to use this API |
503 | Invalid User ID |
507 | Lovense APP is offline |
Standard JS API
This solution allows you to control Lovense toys through your webpage.
Your users must use the Lovense Remote mobile app.
⚠️ iOS Remote v5.2.5+ or Android Remote v5.2.1+ is required.
⚠️ The user's devices must be in the same LAN.
Step 1: Set your Callback URL
Go to the developer dashboardopen in new window and set your Callback URL.
Step 2: Import LAN.JS to your user's page
Add the LAN.JS to your user's page:
<script src="https://api.lovense.com/api/lan/v2/lan.js"></script>
Step 3: Handle the callback data from Lovense Remote
You can listen to the callback from Lovense Remote as below:
// the path should be the same as you set in the Lovense developer dashboard
@RequestMapping(value = "/api/lovense/callback")
public @ResponseBody
MessageResponse callback(@RequestBody Map body) {
//TODO
//send the callback data to the user's page and call `lovense.setConnectCallbackData` there
return new MessageResponse(true, "success");
}
2
3
4
5
6
7
8
Call lovense.setConnectCallbackData
to set when you receive the callback data from Lovense Remote.
lovense.setConnectCallbackData(callbackData)
⚠️ If the user uses Lovense Connect for PC, this step can be skipped because a QR code is not required.
Step 4: Command the toy(s)
Send commands/vibrations to Lovense toy(s) by calling lovense.sendCommand(parameters)
.
For the parameters list, see Command the toy(s).
Example:
lovense.sendCommand({
command: "Function",
action: "Vibrate:16",
timeSec: 20,
loopRunningSec: 9,
loopPauseSec: 4,
toy: "ff922f7fd345",
apiVer: 1,
})
2
3
4
5
6
7
8
9
Other methods
getToys
Get all toys, it will return all toys as an array
lovense.getToys()
1getOnlineToys
Get all online toys, it will only return the connected toys as an array
lovense.getOnlineToys()
1isToyOnline
Determine whether the toy is connected, it will return
true
as long as there is a toy connected.lovense.isToyOnline()
1openMobileRemote
Open Lovense Mobile Remote.
lovense.openMobileRemote()
1
Native SDK
iOS SDK
The Lovense iOS SDK is a set of application interfaces based on iOS 8.0 and above. Use this SDK to develop applications for iOS mobile devices. By calling the Lovense SDK interface, you can easily control Lovense toys and build applications with rich functions and strong interactivity.
Step 1: Get your developer token
Go to the developer dashboardopen in new window and get your developer token.
Step 2: Download and extract the Lovense SDK
Step 3: Include the SDK in your project
Copy the following files to your project main directory.
Add the required framework Lovense.framework
to your project.
Configure environment: TARGETS -> General -> Deployment Info -> Deployment Target -> setting 8.0 or above.
Step 4: Connect Lovense toys and send commands
// import Lovense
#import <Lovense/Lovense.h>
// Pass your token into the Lovense framework
[[Lovense shared] setDeveloperToken:@"Your token"];
// Add a scan success notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanSuccessCallback:)
name:kToyScanSuccessNotification object:nil]; //Scanning toy success notification
-(void)scanSuccessCallback:(NSNotification *)noti
{
NSDictionary * dict = [noti object];
NSArray <LovenseToy*>* toys = [dict objectForKey:@"scanToyArray"];
}
// Add a connect success notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectSuccessCallback:)
name:kToyConnectSuccessNotification object:nil]; //Connected toy successfully notification
-(void)connectSuccessCallback:(NSNotification *)noti
{
NSDictionary * dict = [noti object];
LovenseToy * toy = [dict objectForKey:@"toy"];
NSLog(@"%@",toy);
}
// Search for the toys over Bluetooth
[[Lovense shared] searchToys];
// Save the toys
[[Lovense shared] saveToys:toys];
// Retrieve the saved toys
NSArray<LovenseToy*> * listToys = [[Lovense shared] listToys];
// Connect the toy
[[Lovense shared] connectToy:toyId];
// Disconnect the toy
[[Lovense shared] disconnectToy:toyId];
// Send a command to the toy
[[LovenseBluetoothManager shared] sendCommandWithToyId:toyId
andCommandType:COMMAND_VIBRATE andParamDict:@{kSendCommandParamKey
_VibrateLevel:@(20)}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Create YourProjectName-Bridging-Header.h
// Import Lovense
#import <Lovense/Lovense.h>
// Pass your token into Lovense framework
Lovense.shared().setDeveloperToken("token")
//Add a scan success notification
NotificationCenter.default.addObserver(self, selector: #selector(scanSuccessCallback),
name: NSNotification.Name(rawValue: kToyScanSuccessNotification), object: nil)
//Scanning toy success notification
@objc func scanSuccessCallback(nofi : Notification)
{
let dict = nofi.object as? [String, LovenseToy]
let scanToyArr = dict?["scanToyArray"]
}
//Add a connect success notification
NotificationCenter.default.addObserver(self, selector: #selector(connectSuccessCallback),
name: NSNotification.Name(rawValue: kToyConnectSuccessNotification), object: nil)
//Connected toy successfully notification
@objc func connectSuccessCallback(nofi : Notification)
{
let dict = nofi.object as? [LovenseToy]
let toy = dict?["toy"]
}
// Search the toys over Bluetooth
Lovense.shared().searchToys()
//Save the toys
Lovense.shared().save(toys)
// Retrieve the saved toys
Lovense.shared().listToys()
// Connect the toy
Lovense.shared().connectToy("toyId")
// Disconnect the toy
Lovense.shared().disconnectToy("toyId")
// Send a command to the toy
Lovense.shared().sendCommand(withToyId: "ToyId",
andCommandType: COMMAND_VIBRATE,
andParamDict: [kSendCommandParamKey_VibrateLevel:20])
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Command list
Command | Description |
---|---|
COMMAND_VIBRATE | Vibrate the toy. The parameter must be between 0 and 20. |
COMMAND_ROTATE | Rotate the toy. The parameter must be between 0 and 20. |
COMMAND_ROTATE_CLOCKWISE | Rotate clockwise. The parameter must be between 0 and 20. |
COMMAND_ROTATE_ANTI_CLOCKWISE | Rotate anti-clockwise. The parameter must be between 0 and 20. |
COMMAND_ROTATE_CHANGE | Change the rotation direction |
COMMAND_AIR_IN | Airbag inflation for n seconds. The parameter must be between 1 and 3. |
COMMAND_AIR_OUT | Airbag deflation for n seconds. The parameter must be between 1 and 3. |
COMMAND_AIR_AUTO | Cycle airbag inflation for n seconds and air deflation for n seconds. The parameter must be between 0 and 3 (0 means stop). |
COMMAND_VIBRATE1 | Activate the first vibrator at level n. The parameter must be between 0 and 20. |
COMMAND_VIBRATE2 | Activate the second vibrator at level n. The parameter must be between 0 and 20. |
COMMAND_VIBRATE_FLASH | Vibrate the toy at level n and flash the light at the same time. |
COMMAND_FLASH | Flash the light 3 times |
COMMAND_LIGHT_OFF | Turn off the light (saved permanently). |
COMMAND_LIGHT_ON | Turn on the light (saved permanently). |
COMMAND_GET_LIGHT_STATUS | Get the light's status (1: on, 0: off) |
COMMAND_ALIGHT_OFF | Turn off Domi/Domi 2 light (saved permanently) |
COMMAND_ALIGHT_ON | Turn on the Domi/Domi 2 light (saved permanently) |
COMMAND_GET_ALIGHT_STATUS | Get the Domi/Domi 2 light status (1: on, 0: off) |
COMMAND_GET_BATTERY | Get battery status |
COMMAND_GET_DEVICE_TYPE | Get device/toy information |
COMMAND_START_MOVE | Start tracking the toy movement (0-4) |
COMMAND_STOP_MOVE | Stop tracking the toy movement |
COMMAND_PRESET | Vibrate with a preset pattern. Patterns range from 1 to 10. n=0 will stop vibrations. |
Callback list
Callback | Description |
---|---|
kToyScanSuccessNotification | Found toys |
kToyConnectSuccessNotification | Toy connected |
kToyConnectFailNotification | Failed to connect a toy |
kToyConnectBreakNotification | Toy disconnection |
kToySendCommandErrorNotification | Unknown command received |
kToyCallbackNotificationBattery | Battery status |
kToyCallbackNotificationDeviceType | Device information |
kToyCallbackNotificationGetLightStatus | Light indicator |
kToyCallbackNotificationGetAidLightStatus | Domi/Domi 2 light indicator |
kToyCallbackNotificationListenMove | Toy movement updates |
kToyCommandCallbackNotificationAtSuccess | Successful command |
kToyCommandCallbackNotificationAtError | Command error |
Android SDK
The Lovense Android SDK is a set of application interfaces based on Android 4.3 and above. Use this SDK to develop applications for Android mobile devices. By calling the Lovense SDK interface, you can easily control Lovense toys and build applications with rich functions and strong interactivity.
Step 1: Get the developer token
Go to the developer dashboardopen in new window and get your developer token.
Step 2: Download and extract the Lovense SDK
Step 3: Include SDK and Configure
Copy the following file to your
libs
directory.Add
lovense.arr
to your app build.gradle. Configurelibs
in the program build.gradle.app build.gradle:
implementation files ('libs/lovense.aar')
program build.gradle:
Configure permissions and register service in AndroidManifest.xml
Permission list
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
1
2
3
4
5
6Register service
<service android:name="com.xtremeprog.sdk.ble.BleService" android:enabled="true" />
1
Step 4: Connect Lovense toys and send commands
// Pass your token into the Lovense framework
Lovense.getInstance(getApplication()).setDeveloperToken("Your token");
// Add a scan success notification
Lovense.getInstance(getApplication()).searchToys(new OnSearchToyListener() {
@Override
public void onSearchToy(LovenseToy lovenseToy) { } // Find toys
@Override
public void finishSearch() { } // Scan finish
@Override
public void onError(LovenseError msg) { } // error
});
//Add a connection success notification
Lovense.getInstance(getApplication()).connectToy(toyId, new OnConnectListener() {
@Override
public void onConnect(String toyId,String status) { // Toy connection status
switch (status) {
case LovenseToy.STATE_CONNECTING:
break;
case LovenseToy.STATE_CONNECTED:
break;
case LovenseToy.STATE_FAILED:
break;
case LovenseToy.SERVICE_DISCOVERED:
break;
}
}
@Override
public void onError(LovenseError lovenseError) {} // Connection error
});
// Add sending command notification
Lovense.getInstance(getApplication()).addListener(toyId, new OnCallBack() {});
// Search for the toys over Bluetooth
Lovense.getInstance(getApplication()).addListener(toyId, new OnCallBack() {});
//Stop searching for toys
Lovense.getInstance(getApplication()).stopSearching();
// Save the toys
Lovense.getInstance(getApplication()).saveToys(lovenseToys, new OnErrorListener());
// Retrieve the saved toys
Lovense.getInstance(getApplication()).listToys(new OnErrorListener());
// Connect the toy
Lovense.getInstance(getApplication()).connectToy(toyId,new OnConnectListener());
// Disconnect the toy
Lovense.getInstance(getApplication()).disconnect(toyId);
// Send a command to the toy
Lovense.getInstance(getApplication()).sendCommand(toyId,LovenseToy.COMMAND _VIBRATE,vibrateLevel);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Command list
Command | Description |
---|---|
COMMAND_VIBRATE | Vibrate the toy. The parameter must be between 0 and 20. |
COMMAND_ROTATE | Rotate the toy. The parameter must be between 0 and 20. |
COMMAND_ROTATE_CLOCKWISE | Rotate clockwise. The parameter must be between 0 and 20. |
COMMAND_ROTATE_ANTI_CLOCKWISE | Rotate anti-clockwise. The parameter must be between 0 and 20. |
COMMAND_ROTATE_CHANGE | Change the rotation direction |
COMMAND_AIR_IN | Airbag inflation for n seconds. The parameter must be between 1 and 3. |
COMMAND_AIR_OUT | Airbag deflation for n seconds. The parameter must be between 1 and 3. |
COMMAND_AIR_AUTO | Cycle airbag inflation for n seconds and air deflation for n seconds. The parameter must be between 0 and 3 (0 means stop). |
COMMAND_VIBRATE1 | Activate the first vibrator at level n. The parameter must be between 0 and 20. |
COMMAND_VIBRATE2 | Activate the second vibrator at level n. The parameter must be between 0 and 20. |
COMMAND_VIBRATE_FLASH | Vibrate the toy at level n and flash the light at the same time. |
COMMAND_FLASH | Flash the light 3 times |
COMMAND_LIGHT_OFF | Turn off the light (saved permanently). |
COMMAND_LIGHT_ON | Turn on the light (saved permanently). |
COMMAND_GET_LIGHT_STATUS | Get the light's status (1: on, 0: off) |
COMMAND_ALIGHT_OFF | Turn off Domi/Domi 2 light (saved permanently) |
COMMAND_ALIGHT_ON | Turn on the Domi/Domi 2 light (saved permanently) |
COMMAND_GET_ALIGHT_STATUS | Get the Domi/Domi 2 light status (1: on, 0: off) |
COMMAND_GET_BATTERY | Get battery status |
COMMAND_GET_DEVICE_TYPE | Get device/toy information |
COMMAND_START_MOVE | Start tracking the toy movement (0-4) |
COMMAND_STOP_MOVE | Stop tracking the toy movement |
COMMAND_PRESET | Vibrate with a preset pattern. Patterns range from 1 to 10. n=0 will stop vibrations. |
Callback list
Callback | Description |
---|---|
OnSearchToyListener | Found toy list |
OnConnectListener | Toy connected status |
OnSendCommandErrorListener | Send Command error, extends OnCallBack |
OnCallBackBatteryListener | Battery status, extends OnCallBack |
OnCallBackDeviceTypListener | Device information, extends OnCallBack |
OnCallBackLightStatusListener | Light indicator, extends OnCallBack |
OnCallBackAidLightStatusListener | Domi/Domi 2 light indicator, extends OnCallBack |
OnCallBackMoveListener | Toy movement updates, extends OnCallBack |
OnCommandSuccessListener | Command success, extends OnCallBack |
OnCommandErrorListener | Command Error, extends OnCallBack |
Windows SDK
The Windows SDK is a library provided for Windows that allows you to directly access Lovense toys. You usually choose this option if you are making your own Windows application.
Step 1: Get your developer token
Go to the developer dashboardopen in new window and get your developer token.
Note: You need to fill in your developer token when using the SDK.
Step 2: Download SDK
Step 3: Configure the SDK in your application
For example, the method below is to configure SDK in Visual Studio 2019
Set the path of the SDK header file
Set the path of SDK lib file
Step 4: Connect Lovense toys and send commands
#include <Lovense.h>
...
class CEventCallBack: public ILovenseSDKNotify
{
public:
/*Call when toy search start*/
virtual void LovenseDidSearchStart();
/*Call when toy searching toy*/
virtual void LovenseSearchingToys(lovense_toy_info_t *info) = 0;
/*Call when something went wrong*/
virtual void LovenseErrorOutPut(int errorCode,const char *errorMsg) = 0;
/*Call when toy search end*/
virtual void LovenseDidSearchEnd();
/*Call when send cmd start*/
virtual void LovenseDidSendCmdStart();
/*Call when send cmd return*/
virtual void LovenseSendCmdResult(const char * szToyID, CLovenseToy::CmdType cmd,const char *result,CLovenseToy::Error errorCode);
/*Call when send cmd end*/
virtual void LovenseDidSendCmdEnd();
/*Call when toy connected, or disconnected*/
virtual void LovenseToyConnectedStatus(const char *szToyID, bool isConnected) ;
};
...
//TODO:This is a simple process
CEventCallBack *callBack = new CEventCallBack();
CLovenseToyManager *manager = GetLovenseToyManager();
manager->SetDeveloperToken(...);
manager->RegisterEventCallBack(callBack);
manager->StartSearchToy();//Search for the toys via USB Dongle
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Send a command
CLovenseToyManager *manager = GetLovenseToyManager();
//Send a vibration command
manager->SendCommand(toyID,CLovenseToy::CmdType::COMMAND_VIBRATE,10);
2
3
4
For a list of supported commands, check LovenseDef.h
namespace CLovenseToy
{
typedef enum {
/**
-Power off!
- param Key = no parameter
*/
COMMAND_POWER_OFF = 100,
/**
- Vibrate the toy. The parameter must be between 0 and 20!
- Supported toys = all
*/
COMMAND_VIBRATE = 101,
/**
- Rotate the toy. The parameter must be between 0 and 20!
- Supported toys = Nora
*/
COMMAND_ROTATE = 102,
.
.
.
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Setup
- Insert the Lovense USB Bluetooth Adapter into the PC.
- Turn on the toy. The light will begin flashing.
- Open your application and search for the toy to establish a connection.
Tips
- When searching for toys, do not send other commands to toys.
- If you need to get the toy's battery level frequently, start a thread loop.
- For best results, don't sent toy commands more than once per second.
- First time users, refer to our SDK Demo linked above.
View log output
To view log output, use the editbin command.
Note: If there is an "editbin not found" error when compiling, here is a solutionopen in new window.