XP API Documentation Recent
This interface can be accessed using HTTP and WebSocket. Both port numbers are 9911.
HTTP Request
- Interface address:
http://IP_ADDRESS:9911/api - Example:
http://127.0.0.1:9911/api - Request methods:
GET,POST (JSON),POST (form)
WebSocket Request
Using WebSocket provides faster response but is more complex. All request results are in the callback function. Requires async-to-sync conversion for sequential operations.
- Interface address:
ws://SERVER_ADDRESS:9911/api - Example:
ws://127.0.0.1:9911/api - Request format:
json
Each interface has a msgid field returned as-is by the server for async-to-sync conversion.
Response Format
All interfaces return status 200 for success. Failure info is in message. Actual execution result is in data.
Error Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | ID does not exist |
| 2 | Device is not bound to hardware |
| 3 | Hardware not connected |
| 4 | Collection failed |
| 5 | A device is collecting |
| 6 | Device ID is not collecting mouse |
| 7 | Device ID does not exist or device is online |
| 8 | Scan code opened successfully |
| 9 | Enter the collection page |
| 10 | Hardware ID is empty |
| 11 | No mouse parameters |
| 12 | Hardware and mobile phone connection |
| 13 | Hardware is not connected to the phone |
| 14 | Start working |
| 15 | No coordinates |
| 16 | Hardware is not working (unknown error) |
| 17 | Retry on failure |
| 18 | Failure stop |
| 19 | Hardware and computer connection |
| 20 | Hardware disconnected from computer |
| 21 | At work |
| 22 | Equipment online |
| 23 | Hardware unbound device |
| 24 | Hardware not turned on |
| 25 | Device is offline |
| 26 | Screenshot failed |
| 27 | Path does not exist |
| 28 | Plugin not connected |
| 29 | Calling the plugin interface times out |
| 30 | Call timeout |
| 31 | OCR did not recognize text |
| 32 | No text found |
| 33 | Fail |
| 34 | Remove device from group first |
| 35 | File list is empty or files don't exist |
| 36 | Parameter error |
| 37 | Login failed |
| 38 | Registration failed |
| 39 | Password reset failed |
| 40 | Failed to send verification code |
| 41 | Incompatible commands |
API Sections
- Equipment Related - Device management, grouping, AirPlay
- Configuration Related - Hardware, kernel, screen settings
- User Related - Login, logout, user info
- Keyboard & Mouse - Click, swipe, type, hotkeys
- Picture & Text Recognition - Screenshots, image search, OCR
- Shortcuts - Album, upload, app management
- Callback - WebSocket event callbacks
- Python Library -
pip install imouse-py