The Camera Tools for GoPro Heros app allows you control multiple GoPro® cameras. The command server is a part of the Camera Tools app and allows you to control the app and cameras via HTTP commands by sending JSON commands to the server. This document describes all available commands.
Note: On Android and iOS scripting works only while the app is running in foreground and while the screen in on.
Each JSON response contains a "status_code" field which can hold one of the following values:
If an error occurs then an optional field "error" can contain additional information in textual form.
This command returns a list of all cameras installed. As an alternative the cameraStatus function with an empty cameras argument can be used. The status code is always 0 (ok).
Request:{ "command": "getAllCameras" }Response:
{ "cameras": [ { "connection_state": "Connected", "name": "GoPro 1953" }, { "connection_state": "Disconnected", "name": "GoPro 7594" } ], "command": "getAllCameras", "status_code": 0 }
This command gets general and status information of the camera(s). The status code can be 0 (ok) or -3 (camera with the given name was not found).
Request:{ "command": "cameraStatus", "cameras": ["GP123456"] }
Note: Leave the "cameras" variable empty if you want to query the status of all cameras.
Response:{ "command": "cameraStatus", "cameras": [ { "name": "GP123456", "model": "Hero 8", "bluetooth_status": "connected", "wifi_ssid": "GP123456", "wifi_password": "password1234", "connection_type": "bluetooth", "camera_recording": false, "live_streaming": "idle", "preset_id": 1234, "camera_mode": 1000, "camera_submode": 0, "recording_time": "00:14", "remaining_photos": 102, "remaining_space": 1000000, "remaining_recording_time": 1324324, "charger_attached": true, "battery_level": 99 } ], "status_code": 0 }
The connection_type can be "bluetooth", "wifi", or "usb".
This command queries the currently connected WiFi name from the system. The result can later be read using the getCurrentWiFiSSID command. The status code is always 0 (ok).
Request:{ "command": "queryCurrentWiFiSSIDAsync" }Response:
{ "command": "queryCurrentWiFiSSIDAsync", "status_code": 0 }
This command returns the WiFi name from the last queryCurrentWiFiSSIDAsync query. Possible status_code values are 0 (ok) and -4 (no WiFi credentials are available. This is usually the case if you have not called queryCurrentWiFiSSIDAsync() first.).
Request:{ "command": "getCurrentWiFiSSID" }Response:
{ "message": "Optional error message.", "command": "getCurrentWiFiSSID", "ssid": "wifi_name", "last_updated": "2020-01-20T14:11:25", "status_code": 0 }
This command connects to the WiFi network using the given credentials. The "adapter" parameter contains an optional WiFi interface name. The status code is always 0 (ok).
Request:{ "command": "connectToWiFiAsync", "ssid": "GP123456", "password": "password1234", "adapter": "" }Response:
{ "command": "connectToWiFiAsync", "status_code": 0 }
This command connects to the given camera's WiFi network. The status code can be 0 (ok), -3 (camera with the given name was not found), or -5 (camera is not connected).
Request:{ "command": "connectToCameraWiFiAsync", "camera": "GP123456" }Response:
{ "command": "connectToCameraWiFiAsync", "status_code": 0 }
This command loads the list of media files from the camera. The command requires an active WiFi connection to the camera (e.g. using connectToCameraWiFiAsync). The result can be later read with the getMediaList command. The status code can be 0 (ok), -6 (another media query is already running), -3 (camera not found), or -5 (camera not connected). The "force" parameter forces to send a new media query to the camera, even if a query is still active. If "lrv" is set to true then LRV files are returned instead of MP4 (Warning: depending on the video mode, the LRV file might not be available on the camera).
Request:{ "command": "queryMediaListAsync", "camera": "GP123456", "force": false, "lrv": false }Response:
{ "command": "queryMediaListAsync", "message": "Optional error message.", "status_code": 0 }
This command gets the status of the last queryMediaListAsync call. Possible status values are idle, error, and busy ("busy" means that the media information is currently downloaded from the camera). The status code can be 0 (ok), -3 (camera with the given name was not found), or -6 (the media query is still running). If the "camera" field is empty then a random camera is selected (due to compatibility reasons).
Request:{ "command": "getMediaQueryStatus", "camera": "GP123456" }Response:
{ "command": "getMediaQueryStatus", "status": "idle", "status_code": 0 }
This command returns the last media list for the given cameras queried by queryMediaListAsync command. The status code can be 0 (ok) or -3 (camera with the given name was not found).
Request:{ "command": "getMediaList", "camera": "GP123456" }Response:
{ "command": "getMediaList", "camera": "GP123456", "media": [ { "filename": "image.jpg", "url": "http://10.5.5.9/DCIM/image.jpg", "date": "2020-01-20T14:11:25", "size": 123000023 } ], "status_code": 0 }
This command deletes media files from the camera. The command requires an active WiFi connection to the camera (e.g. using connectToCameraWiFiAsync). The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "deleteMediaAsync", "camera": "GP123456", "media": [ "100GOPRO/GOPR0573.JPG", "100GOPRO/GOPR0574.JPG" ] }Response:
{ "command": "deleteMediaAsync", "message": "Optional error message.", "status_code": 0 }
This command sends a specific command to the camera. The following commands are available:
The status code can be 0 (ok), -2 (unkown command), -3 (camera with the given name was not found), or, -5 (camera not connected; not applicable for "connectToCamera" and "disconnectFromCamera").
Request:{ "command": "sendCameraCommand", "cameras": ["GP123456"], "cameraCommand": "startRecording" }Response:
{ "command": "sendCameraCommand", "message": "Optional error message.", "status_code": 0 }
This command returns a list of supported camera modes, sub-modes (pre Hero 8), and presets (Hero 8 and newer). For Hero 7 and older models the old_group_key key should be used as the group key. The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "getCameraModes", "camera": "GP123456" }Response:
{ "command": "getCameraModes", "camera": "GP123456", "modes": [ { "name": "VIDEO", "key": 1000, "submodes": [ { "name": "looping", "key": 1, "old_group_key": 0 } ], "presets": [ { "name": "Default", "key": 0, "old_group_key": 0 } ] } ], "status_code": 0 }
This command sets the camera mode group (e.g. video, photo, ...). The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "setCameraMode", "camera": "GP123456", "mode_key": 1000 }Response:
{ "command": "setCameraMode", "camera": "GP123456", "message": "Optional error message.", "status_code": 0 }
This command sets the camera sub-mode (e.g. looping, burst, ...). This command is only intended for Hero 7 and older models. The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "setCameraSubMode", "camera": "GP123456", "submode_key": 0 }Response:
{ "command": "setCameraSubMode", "camera": "GP123456", "message": "Optional error message.", "status_code": 0 }
This command sets the camera preset (e.g. standard, activity, ...). This command is only intended for Hero 8 and newer models. The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "setCameraPreset", "camera": "GP123456", "preset_key": 0 }Response:
{ "command": "setCameraPreset", "camera": "GP123456", "message": "Optional error message.", "status_code": 0 }
This command returns a list of all currently available settings for the given camera. Note: The available settings change dynamically. The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "getCameraSettings", "camera": "GP123456" }Response:
{ "command": "getCameraSettings", "camera": "GP123456", "settings": [ { "name": "Resolution", "key": "22", "values": [ { "name": "1080p", "value": "0" }, { "name": "720p", "value": "1" } ] } ], "status_code": 0 }
This command changes settings on the camera. The status code can be 0 (ok), -3 (camera with the given name was not found), or, -5 (camera not connected).
Request:{ "command": "setCameraSetting", "camera": "GP123456", "setting_key": 22, "setting_value": 1 }Response:
{ "command": "setCameraSetting", "camera": "GP123456", "message": "Optional error message.", "status_code": 0 }