Create Operation Example

Here’s a basic example of how to create a new operation using curl:

#!/bin/bash

# Base variables
API_KEY="your-api-key-here"
BASE_URL="https://portal.demo.unifly.tech/api/gcs"
SERIAL_NUMBER="your-drone-serial-number"

# (Optional) If you haven't selected a pilot / observers yet, see:
# - xref:examples/get-pilots-curl.adoc[List Pilots Example]

# Replace with actual UUIDs from the endpoints above
PILOT_UUID="45bf1aef-20f4-4a46-9011-a4a1bf9b7f82"

# Create new operation
curl -X POST "${BASE_URL}/uas/${SERIAL_NUMBER}/operations" \
     -H "apikey: ${API_KEY}" \
     -H "Content-Type: application/vnd.geo+json" \
     -d @- <<'JSON'
{
  "type": "Feature",
  "properties": {
    "rulesetCode": "opena1",
    "description": "Roof inspection at the train station",
    "lineOfSightType": "VLOS",
    "pilotUuid": "45bf1aef-20f4-4a46-9011-a4a1bf9b7f82",
    "volume": {
      "start": "2025-08-05T09:00:00Z",
      "end":   "2025-08-05T11:00:00Z",
      "maxAltitude": { "wgs84": 60, "amsl": 60, "sfc": 60 }
    }
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
       [4.401394, 51.217974],
       [4.401394, 51.218974],
       [4.402394, 51.218974],
       [4.402394, 51.217974],
       [4.401394, 51.217974]
    ]]
  }
}
JSON

Example response:

{
  "operationId": "e560fa10-0bd7-4d77-852b-3e2025748ceb",
  "portalUrl": "https://portal.demo.unifly.tech/#/company/0f40dfe5-a80c-40eb-b9b2-85b6c99e0064/uasoperation/e560fa10-0bd7-4d77-852b-3e2025748ceb/detailsv2"
}
  • rulesetCode selects the applicable operational rules (e.g., "DEMO").

  • lineOfSightType indicates how the flight will be conducted (for example "VLOS"). Consult the API reference for supported values.

  • pilotUuid is the pilot-in-command.

The operation is created in DRAFT status. You’ll still need to request acceptance and activation before flying.