> **Sokil documentation pack**
> Language: English
> Station software: 20261126_usb_cameras
> UI build: c6b2dc620
> Generated: 2026-11-26
> Generated by the Sokil ground station UI from the documentation it ships. Download it again after every software update - the pack describes the version it was generated from.

<a id="sokil-api"></a>

# Sokil API for your own software

**Summary:** Read and change any Sokil setting from your own program - over HTTP through the station or straight on a device, over MAVLink from a ground control link - and reach the flight controller's parameters through the station, with curl and Python examples.

**Audience:** field integrators

Open in the UI: http://10.1.1.30/help/guides/sokil-api

Everything Sokil does is driven by **parameters** - named settings such as the camera's WiFi
channel, the station's video destination or the device name. The Sokil interface is one client of
them; your program can be another. This page is for people building their own software around a
Sokil kit: a mission computer, a fleet dashboard, a test rig, a script that sets a kit up the same
way every time.

There are three ways in:

| Way in | Reaches | Use it for |
| --- | --- | --- |
| HTTP through the station (port 80) | the station and every device it can reach | almost everything: read, write, check what was written |
| HTTP straight to a device (port 8333) | that one device | a box you have a direct route to, shell scripts |
| MAVLink on the ground control link | the camera and the station over the radio | software that already speaks MAVLink to the aircraft |

The flight controller's own parameters are a fourth path, through the station's flight controller
bridge (below).

The addresses on this page are the product's fixed plan: `10.1.1.30` is the station, `10.1.1.40`
the camera, `10.1.1.50` the pilot's computer. Replace them with your kit's.

<a id="sokil-api--before-you-start"></a>

### Before you start

- **There is no login and no encryption.** Anyone who can reach a Sokil box on the network can read
  and change every setting. Keep the kit on a network you trust, and reach a kit over the internet
  only through ZeroTier or an SSH tunnel - never by opening its ports.
- **Find the parameter first.** The parameter reference at [/help/params](http://10.1.1.30/help/params) lists every
  parameter with its description, units and range; its **Hidden** tab (admin) documents the hidden
  ones - status readouts and packed values the pages decode, readable by name but left out of a full
  listing. The reference opens by its link in any role.
- **Values are strings**, on every path: `"104"`, `"1"`, `"10.1.1.50"`. A boolean is `"0"` or `"1"`.
- **A write of a name the device does not know does nothing, and says nothing.** It answers success.
  A parameter added in a newer release simply does not exist on older firmware, so always read back
  what you wrote, and treat a name missing from the answer as "not on this firmware".
- **A radio switch beats a write.** When a setting is also on an RC switch (the video preset, for
  example), the switch puts it back on the next RC frame. Check RC actions on the camera before you
  decide a write "did not work".
- **An armed aircraft's camera goes quiet on its radio address** shortly after arming (**Disable
  tunnel after arming** (parameter `vtx_tuna_armed_disable`)), by design. Over Ethernet or ZeroTier it keeps
  answering. Do not poll a flying camera harder than you need: the radio carries video first.

<a id="sokil-api--parameters-through-the-station"></a>

### Parameters through the station

The station's web server answers on port 80 and forwards to any Sokil device it can reach. Name the
device with `?ip=` on **every** call:

- `ip=127.0.0.1` - the station itself;
- `ip=10.1.1.40` - the camera on the wired network or ZeroTier;
- `ip=10.5.0.2` - the camera over the radio, reachable only through the station.

A call without `?ip=` answers `500` at once even on a healthy station - it is not a broken server.

<a id="sokil-api--read"></a>

#### Read

All visible parameters of a device:

```
curl -s 'http://10.1.1.30/api/core/params?ip=10.1.1.40'
```

Named parameters - hidden ones included - in one call. This is the read to use in a program:

```
curl -s -X POST 'http://10.1.1.30/api/core/params/by-names?ip=10.1.1.40' \
  -H 'Content-Type: application/json' \
  -d '{"names":["name","version","dev_board","vtx_wifi_channel","no_such_param"]}'
```

```
{"ip":"10.1.1.40",
 "meta":{"persistent":["name"],"readonly":["version","dev_board"]},
 "params":{"dev_board":"ssc338q","name":"IPC Camera","version":"26.11.11.63765-aadccefd","vtx_wifi_channel":"104"}}
```

- `params` holds every name the device knows, as strings. The unknown name is simply absent.
- `meta.readonly` lists the names that are status, not settings - writing them does nothing.
- `meta.persistent` lists the names the device saves, so they survive a reboot. A name in neither
  list is a live setting that is not saved.

<a id="sokil-api--write"></a>

#### Write

```
curl -s -X POST 'http://10.1.1.30/api/core/params?ip=10.1.1.40' \
  -H 'Content-Type: application/json' \
  -d '{"params":{"name":"Survey camera"},"read":["name"]}'
```

```
{"ip":"10.1.1.40","meta":{"persistent":["name","name"],"readonly":[]},"params":{"name":"Survey camera"}}
```

`params` is what to write, `read` (optional) what to read back in the same call, after the write.
The answer's `params` carries the values the device holds now; a name it does not know is missing
from it. Keys are applied in the order you send them. Several keys in one call are applied
together, which matters for settings that only make sense as a set - the link's channel and width,
for example. Change those through the interface when you can: the setup wizard and the WiFi pages
move both ends of the link together, and a camera moved to a channel its station is not on drops
off the radio until it is moved back by hand.

<a id="sokil-api--what-the-answers-mean"></a>

#### What the answers mean

| Answer | Means |
| --- | --- |
| `200` | Done. Read the answer's `params` to see what the device holds now. |
| `200` with an `X-Sokil-Refused: <names>` header | The device dropped those names - settings only the pilot's laptop itself may change (below); the rest of the write landed. |
| `400 {"error":"bad_param",...}` | A name or value carries a line break, or a name an `=`. Nothing was sent. |
| `400 {"detail":"Invalid device address"}` | The `?ip=` is not an address. A missing `?ip=` answers `500` (above). |
| `403 {"error":"local_only","keys":[...]}` | A write to a pilot's laptop that names a laptop-only setting, from another computer. Nothing was written - not even the other keys. |
| `421 {"error":"bad_host"}` | The request named the station by a host name it does not know as its own. Use its IP address. |
| `500 {"detail":"Core <ip> not available"}` | The device did not answer: off, out of range, armed on its radio address, or no route. |

<a id="sokil-api--settings-only-the-pilot-s-laptop-can-change"></a>

#### Settings only the pilot's laptop can change

A pilot's laptop running Sokil keeps a few switches to itself: the terminal and file access, the
installation of unverified updates, the custom streamer commands and the commands sent to a radio
head's RC transmitter. Your program can read them, but a write from another computer is refused
(`403` through the station, `X-Sokil-Refused` straight to the device, and ignored over MAVLink). They
are changed on the laptop itself, in its own Sokil interface. On every other kind of station and on
cameras they are ordinary settings. Why the laptop keeps them is in
[Sokil on the pilot's laptop](pilot-laptop.md#pilot-laptop--what-a-laptop-keeps-switched-off).

<a id="sokil-api--straight-to-a-device"></a>

### Straight to a device

Every Sokil box - station, camera, Luckfox - also answers its own API on port 8333, with no station
in between. It speaks plain text, one parameter per line: a bare name reads it, `name=value` writes
it, and a name ending in `*` reads every parameter whose name starts with what comes before the star,
hidden ones included.

```
printf 'name\nversion\nvtx_wifi_c*\n' | curl -s --data-binary @- http://10.1.1.40:8333/api/params
```

```
p|name=IPC Camera
r|version=26.11.11.63765-aadccefd
r|vtx_wifi_cur_bw=20
r|vtx_wifi_caps=5|10|20|40|80
|vtx_wifi_channel=104
r|vtx_wifi_cur_pow=0
r|vtx_wifi_channels=
```

Each answer line is `<flags>|name=value`: `p` saved, `r` read-only, nothing for a live setting. Split
on the first `|` and the first `=` only - a value may contain both. A write answers with the value
now held, and a name the device does not know answers nothing at all:

```
printf 'name=Survey camera\nname\n' | curl -s --data-binary @- http://10.1.1.40:8333/api/params
```

```
p|name=Survey camera
p|name=Survey camera
```

`GET http://10.1.1.40:8333/api/params` lists every visible parameter in the same format. This path
needs a route to the device itself, so over the radio use the station (above). The station's
JSON is the easier contract for a program; this one is handy in a shell.

<a id="sokil-api--python-parameters"></a>

### Python: parameters

A small client over the station's HTTP API, with nothing but `requests`
(`pip install requests`). It writes, reads back and refuses to call a write done until the device
holds the value:

```python
import requests

STATION = "http://10.1.1.30"


class Sokil:
    def __init__(self, device_ip, station=STATION):
        self.url = f"{station}/api/core/params"
        self.ip = device_ip

    def read(self, *names):
        r = requests.post(f"{self.url}/by-names", params={"ip": self.ip},
                          json={"names": list(names)}, timeout=15)
        r.raise_for_status()
        return r.json()["params"]          # a name the device does not know is missing

    def write(self, **values):
        body = {"params": {k: str(v) for k, v in values.items()}, "read": list(values)}
        r = requests.post(self.url, params={"ip": self.ip}, json=body, timeout=15)
        r.raise_for_status()
        refused = r.headers.get("X-Sokil-Refused")
        if refused:
            raise RuntimeError(f"refused by the device: {refused}")
        held = r.json()["params"]
        wrong = {k: held.get(k) for k, v in body["params"].items() if held.get(k) != v}
        if wrong:
            raise RuntimeError(f"not applied (unknown name or a value the device corrected): {wrong}")
        return held


camera = Sokil("10.1.1.40")
print(camera.read("name", "version", "vtx_wifi_channel"))
print(camera.write(name="Survey camera"))
```

```
{'name': 'IPC Camera', 'version': '26.11.11.63765-aadccefd', 'vtx_wifi_channel': '104'}
{'name': 'Survey camera'}
```

`Sokil("127.0.0.1")` is the station itself, `Sokil("10.5.0.2")` the camera over the radio.

<a id="sokil-api--mavlink"></a>

### MAVLink

The station delivers the aircraft's MAVLink - the flight controller's, the camera's and its own - to
a ground control program over UDP. Sokil's own settings can be written over that same link, with no
HTTP at all, which is how software that already talks MAVLink to the aircraft can drive the camera
and the station.

<a id="sokil-api--where-the-telemetry-arrives"></a>

#### Where the telemetry arrives

The station sends to a **fixed destination**: the computer named by **Pilot IP** (parameter `vrx_target`)
on [VRX settings](http://10.1.1.30/gs/vrx-settings) > **Receive** > **Destinations** (`10.1.1.50` by default), on the
MAVLink card's **Port** (parameter `vrx_mavlink_port`) (14550). Your program listens on that UDP port on
that computer, and sends back to whoever it heard from - the station accepts commands on the same
socket. On a computer that is not the Pilot IP, or a laptop station whose own web server already
holds 14550, set **Forwarding** (parameter `vrx_mavfwd_fwd_addr`) on the same MAVLink card to _UDP_ with
your computer's `address:port`: it is a second full two-way connection, not a copy, so commands
work there too. [Troubleshooting: flight controller](troubleshooting-flight-controller.md#troubleshooting-flight-controller--the-ground-control-software-shows-nothing)
has the firewall and port details.

Who is who on that link:

| System / component | Who |
| --- | --- |
| component `1` | the flight controller |
| component `100` | the camera (its MAVLink component id (parameter `vtx_mavlink_comp_id`)) |
| component `67` or `68` | the station - `68` when it receives over WiFi only, `67` with Ethernet or ZeroTier |
| component `69` | a repeater |

<a id="sokil-api--writing-parameters-set-sokil"></a>

#### Writing parameters: set-sokil

Send a `VIDEO_STREAM_INFORMATION` message whose `name` is `set-sokil` and whose `uri` is one or more
`name=value` lines separated by a line break. Its **source component id** chooses the device: `100`
for the camera, `67` or `68` for the station (either works on both kinds of station), `69` for a
repeater. Any other component id is ignored. The other fields of the message are not used.

- The `uri` holds 160 bytes, so a batch is a few short lines at most.
- There is **no answer**. Read the value back over HTTP, or watch for its effect.
- A device applies batches about once a second, and a newer batch replaces one not yet applied:
  put everything that belongs together into one batch, and leave a couple of seconds between
  batches.
- A batch is a remote write: the laptop-only settings (above) are ignored in it on a pilot's laptop.
- The camera hears it only while the radio, Ethernet or ZeroTier link to it is up.

<a id="sokil-api--channel-power-and-preset-set-sokil-vtx-and-set-sokil-vrx"></a>

#### Channel, power and preset: set-sokil-vtx and set-sokil-vrx

Two shorter forms carry no text, only numbers, and act at once:

| `name` | Source component | `flags` | `bitrate` |
| --- | --- | --- | --- |
| `set-sokil-vtx` | `100` (the camera) | WiFi channel number x 256 + power level x 32 | video preset + 1 (`1` is the first preset), `0` leaves the preset alone |
| `set-sokil-vrx` | `67` / `68` (the station) | the same, for the station's own radio | not used |

- `flags` `0` leaves the channel and power alone, so `flags=0, bitrate=2` only selects the second
  preset. A non-zero `flags` always sets both the channel and the power, so send the current channel
  when you only want to change the power.
- The power level is the 0 to 5 ladder of **WiFi power** (parameter `vtx_wifi_power`) - a level, not a
  figure in dBm - and the new level is saved as that setting. While **Adaptive TX power** is on, the
  camera picks its own power and overrides this.
- **Moving the camera's channel alone loses the link** until the station is moved too. The interface's
  channel change moves both ends; prefer it.
- The video preset is often on an RC switch (**Preset switch** (parameter `rc_act_vtx_preset_sw`), channel
  9 by default), and the switch wins: it puts its own preset back on the next RC frame.

<a id="sokil-api--python-mavlink-with-pymavlink"></a>

#### Python: MAVLink with pymavlink

Run it on the Pilot IP computer (or the Forwarding address) with `pip install pymavlink`. It shows
who is on the link, renames the camera with `set-sokil`, and sets the camera's power level with
`set-sokil-vtx`:

```python
import time

from pymavlink import mavutil

CAMERA_COMP = 100          # the camera's MAVLink component id


def connect(component):
    # Listen where the station sends; replies go back to the station automatically.
    link = mavutil.mavlink_connection("udpin:0.0.0.0:14550", source_system=255,
                                      source_component=component)
    link.wait_heartbeat(timeout=10)
    return link


def set_sokil(component, **values):
    """Write Sokil parameters on the device with this component id; no answer comes back."""
    uri = "\n".join(f"{k}={v}" for k, v in values.items()).encode()
    assert len(uri) <= 160, "one set-sokil batch holds 160 bytes"
    link = connect(component)
    link.mav.video_stream_information_send(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, b"set-sokil", uri)
    link.close()


def set_camera_radio(channel, power, preset=None):
    link = connect(CAMERA_COMP)
    flags = channel * 256 + power * 32
    bitrate = 0 if preset is None else preset + 1
    link.mav.video_stream_information_send(0, 0, 0, flags, 0, 0, 0, bitrate, 0, 0,
                                           b"set-sokil-vtx", b"")
    link.close()


seen = set()
link = connect(190)
end = time.time() + 5
while time.time() < end:
    msg = link.recv_match(blocking=True, timeout=1)
    if msg and msg.get_type() != "BAD_DATA":
        seen.add((msg.get_srcSystem(), msg.get_srcComponent()))
link.close()
print("on the link (system, component):", sorted(seen))

set_sokil(CAMERA_COMP, name="Survey camera")
set_camera_radio(channel=104, power=1)       # keep the camera's current channel
```

```
on the link (system, component): [(1, 1), (1, 100), (3, 68)]
```

The system ids are your kit's; component `1` is there only while a flight controller is connected
and talking.

Check the result over HTTP afterwards (the `Sokil` class above): `camera.read("name",
"vtx_wifi_power")`.

<a id="sokil-api--flight-controller-parameters-through-the-station"></a>

### Flight controller parameters through the station

The station also bridges to the flight controller behind a camera, for its **parameters** - the
same path the FC setup page uses. It is not a general MAVLink pipe: it passes only parameter reads
and writes, file transfer and a few setup commands, and never arming, mode changes or flight
commands.

- `GET /api/fc/stream?ip=<camera>` - a stream of the flight controller's messages (heartbeat,
  parameter values, acknowledgements, status text and a few more). Each frame is a 4-byte big-endian
  length followed by that many bytes of MAVLink; a zero length is a keepalive.
- `POST /api/fc/command?ip=<camera>` - one MAVLink frame as the body
  (`Content-Type: application/octet-stream`). `200` means it was passed on; `400` (a message the
  bridge does not pass) and `423` (refused while the flight controller is armed) are final; `409`
  means the queue is full - wait and send again.

Reads are always allowed. **A parameter write is not stopped while the aircraft is armed** - your
program must check the flight controller's heartbeat itself and never write a flying aircraft's
parameters. The value on the wire is a 32-bit float whatever the parameter's type, so compare read
backs at that precision. Ask for parameters by name: a full list is more than a thousand messages on
the same link the pilot flies on.

Reading one parameter, with `requests` and `pymavlink`:

```python
import time

import requests
from pymavlink.dialects.v20 import ardupilotmega as mavlink2

STATION = "http://10.1.1.30"
CAMERA = "10.1.1.40"
mav = mavlink2.MAVLink(None, srcSystem=255, srcComponent=190)


def fc_messages():
    """Every MAVLink message the station's flight controller bridge passes on, decoded."""
    with requests.get(f"{STATION}/api/fc/stream", params={"ip": CAMERA}, stream=True,
                      timeout=30) as r:
        r.raise_for_status()
        while True:
            head = r.raw.read(4)
            if len(head) < 4:
                return
            size = int.from_bytes(head, "big")
            if size:
                yield from mav.parse_buffer(r.raw.read(size)) or []


def send(msg):
    r = requests.post(f"{STATION}/api/fc/command", params={"ip": CAMERA}, data=msg.pack(mav),
                      headers={"Content-Type": "application/octet-stream"}, timeout=10)
    r.raise_for_status()


def read_param(name, timeout=10):
    target = None
    deadline = time.time() + timeout
    for msg in fc_messages():
        if time.time() > deadline:
            return None
        if msg.get_type() == "HEARTBEAT" and msg.get_srcComponent() == 1 and target is None:
            target = msg.get_srcSystem()
            send(mav.param_request_read_encode(target, 1, name.encode(), -1))
        elif msg.get_type() == "PARAM_VALUE" and msg.param_id == name:
            return msg.param_value


print("BATT_MONITOR", read_param("BATT_MONITOR"))
```

A name that never answers is not on this firmware (ArduPilot ignores an unknown name, and a newer
firmware renames some: ArduCopter 4.7 has `RTL_ALT_M` where older ones had `RTL_ALT`). A write is
`mav.param_set_encode(target, 1, name.encode(), value, param_type)` with the type the read reported.
The flight controller answers a write with a `PARAM_VALUE` carrying the value it now holds: wait for
that answer on a stream you opened before sending the write. **A newly opened stream begins with the
latest answers the station still holds**, so the first value on it may be the one from before your
write.

<a id="sokil-api--related-guides"></a>

### Related guides

- [Remote access and debugging](remote-access-debugging.md#remote-access-debugging) - the same calls for a
  support session, SSH, the logs and the configuration files.
- [Sokil on the pilot's laptop](pilot-laptop.md#pilot-laptop) - the laptop-only switches and why.
- [Troubleshooting: flight controller](troubleshooting-flight-controller.md#troubleshooting-flight-controller) - telemetry that does
  not reach a ground control program.
- [The parameter reference](http://10.1.1.30/help/params) - every parameter, its meaning and its range.
