DocumentaçãoDocumentation

Ligue o Airo ao resto da igreja.Connect Airo to the rest of your church.

Comande o Airo pela rede local com HTTP e WebSocket, e receba um aviso por webhook sempre que algo acontece no ao vivo.Control Airo over the local network with HTTP and WebSocket, and get a webhook whenever something happens on air.

ComeçandoGetting started

Começando com a APIGetting started with the API

O Airo pode ser controlado pela rede local por apps, painéis, controladores e scripts. Esta página mostra como ligar a API, criar um token e fazer a primeira chamada.

Airo can be controlled over the local network by apps, dashboards, controllers and scripts. This page shows how to turn the API on, create a token and make your first call.

Dois jeitos de falar com o AiroTwo ways to talk to Airo

WebSocketWebSocketHTTPHTTP
Porta padrãoDefault port46004601
Para quêBest forControle em tempo real e eventosReal-time control and eventsComandos simples por URLSimple commands by URL
EndereçoAddressws://IP:4600http://IP:4601/api/v1

Os dois usam os mesmos tokens e executam as mesmas funções. No próprio computador do Airo, use localhost no lugar do IP.

Both use the same tokens and run the same functions. On the Airo computer itself, use localhost instead of the IP.

Ligar a APITurn the API on

  1. No Airo, abra Configurações › API e WebSocket.
  2. In Airo, open Settings › API and WebSocket.
  3. Ligue o Servidor WebSocket, a API HTTP ou os dois.
  4. Turn on the WebSocket server, the HTTP API, or both.
  5. Copie o endereço e o token de acesso.
  6. Copy the address and the access token.
Rede local. O aparelho precisa estar na mesma rede do computador do Airo. A API não usa TLS, então use só na rede da igreja.
Local network. The device must be on the same network as the Airo computer. The API does not use TLS, so keep it on the church network.

Tokens e permissõesTokens and permissions

O token principal pode tudo. Para cada aparelho ou programa, crie um token extra só com o que ele precisa, em Permissões por token › + Novo token. O token extra aparece inteiro uma única vez: copie na hora.

The main token can do everything. For each device or program, create an extra token with only what it needs, under Token permissions › + New token. An extra token is shown in full only once, so copy it right away.

PermissãoPermissionNa telaOn screenLiberaAllows
readLeituraReadO estado e os eventosState and events
inputsInputsInputsPreview, program, transições, overlays e Fade to BlackPreview, program, transitions, overlays and Fade to Black
broadcastTransmissãoBroadcastGravar, transmitir, MultiCorder e replayRecording, streaming, MultiCorder and replay
audioÁudioAudioReservado para as funções de áudioReserved for audio functions

Primeira chamadaFirst call

Leia o estado do switcher:

Read the switcher state:

bash
curl -H "Authorization: Bearer stk_..." \
  "http://192.168.0.10:4601/api/v1/state"
json
{
  "program":  {"id": 1, "number": 1, "name": "Câmera Púlpito"},
  "preview":  {"id": 4, "number": 4, "name": "Boas-vindas"},
  "overlays": [null, {"id": 9, "number": 9, "name": "Logo da igreja"}, null, null],
  "ftb": false,
  "recording": true,
  "streaming": false,
  "inputs": [
    {"id": 1, "number": 1, "name": "Câmera Púlpito", "kind": "camera", "state": "program"},
    {"id": 2, "number": 2, "name": "Câmera Geral", "kind": "camera", "state": "off"}
  ]
}

Executar uma funçãoRun a function

As funções têm os nomes conhecidos de quem usa mesas de corte por software, sem diferenciar maiúsculas.

Functions use the names familiar from software switchers, and are not case sensitive.

bash
curl -H "Authorization: Bearer stk_..." \
  "http://192.168.0.10:4601/api/v1/function?name=Cut&input=2"

curl -X POST -H "Authorization: Bearer stk_..." \
  -d "name=PreviewInput&input=3" "http://192.168.0.10:4601/api/v1/function"

O parâmetro input aceita a posição na grade (2), o nome exato (Câmera Geral) ou o id estável (id:12).

The input parameter accepts the grid position (2), the exact name (Câmera Geral) or the stable id (id:12).

FunçãoFunctionPermissãoPermissionO que fazWhat it does
CutinputsCorte seco do preview para o program. Com input, ele vai ao preview antes.Hard cut from preview to program. With input, it goes to preview first.
QuickPlayinputsLeva o preview ao ar com a transição padrão.Takes preview to air with the default transition.
TransitioninputsLeva o preview ao ar com transition: Fade, Merge, Wipe ou Stinger.Takes preview to air with transition: Fade, Merge, Wipe or Stinger.
PreviewInputinputsPõe o input no preview.Puts the input in preview.
OverlayInput1In … 4IninputsLiga o input no overlay.Turns the input on in that overlay.
OverlayInput1Out … 4OutinputsDesliga o overlay.Turns the overlay off.
FadeToBlackinputsLiga ou desliga o Fade to Black.Toggles Fade to Black.
StartRecording / StopRecordingbroadcastComeça ou para a gravação.Starts or stops recording.
StartStreaming / StopStreamingbroadcastComeça ou para a transmissão. Falha se nenhum destino está pronto.Starts or stops streaming. Fails if no destination is ready.
Sem confirmação. StopStreaming e StopRecording param na hora, sem perguntar ao operador. Peça a confirmação no seu sistema.
No confirmation. StopStreaming and StopRecording stop immediately, without asking the operator. Ask for confirmation in your own system.

RespostasResponses

StatusStatusCorpoBodyQuandoWhen
200{"ok": true}Deu certo (ou o estado, em /state).It worked (or the state, on /state).
400{"ok": false, "error": "…"}A função falhou: nome, input ou parâmetro inválido.The function failed: invalid name, input or parameter.
401{"ok": false, "error": "…"}Sem token ou token errado.Missing or wrong token.
403{"ok": false, "code": "forbidden"}O token não tem a permissão da função.The token lacks the permission for that function.

WebSocket em cinco mensagensWebSocket in five messages

A primeira mensagem precisa ser um hello com o token, em até 5 segundos. Depois disso, o Airo aceita funções e empurra eventos sempre que algo muda.

The first message must be a hello carrying the token, within 5 seconds. After that, Airo accepts functions and pushes events whenever something changes.

ws://192.168.0.10:4600
→ {"type": "hello", "token": "stk_...", "client": "Meu painel"}
← {"type": "hello", "ok": true, "server": "Airo", "protocol": 1, "permissions": ["read", "broadcast"]}

→ {"type": "function", "id": "1", "name": "StartStreaming"}
← {"type": "result", "id": "1", "ok": true}
← {"type": "event", "event": "streaming", "data": {"active": true}}

Guia: transmissão ao vivo no site da igreja →Guide: live stream on your church website →

GuiaGuide

Transmissão ao vivo no site da igrejaLive stream on your church website

Neste guia, o painel da igreja abre o Airo, inicia a transmissão e recebe o endereço do vídeo para colocar o player no site. Ninguém precisa copiar e colar link.

In this guide, the church dashboard opens Airo, starts the stream and receives the video address to put the player on the website. Nobody has to copy and paste a link.

Painel da igrejaChurch dashboardbotão Entrar ao vivoGo live button
AiroAiroabre o preset e transmiteopens the preset and streams
YouTubeYouTuberecebe o vídeoreceives the video
Servidor do painelDashboard serverrecebe o webhookgets the webhook
SiteWebsitemostra o playershows the player

O que você precisaWhat you need

  • O Airo instalado no computador da transmissão, com um destino pronto em Configurações › Transmissão (por exemplo, o YouTube).
  • Airo installed on the streaming computer, with a destination ready under Settings › Streaming (YouTube, for example).
  • O painel da igreja aberto no navegador desse mesmo computador.
  • The church dashboard open in a browser on that same computer.
  • Um endereço https no servidor do painel para receber o webhook.
  • An https address on the dashboard server to receive the webhook.

1Prepare o Airo (uma vez)Set Airo up (once)

  1. Em Configurações › API e WebSocket, ligue o Servidor WebSocket.
  2. Under Settings › API and WebSocket, turn on the WebSocket server.
  3. Em Permissões por token, crie o token “Painel da igreja” com Leitura e Transmissão. Copie o token: ele aparece inteiro uma única vez.
  4. Under Token permissions, create a token named “Church dashboard” with Read and Broadcast. Copy it: it is shown in full only once.
  5. Em Configurações › Webhooks, crie um webhook para https://painel.suaigreja.org/hooks/airo com os eventos stream.started e stream.stopped. Copie o segredo de assinatura (whsec_…).
  6. Under Settings › Webhooks, create a webhook to https://painel.suaigreja.org/hooks/airo with the stream.started and stream.stopped events. Copy the signing secret (whsec_…).

2Abra o Airo pelo painelOpen Airo from the dashboard

O botão do painel é um link airo://. O navegador pede confirmação na primeira vez e o Airo abre com o preset do evento carregado.

The dashboard button is a airo:// link. The browser asks for confirmation the first time, and Airo opens with the event preset loaded.

html
<a href="airo://open?preset=Evento%20de%20domingo">Entrar ao vivo</a>

3Conecte e inicie a transmissãoConnect and start the stream

Com o Airo aberto, o painel fala com ele por WebSocket em localhost. A conexão só abre quando o Airo já está de pé, então tentar de novo até conectar também serve para esperar o Airo abrir.

With Airo open, the dashboard talks to it over WebSocket on localhost. The connection only opens once Airo is up, so retrying until it connects doubles as waiting for Airo to open.

painel.js
const AIRO = "ws://localhost:4600";

function connectAiro(token, onEvent) {
  return new Promise((resolve) => {
    const tryConnect = () => {
      const ws = new WebSocket(AIRO);
      ws.onopen = () =>
        ws.send(JSON.stringify({ type: "hello", token, client: "Painel da igreja" }));
      ws.onmessage = (e) => {
        const msg = JSON.parse(e.data);
        if (msg.type === "hello" && msg.ok) resolve(ws);
        if (msg.type === "event") onEvent(msg.event, msg.data);
      };
      ws.onerror = () => setTimeout(tryConnect, 2000);
    };
    tryConnect();
  });
}

const ws = await connectAiro(AIRO_TOKEN, (event, data) => {
  if (event === "streaming") showLiveBadge(data.active);
});

startButton.onclick = () =>
  ws.send(JSON.stringify({ type: "function", id: "start", name: "StartStreaming" }));

O Airo responde {"type": "result", "id": "start", "ok": true}. Quando o destino confirma a conexão, chega o evento streaming com active: true. Se nenhum destino estiver pronto (sem chave, por exemplo), o result vem com ok: false e o motivo em error.

Airo answers {"type": "result", "id": "start", "ok": true}. When the destination confirms the connection, the streaming event arrives with active: true. If no destination is ready (no stream key, for example), the result comes with ok: false and the reason in error.

4Receba o endereço da transmissãoReceive the stream address

Quando a transmissão começa de fato, o Airo envia stream.started para o servidor do painel. O campo watch_url traz o endereço público do vídeo.

When the stream is actually live, Airo sends stream.started to the dashboard server. The watch_url field carries the public address of the video.

http
POST https://painel.suaigreja.org/hooks/airo
Content-Type: application/json
X-Airo-Event: stream.started
X-Airo-Delivery: dlv_9f31a2c4e7b0
X-Airo-Signature: sha256=3f6c…

{
  "id": "dlv_9f31a2c4e7b0",
  "event": "stream.started",
  "timestamp": "2026-11-15T10:00:03-03:00",
  "project": "Evento de domingo",
  "airo_version": "1.4.2",
  "data": {
    "destinations": ["YouTube"],
    "watch_url": "https://www.youtube.com/watch?v=VIDEO_ID",
    "resolution": "1920x1080",
    "fps": 30,
    "bitrate_kbps": 6000
  }
}

No servidor, confira a assinatura antes de confiar no corpo e guarde se a igreja está ao vivo:

On the server, check the signature before trusting the body, then store whether the church is live:

server.js
const crypto = require("crypto");
const express = require("express");

const SECRET = process.env.AIRO_WEBHOOK_SECRET; // whsec_…
const app = express();

app.post("/hooks/airo", express.raw({ type: "application/json" }), async (req, res) => {
  const expected = Buffer.from(
    "sha256=" + crypto.createHmac("sha256", SECRET).update(req.body).digest("hex"));
  const received = Buffer.from(req.get("X-Airo-Signature") || "");
  const valid = received.length === expected.length && crypto.timingSafeEqual(received, expected);
  if (!valid) return res.status(401).end();

  const { id, event, data } = JSON.parse(req.body);
  if (await alreadyProcessed(id)) return res.status(204).end();

  if (event === "stream.started") await saveLive({ live: true, watchUrl: data.watch_url });
  if (event === "stream.stopped") await saveLive({ live: false, watchUrl: null });
  res.status(204).end();
});
Entregas repetidas. O Airo pode reenviar uma entrega com o mesmo id. Guarde os ids já processados e responda 2xx para os repetidos.
Repeated deliveries. Airo may resend a delivery with the same id. Keep the ids you have processed and answer 2xx to repeats.

5Mostre no siteShow it on the website

O site pergunta ao seu servidor se há transmissão e monta o player com o endereço recebido:

The website asks your server whether a stream is on and builds the player from the address it received:

site.js
const { live, watchUrl } = await fetch("/api/live").then((r) => r.json());

if (live) {
  const videoId = new URL(watchUrl).searchParams.get("v");
  player.src = `https://www.youtube.com/embed/${videoId}?autoplay=1`;
}
player.hidden = !live;
Destino sem endereço. Num servidor RTMP próprio, o Airo não tem como saber onde o vídeo aparece e watch_url vem null. Use então um endereço fixo do canal, como https://www.youtube.com/embed/live_stream?channel=ID_DO_CANAL.
Destination without an address. With a custom RTMP server, Airo cannot know where the video shows up and watch_url is null. Use a fixed channel address instead, such as https://www.youtube.com/embed/live_stream?channel=CHANNEL_ID.

6Encerre a transmissãoEnd the stream

painel.js
ws.send(JSON.stringify({ type: "function", id: "stop", name: "StopStreaming" }));

StopStreaming para na hora, sem pedir confirmação ao operador, então peça a confirmação no painel. O Airo envia stream.stopped e o seu servidor tira o player do site.

StopStreaming stops immediately, without asking the operator, so ask for confirmation in the dashboard. Airo sends stream.stopped and your server takes the player off the website.

CuidadosThings to watch

  • O token fica no navegador do painel. Use um token extra só com Leitura e Transmissão, nunca o principal.
  • The token lives in the dashboard's browser. Use an extra token with only Read and Broadcast, never the main one.
  • A conexão é ws://, sem TLS: funciona em localhost e na rede local, não pela internet.
  • The connection is ws://, without TLS: it works on localhost and the local network, not over the internet.
  • A partir de uma página https, os navegadores aceitam ws://localhost, mas bloqueiam ws:// para um IP da rede. Por isso o painel abre no mesmo computador do Airo. Em outro computador, deixe o operador iniciar pelo Airo e use só os webhooks.
  • From an https page, browsers accept ws://localhost but block ws:// to a network IP. That is why the dashboard opens on the Airo computer. On another computer, let the operator start from Airo and rely on the webhooks alone.

Referência: webhooks e eventos →Reference: webhooks and events →

ReferênciaReference

Webhooks e eventosWebhooks and events

O Airo avisa outros sistemas quando algo acontece, enviando um pedido HTTP com JSON para o endereço cadastrado em Configurações › Webhooks.

Airo notifies other systems when something happens by sending an HTTP request with JSON to the address registered under Settings › Webhooks.

O pedidoThe request

http
POST https://painel.suaigreja.org/hooks/airo
Content-Type: application/json
User-Agent: Airo/1.4.2
X-Airo-Event: input.program
X-Airo-Delivery: dlv_9f31a2c4e7b0
X-Airo-Signature: sha256=3f6c…

{
  "id": "dlv_9f31a2c4e7b0",
  "event": "input.program",
  "timestamp": "2026-11-15T10:42:18-03:00",
  "project": "Evento de domingo",
  "airo_version": "1.4.2",
  "data": {
    "input": { "id": 4, "number": 1, "name": "Câmera Púlpito", "type": "camera" },
    "previous": { "id": 7, "number": 2, "name": "Câmera Geral", "type": "camera" },
    "transition": "fade",
    "duration_ms": 500
  }
}
CampoFieldO que éWhat it is
idIdentificador da entrega, o mesmo de X-Airo-Delivery. Use para ignorar repetidas.Delivery identifier, the same as X-Airo-Delivery. Use it to ignore repeats.
eventNome técnico do evento.Technical name of the event.
timestampQuando aconteceu, em ISO 8601 com o fuso do computador.When it happened, ISO 8601 with the computer's time zone.
projectNome do preset aberto.Name of the open preset.
dataOs dados do evento.The event data.

EventosEvents

EventoEventQuandoWhendatadata
stream.startedA transmissão começou e o destino confirmou.The stream started and the destination confirmed.destinations, watch_url, resolution, fps, bitrate_kbps
stream.stoppedA transmissão terminou.The stream ended.duration_s
stream.reconnectingUm destino parou de enviar depois de ter enviado.A destination stopped sending after having sent.stalled_destinations, attempt
recording.startedA gravação começou.Recording started.file, format
recording.stoppedA gravação terminou.Recording ended.file, duration_s, size_mb
input.programUm input foi para o program.An input went to program.input, previous, transition, duration_ms
input.previewUm input foi para o preview.An input went to preview.input
overlay.on / overlay.offUm overlay (1 a 4) entrou ou saiu.An overlay (1 to 4) came on or went off.overlay, input
preset.loadedUm preset foi aberto.A preset was opened.preset, path, inputs
app.startedO Airo terminou de abrir.Airo finished opening.version, machine

Conferir a assinaturaChecking the signature

X-Airo-Signature é sha256= seguido do HMAC-SHA256, em hexadecimal minúsculo, do corpo exato recebido, usando o segredo (whsec_…) mostrado no cadastro. Compare em tempo constante e recuse se não bater.

X-Airo-Signature is sha256= followed by the lowercase hex HMAC-SHA256 of the exact body received, using the secret (whsec_…) shown when you register the webhook. Compare in constant time and reject on mismatch.

server.py
import hashlib, hmac, os
from flask import Flask, abort, request

SECRET = os.environ["AIRO_WEBHOOK_SECRET"].encode()  # whsec_…
app = Flask(__name__)

@app.post("/hooks/airo")
def airo():
    body = request.get_data()
    expected = "sha256=" + hmac.new(SECRET, body, hashlib.sha256).hexdigest()
    received = request.headers.get("X-Airo-Signature", "").encode("latin-1", "replace")
    if not hmac.compare_digest(expected.encode(), received):
        abort(401)
    delivery = request.get_json()
    print(delivery["event"], delivery["data"])
    return "", 204

Entrega e tentativasDelivery and retries

  • Sucesso é qualquer resposta 2xx. Outra resposta, falta de conexão ou tempo esgotado conta como falha.
  • Success is any 2xx response. Any other response, a failed connection or a timeout counts as a failure.
  • Tempo limite por envio: 2, 5 (padrão) ou 10 segundos.
  • Timeout per attempt: 2, 5 (default) or 10 seconds.
  • Tentativas: 1, 3 (padrão) ou 5, com intervalo crescente (10 s, 30 s, 90 s) ou fixo (10 s).
  • Attempts: 1, 3 (default) or 5, with growing (10 s, 30 s, 90 s) or fixed (10 s) intervals.
  • Pausa automática: depois de 3 entregas seguidas que falharam em todas as tentativas, o webhook pausa sozinho.
  • Automatic pause: after 3 deliveries in a row fail every attempt, the webhook pauses itself.
  • Redirecionamento não é seguido: um 3xx conta como falha.
  • Redirects are not followed: a 3xx counts as a failure.
  • Histórico: as últimas 50 entregas de cada webhook ficam guardadas por 7 dias, com reenvio.
  • History: the last 50 deliveries of each webhook are kept for 7 days and can be resent.
  • Enviar nunca trava o vídeo: tudo é assíncrono.
  • Sending never blocks the video: everything is asynchronous.

Voltar para Começando ↑Back to Getting started ↑