CLI

The Sarkoa CLI (sarkoa) uploads, lists, downloads, and manages files from the terminal. It works with the same account and API keys as the QGIS plugin.

Requirements: Python 3.10+ on Linux or macOS (curl installer or pipx). Debian/Ubuntu apt and PyPI are coming soon.

Install

Prefer inspecting the script before piping:

curl -fsSL https://packages.sarkoa.com/install.sh
curl -fsSL https://packages.sarkoa.com/install.sh | bash
sarkoa --help

pipx (CDN wheel)

pip/pipx need a versioned wheel filename in the URL. Resolve the wheels/LATEST pointer first (do not pass the rolling latest alias URL to pipx):

pipx install "https://packages.sarkoa.com/wheels/$(curl -fsSL https://packages.sarkoa.com/wheels/LATEST)"
sarkoa --help

Or: pip install "https://packages.sarkoa.com/wheels/$(curl -fsSL https://packages.sarkoa.com/wheels/LATEST)" inside a virtual environment.

Coming soon: PyPI and apt

When published: pipx install sarkoa, or the Debian/Ubuntu apt source at https://packages.sarkoa.com/apt.

More install options: Integrations.

Configuration

Point the CLI at your API key. Settings resolve in this order (first wins):

  1. --token TOKEN CLI flag (one-shot; not stored)
  2. SARKOA_* environment variables
  3. ~/.sarkoa/config JSON (via sarkoa config set)

The CLI talks to the Sarkoa web app by default. You do not need to set a base URL for normal use.

Persist credentials

sarkoa config set token YOUR_API_TOKEN
sarkoa config set org-id YOUR_ORG_UUID   # optional; same as SARKOA_ORGANIZATION_ID
sarkoa config show                      # token masked

You need an API key from the web app, see Authentication.

Environment variables

Variable Purpose
SARKOA_API_TOKEN Profile API key for file and map commands; an Asset API key with tokens:mint for delegated-token commands
SARKOA_ORGANIZATION_ID Org UUID from the web app URL (/org/<uuid>/…). Usually unnecessary (the API key already targets one org); required for download-bulk (also via org-id / --org)

download-bulk accepts a Profile API key with read scope. Supply the organization ID as well as the asset IDs and destination directory. Delegated-token commands use a different key type, described below.

Commands

Grouped by what they act on. Most commands take --json where a machine-readable form makes sense, and --help on any subcommand lists its flags.

Battle maps

Command Purpose
sarkoa orbat template DIR Write example orbat.csv, fronts.csv, axes.csv and events.csv to start from
sarkoa orbat validate --orbat F [--fronts F] [--axes F] [--events F] Check the tables and print every problem, with line numbers. --bbox W,S,E,N makes a position outside the box an error (it catches swapped longitude and latitude; W greater than E is a box across the antimeridian); --max-gap-hours N warns on long gaps
sarkoa orbat build ... --out DIR Validate, then write tracks.geojson, fronts.geojson, axes.geojson, events.geojson and battle-style.json. --sides allied=friend,axis=hostile says who is who; --tour also writes a tour with a stop for each event (--tour-id, --tour-title, --tour-zoom, --no-tour-play); --symbols silhouette draws ships and aircraft as top-down shapes, --trail-hours N adds fading trails, --fade-hours N sets how long a finished arrow takes to fade
sarkoa orbat reference --bbox W,S,E,N [--graticule DEG] [--rings NAME,LON,LAT,RADIUS[,RADIUS...]] [--ring-unit km|nm|mi] [--place NAME,LON,LAT] --out DIR Write a reference layer for open sea or bare ground: a labelled graticule, the antimeridian, range rings and named places

| sarkoa tracks template\|validate\|build\|reference | The same commands under an everyday name, for ferries, flights, vehicles, animals and storms: the group column is side, --tracks is --orbat, shapes are the default and the style file is tracks-style.json |

build and validate also take --sightings F (what each side knew, for a "View as" control). The tables take evidence, corrected_by and corrected_by_url (axes and events), zoom (events), and radius_m and alt_of (units).

See Battle maps. Nothing is uploaded: you upload the files and apply sarkoa map tour add MAP --title T --stops-file DIR/tour.json yourself.

Files and folders

Command Purpose
sarkoa upload PATH Upload a source file up to 10 GiB; optional --folder FOLDER to place it in a folder. The current CLI does not use --cloud-native to upload a second, pre-built copy or bypass the size limit. See File optimization for preparing larger sources. Large transfers show a progress bar on a TTY (--progress / --no-progress). For GRIB and NetCDF files that hold several fields, --grib-band ELEMENT:LEVEL (repeat it for a wind pair), --netcdf-variable NAME or --netcdf-variables U,V choose what to map (see Weather and climate files). --celestial-body names the world the file is on, and --source-crs CODE gives its CRS as an authority code (see Files on other worlds). For a vector that changes over time, --time-field COLUMN (an instant) or --time-start-field COLUMN --time-end-field COLUMN (an interval) makes a layer the map's time slider filters, and --temporal-mode off keeps a file with a date column static (see Vectors over time)
sarkoa sync DIR Upload everything in a local directory that is not already in the library (--folder, --recursive, --dry-run). Run it with --dry-run first to see what it would send
sarkoa list List files: name, type (Polygon / Polyline / Raster bands / Folder), status, size, relative time, short ref (--json, --search, --folder)
sarkoa mkdir NAME Create a folder (--parent FOLDER to nest it)
sarkoa mv REF FOLDER Move a file or folder (--root to move to the library root)
sarkoa rename REF NAME Change a file or folder's display name. The stored object is untouched
sarkoa status REF Processing status and metadata (full ID, type, format)
sarkoa inspect REF Fields, statistics, geometry, and bands for styling decisions (--json). Run this before writing a style or a --where filter
sarkoa retry REF Requeue a file whose optimization failed. --dry-run prints the failure diagnosis without requeueing
sarkoa reprocess REF Re-run an Active orbit, point cloud, splat or 3D Tiles file from its original upload, for example after a processing fix (at most 3 per file per 24 hours). The current version stays live until the new one succeeds. --dry-run shows whether the file can be reprocessed without queueing anything
sarkoa quota SIZE Ask whether an upload of that size would exceed the plan limit. SIZE is a byte count or a path (--json)
sarkoa download REF DEST Download to a destination path (progress bar on large TTY transfers)
sarkoa download-bulk --asset-ids ID[,ID...] DIR Bulk download via the manifest API. Needs a Profile key with read scope and --org or a configured organization ID
sarkoa view REF Open the file in the web app; --print-only
sarkoa delete REF --yes Delete (requires --yes; folders that still have contents also need --recursive)

Sharing

Command Purpose
sarkoa share create REF Create a public /share/… link (--access, --expires-days, --password, --json)
sarkoa share list REF List shares for a file (--json)
sarkoa share revoke REF SHARE_ID --yes Revoke a share (requires --yes)

Time series

Command Purpose
sarkoa series list List your Time series
sarkoa series create NAME Create a Time series container (see Time series); optional --celestial-body for a series on another world
sarkoa series append SERIES_ID PATH --captured-at ISO Add one dated snapshot to a series; optional --period-start, --idempotency-key, --temporal-mode off (recommended for vector snapshots)
sarkoa series status SERIES_ID REQUEST_ID Check whether an append finished

Maps

Command Purpose
sarkoa map list List custom maps (--json)
sarkoa map get REF Print or save a full map document (--json, --output)
sarkoa map create --file map.json Create a map from a map document (--dry-run, --json; --yes for public, password, or email-invite)
sarkoa map apply REF --file map.json Replace a map with a document (--expected-revision, --dry-run; --yes to publish)
sarkoa map validate --file map.json Validate a map document without saving
sarkoa map export REF --output map.json Export the current map document
sarkoa map clone REF Duplicate a map (--title, --json)
sarkoa map open REF Open the map viewer (--print-only)
sarkoa map embed REF Print a ready-to-paste iframe (--width, --height, --title) or just the URL (--url-only)
sarkoa map delete REF --yes Delete a map (requires --yes)
sarkoa map display REF Set visitor defaults: --mode 2d|3d and --projection mercator|flat|globe
sarkoa map access REF Set who can open the map: --mode organization|org|public|specific_users|invited_emails|password (--yes for public, password, and email invite)

Map layers

Command Purpose
sarkoa map layer add MAP --asset REF Add a file as a layer (--attribution-text, --attribution-url)
sarkoa map layer remove MAP LAYER Remove a layer
sarkoa map layer show|hide MAP LAYER Toggle layer visibility
sarkoa map layer style MAP LAYER --file style.json Replace a layer style
sarkoa map layer classify MAP LAYER --attribute FIELD Assign categorized class colours (--shuffle to recolour)
sarkoa map layer attribution MAP LAYER Set the cartographic credit for one layer
sarkoa map layer popup MAP LAYER Configure the click popup: --fields, --title-field, --image-fields, --chart JSON (repeatable, up to two), --disable, --clear
sarkoa map layer legend MAP LAYER Set a vector or raster legend title and visibility (--title, --disable, --clear). Raster legends also accept --min-label, --max-label, and --unit

Map review

Command Purpose
sarkoa map comment list MAP List review comments, open and resolved
sarkoa map comment add MAP Post a comment, or reply to a thread
sarkoa map comment resolve MAP COMMENT_ID Resolve a comment, or reopen it
sarkoa map comment delete MAP COMMENT_ID Delete a comment

Map printing

These prepare a printed sheet and print a link to the print composer. None of them downloads a PDF: the composer makes it in your browser. See Printing maps.

Command Purpose
sarkoa map print-layout preview MAP Check a layout without saving it (--spec FILE; without one it previews the default sheet). Prints the report and warnings, with a composer link that carries the layout
sarkoa map print-layout create MAP --spec FILE --name NAME Save a layout under a name and print its composer link (needs edit access to the map)
sarkoa map print-layout list MAP Saved layouts, and the paper sizes and resolution the map's plan can print
sarkoa map print-layout get MAP LAYOUT_ID One layout's composer link and report; --output FILE saves its JSON for editing
sarkoa map print-layout update MAP LAYOUT_ID Rename (--name) or replace the layout's JSON (--spec FILE, the whole of it, not a merge)
sarkoa map print-layout open MAP [LAYOUT_ID] Print the composer link and open it in your browser (--spec FILE for an unsaved layout, --no-browser to only print it)
sarkoa map print-layout delete MAP LAYOUT_ID --yes Delete a saved layout (requires --yes)

Listing in Explore

When the directory is enabled, listing puts a public map in Explore and makes its listing available to search engines. Publishing a map does not list it. Check Explore availability and listing requirements before using these commands.

Command Purpose
sarkoa map listing get MAP Whether the map is listed, each check it does not pass (with the layers involved), and the links to the guidelines and terms
sarkoa map listing set MAP --listed --category SLUG --confirm-guidelines List the map. --confirm-guidelines is your confirmation that it follows the community guidelines, and --tag (repeatable) replaces the map's own tags. When get says the terms changed, accept them once in the map builder: an API key cannot accept them for you
sarkoa map listing set MAP --unlisted Take the map out of Explore. The map and its link are unchanged

Querying data

Command Purpose
sarkoa query REF Filter a hosted vector layer without downloading it: --bbox, --where FIELD:OP:VALUE (repeatable), --fields, --limit (default 100, max 1000), --offset, --no-geometry, --output. See Feature query
sarkoa sample REF --at LNG,LAT Read the values a hosted raster stores at one point, longitude first; --json for the full answer. See Raster values at a point
sarkoa stats REF --geometry boundary.geojson Summarize raw COG values inside a WGS84 Polygon or MultiPolygon. Reports count, mean, min, max, sum and standard deviation as JSON; optional --bands or --expr, --percentiles, --histogram-bins, --all-touched. At most 1,048,576 pixels are sampled; larger areas can use an overview marked approximate. --min-resolution METRES refuses a coarser result. Scale and offset are not applied
sarkoa stac search Search the raster catalogue: --bbox, --datetime, --collection {rgb,multispectral,singleband,elevation}, --limit, --offset. On another world, --target Moon or a scoped collection such as moon-rgb

Webhooks

Command Purpose
sarkoa webhook list List endpoints (--events also prints the subscribable event types)
sarkoa webhook create URL Register an endpoint (--event repeatable, --description). Prints the signing secret once
sarkoa webhook test ID Send a signed test delivery now and show what the endpoint returned
sarkoa webhook rotate ID Issue a new signing secret (takes effect immediately, with no overlap)
sarkoa webhook deliveries Recent delivery attempts (--webhook-id, --status, --limit)
sarkoa webhook delete ID Remove an endpoint and its pending deliveries

Delegated access tokens

Use these when a browser or another service needs limited, short-lived access without holding your API key. Minting requires the tokens:mint scope.

Authentication: these commands require an Asset API key from API Routes with tokens:mint and at least one of tiles:read or metadata:read. A Profile API key is not sufficient. Pass the Asset key with the global --token option or use a separate environment/configuration for this integration.

Command Purpose
sarkoa token mint --subject ID --action ACTION --asset REF Mint a delegated token, printed once as JSON. Repeat --action and resource grants (--asset, --folder, --map, --series) as needed. --ttl sets the lifetime in seconds, up to one hour (default 900). Treat the returned token as a credential
sarkoa token revoke --id TOKEN_ID Revoke one token. Use --subject ID instead to revoke all live tokens for that subject

Account

Command Purpose
sarkoa whoami Show email, organization, scopes, and auth method
sarkoa config … set / show / clear stored config

Folders in practice

Create a folder, upload into it, list its contents, or move files. Names, short refs, and full IDs all work as folder references.

sarkoa mkdir Surveys
sarkoa mkdir 2026 --parent Surveys
sarkoa upload ./data.geojson --folder Surveys
sarkoa list --folder Surveys
sarkoa mv ./other.geojson Surveys
sarkoa mv abc12345 --root
sarkoa delete Surveys --yes --recursive

sarkoa list without --folder shows the library root (folders and files that are not nested). Deleting a folder that still has contents requires --recursive.

Large series appends resume automatically if the connection drops, so you do not need to restart a long upload from the beginning.

Upload rate limits

Completing an upload (POST /api/uploads/complete) is limited to 30 requests per 10 minutes per API key. Presign allows 60 per 10 minutes. If you receive 429 Too Many Requests, wait for the number of seconds in the Retry-After response header before trying again. The CLI handles this automatically for completion. For bulk backfills, pace uploads (about one completion every 20 seconds stays under the cap).

Map documents

Custom maps are authored as JSON documents (apiVersion: "sarkoa.com/maps/v1"). A document can set the camera, basemap and theme, access mode, collaboration/download settings, and per-layer styles such as fill color, outline, categorized or graduated symbology, raster palettes, popups, and legends.

Example:

sarkoa map validate --file ./quake-map.json
sarkoa map create --file ./quake-map.json --json
sarkoa map layer add MAP_ID --asset faults.geojson --attribution-text "City of Ottawa" --attribution-url https://ottawa.ca
sarkoa map layer classify MAP_ID layer-a --attribute kind
sarkoa map layer classify MAP_ID layer-a --shuffle
sarkoa map display MAP_ID --mode 2d --projection globe
sarkoa map access MAP_ID --mode organization
sarkoa map layer style MAP_ID layer-a --file ./fault-style.json
sarkoa map open MAP_ID

Use --file=- to read a document from stdin. Prefer --expected-revision when updating an existing map so concurrent edits do not overwrite each other. Public, password-protected, and email-invite maps need --yes on map create, map apply, and map access.

Backfilling a directory

sarkoa sync uploads what is missing rather than re-sending what is already there, which makes it safe to re-run after a failure part way through a large batch.

sarkoa sync ./exports --folder Surveys --recursive --dry-run
sarkoa sync ./exports --folder Surveys --recursive

Always do the --dry-run pass first. It prints exactly what would upload and stops, which is the cheapest way to notice you pointed it at the wrong directory. Mind the completion rate limit above on large batches.

Querying instead of downloading

Once a layer is hosted, you can filter it server-side and get GeoJSON back:

sarkoa inspect parcels                 # see the attribute names first
sarkoa query parcels \
  --bbox -79.6,43.5,-79.1,43.9 \
  --where zone:eq:RM4 \
  --where assessed_value:gt:750000 \
  --fields address,zone,assessed_value \
  --output ./rm4.geojson

--no-geometry makes attribute-only work dramatically smaller. Full operator list and paging: Feature query.

For a raster, ask for the stored value at one place instead:

sarkoa sample elevation --at -75.69721,45.42153

The point is longitude first, like --bbox. Every band is printed as stored; nodata and transparent pixels are named rather than shown as numbers.

Vectors over time

Name the column that holds each feature's time, and the layer moves with the map's time slider:

sarkoa upload earthquakes.geojson --time-field origin_time
sarkoa upload ship_sightings.geojson --time-start-field seen --time-end-field until
sarkoa upload parcels.gpkg --temporal-mode off

An interval's end is exclusive, so back-to-back intervals share their boundary (the end of one is the start of the next). Without either option the server may still adopt a column that looks like a date and tie the layer to the slider; --temporal-mode off keeps every feature visible. A point in time and an interval cannot be named together, and an end needs a start: the CLI refuses those before uploading anything. The options are for vectors only. Rasters that change over time are series.

Files on other worlds

Files and series can be on another world: the Moon, Mars, Venus, Mercury, Ceres, Europa, Ganymede, Callisto, Io or Titan. --celestial-body takes earth, moon, mars, venus, mercury, ceres, europa, ganymede, callisto, io or titan, or on an upload auto to read it from the file's CRS. With a world named, a file with no CRS is read as planetocentric latitude and east-positive longitude. auto takes a file with no CRS as Earth:

sarkoa upload tycho_dem.tif --celestial-body auto
sarkoa upload landing_sites.geojson --celestial-body mars
sarkoa upload mosaic.tif --celestial-body moon --source-crs IAU_2015:30100
sarkoa series create "Tycho flights" --celestial-body moon
sarkoa stac search --target Moon --collection moon-elevation

--source-crs takes EPSG:n, ESRI:n or IAU_2015:n. It is needed for DXF, and for a raster on another world with no CRS. An upload with no --celestial-body is treated as Earth. A file's world never changes after processing. sarkoa status prints the world of a file that is not on Earth, and sarkoa sample adds the pixel's true width there. To put a map on another world, set spec.celestialBody in its map document. What is accepted and refused: Maps of other worlds.

Being told when processing finishes

Instead of polling sarkoa status in a loop:

sarkoa webhook create https://example.com/hooks/sarkoa \
  --event asset.processing.succeeded \
  --event asset.processing.failed
sarkoa webhook test WEBHOOK_ID

The signing secret prints once, on create. Store it then. If a delivery goes missing, sarkoa webhook deliveries --status exhausted has the HTTP code your endpoint returned and the error text. See Webhooks.

See sarkoa --help and each subcommand’s --help for flags.