> For the complete documentation index, see [llms.txt](https://developer.fotokite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.fotokite.com/~/changes/46/getting-started.md).

# Getting started

## Install api-preview

{% stepper %}
{% step %}
Using Fotokite Live, navigate to the System Update menu.

<figure><img src="https://3669484394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXUDGlNkSLzd9Nbig1oF3%2Fuploads%2FOJ0cj0tTYwkEIXWYmeEl%2Foperators-manual-change-channel.jpg?alt=media&amp;token=21056a56-bbe3-4765-8a5f-568215639e0f" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
From the options menu, select Change Channel
{% endstep %}

{% step %}
Select the api-preview channel and navigate back. If api-preview does not appear for your system, contact Fotokite to get you enrolled in the Fotokite API Early Access Program (EAP).
{% endstep %}

{% step %}
Update the system to the latest version.
{% endstep %}
{% endstepper %}

## Access the API

{% stepper %}
{% step %}
Connect your Client Device over Wi-Fi or Ethernet. We recommend Ethernet for better reliability.

<figure><img src="https://3669484394-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXUDGlNkSLzd9Nbig1oF3%2Fuploads%2FKYCDqQujKh7V4CsNzS6g%2Fdevelopers-networking.jpg?alt=media&amp;token=51d6b751-fe45-4767-b30d-5283dc5fdd46" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
In Fotokite Live, navigate to System Connect > Advanced Settings from the options menu.
{% endstep %}

{% step %}
In the Upstream Ethernet section, select Bridged.
{% endstep %}

{% step %}
Connect your Client Device to the Ethernet port on the Ground Station and configure it to use DHCP. It will receive an IP address in the `192.168.2.0/24`  range and have Internet access, as long as the Ground Station has Internet access.
{% endstep %}

{% step %}
Now it will be possible to access the Fotokite API over HTTP. Please ensure your request is authenticated as described in [#authentication](#authentication "mention").

```python
curl http://192.168.2.100:3128/api/v0/info/system \
--oauth2-bearer <auth_token>
```

If the command hangs or times out, or you receive a "no route to host" error, your Client Device is not correctly connected to the Fotokite system.

If there is a "Connection refused" error, the Fotokite system is not running an API-enabled software version. Make sure an API release is installed. Learn more in [#install-api-preview](#install-api-preview "mention").
{% endstep %}
{% endstepper %}

## Authentication

The authentication mechanism ensures proper security and access control. Most API endpoints are protected by this workflow and are scoped, meaning each request to a protected endpoint must include a valid Bearer Token.

{% stepper %}
{% step %}
During the beta phase, you can use the following API Key.&#x20;

```
DemoApiKey123
```

In future releases, API Keys will always be issued directly by Fotokite.
{% endstep %}

{% step %}
To obtain a Token, send a request using [Authentication](/~/changes/46/fotokite-api/authentication.md#post-v0-authentication-tokens-request) by including your API Key (client\_secret).

```python
curl -X POST "http://192.168.2.100:3128/api/v0/authentication/tokens/request" \
  -H "Content-Type: application/json" \
  -d '{
    "client_secret": "DemoApiKey123"
  }'
```

Alternatively, you can use scopes for more granular control. Available scopes are&#x20;

```
info, telemetry, command, media
```

```python
curl -X POST "http://192.168.2.100:3128/api/v0/authentication/tokens/request" \
  -H "Content-Type: application/json" \
  -d '{
    "client_secret": "DemoApiKey123"
    "scope": "info,command"
  }'
```

{% endstep %}

{% step %}
The Token (Bearer Token) is what you use to authenticate all subsequent requests to protected endpoints.

```python
curl -X GET "http://192.168.2.100/api/v0/info/system" \
--oauth2-bearer <auth_token>
```

Tokens can be invalidated via [Authentication](/~/changes/46/fotokite-api/authentication.md#post-v0-authentication-tokens-invalidate). Once invalidated, you must request a new one using your API Key.
{% endstep %}
{% endstepper %}

## Basic REST endpoints

Basic information about the system, the flight status, and current system notifications are available at these endpoints:

* System: [http://192.168.2.100:3128/api/v0/info/system](http://192.168.10.100:3128/api/v0/info/system)
* Flight: <http://192.168.2.100:3128/api/v0/telemetry/flight>
* Notifications: <http://192.168.2.100:3128/api/v0/telemetry/notifications>

To control the system use:

{% hint style="danger" %}
These commands will start the Kite. \
Make sure the Sigma system is in an environment where it is safe to take off.
{% endhint %}

{% code fullWidth="false" %}

```python
# Take off
curl -X POST "http://192.168.2.100:3128/api/v0/commands/flight/take_off" \
  -H "Authorization: Bearer <auth_token>"

# Set Altitude
curl -X POST "http://192.168.2.100:3128/api/v0/commands/flight/set_altitude" \
  -H "Authorization: Bearer <auth_token>" \
  -H "Content-Type: application/json" \
  -d '{"altitude":21}'

# Rotate by Angle
curl -X POST "http://192.168.2.100:3128/api/v0/commands/camera/rotate_by_angle" \
  -H "Authorization: Bearer <auth_token>" \
  -H "Content-Type: application/json" \
  -d '{ "pan": 10,  "tilt": 14}'

# Land
curl -X POST "http://192.168.2.100:3128/api/v0/commands/flight/land" \
  -H "Authorization: Bearer <auth_token>"
```

{% endcode %}

## WebSocket subscriptions for event-based updates

The Fotokite API can notify your application about changes using a WebSocket based protocol. To demonstrate this, we will use the [websocat](https://docs.rs/crate/websocat/1.0.1) tool; for your application, you can use any WebSocket client library.

You can subscribe to almost any endpoint by appending `/subscribe` to the endpoint URL:

```python
# Flight
websocat -H="Authorization: Bearer <auth_token>" \
ws://192.168.2.100:3128/api/v0/telemetry/flight/subscribe

# Notififcations
websocat -H="Authorization: Bearer <auth_token>" \
ws://192.168.2.100:3128/api/v0/telemetry/notifications/subscribe
```

The Fotokite system will send updated information over the websocket as soon as it is available. The data will be formatted as a sequence of WebSocket messages, each containing one JSON object of the same form as reported by the endpoint itself.

## Accessing video streams

Video streams are available as H.264 encoded RTSP sources. These can be read using any RTSP client. Learn more in [Local Video Streaming (RTSP)](https://manual.fotokite.com/installation-and-integration/local-video-streaming-rtsp).

To retrieve information about the videostreams use:

```python
curl -X GET "http://192.168.2.100/api/v0/info/videostreams" \
--oauth2-bearer <auth_token>
```

Example response.

```python
[​
  {​
    "id": "Zoom",​
    "protocol": "RTP",​
    "frame_width": 1920,​
    "frame_height": 1080,​
    "codec": "H.264",​
    "url": "rtsp://192.168.2.100:5010/video"​
  },​
  {​
    "id": "Wide",​
    "protocol": "RTP",​
    "frame_width": 1920,​
    "frame_height": 1080,​
    "codec": "H.264",​
    "url": "rtsp://192.168.2.100:5014/video"​
  },​
  {​
    "id": "Thermal",​
    "protocol": "RTP",​
    "frame_width": 320,​
    "frame_height": 240,​
    "codec": "H.264",​
    "url": "rtsp://192.168.2.100:5012/video"​
  }​
​]
```

The video streams will only be available while the Kite is flying; otherwise the cameras turn off after a while. For low latency, we recommend using GStreamer with a pipeline set up like this:

```javascript
// GStreamer
gst-launch-1.0 rtspsrc location=rtsp://192.168.2.100:5010/video drop-on-latency=true latency=300 ! rtph264depay ! h264parse ! avdec_h264 ! queue ! xvimagesink
```

&#x20;Some code examples can be found [here](https://developer.fotokite.com/code-examples/video-streams)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.fotokite.com/~/changes/46/getting-started.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
