Skip to main content

uictlapi

PYPI Docker Image MIT license

Curl-like CLI for the UniFi Controller / UniFi OS Web UI API — with login and CSRF handled for you.

Auth and CSRF come from requests-unifi-auth. This package is only the HTTP CLI: any Web UI / proxy URL, any method. It is not a typed UniFi SDK and does not invent domain commands (routes apply, inventory, multi-controller orchestration).

Live auth/CSRF compatibility against real controllers is tracked in requests-unifi-auth COMPATIBILITY.md.

Installation

pip

pip install uictlapi

Requires requests-unifi-auth>=0.1.5.

Docker

docker run --rm akinfold/uictlapi:latest --help

Usage

Auth (-a / --auth):

  • user:pass@host
  • three-line file — username, password, host (password may contain : and @)
  • user:pass or two-line user / pass — host from the request URL (less safe; prefer an explicit host in the file)
  • @/path/to/file — file contains any of the forms above

Host check: if credentials name a host, it must match the URL hostname (case-insensitive). On mismatch the CLI exits without sending the request or credentials.

mkdir -p ~/.config/uictlapi
printf '%s\n' 'user' 'pass' '192.168.1.1' > ~/.config/uictlapi/auth
chmod 600 ~/.config/uictlapi/auth

uictlapi get -a @$HOME/.config/uictlapi/auth --no-verify \
  'https://192.168.1.1/proxy/network/v2/api/site/default/trafficroutes'
# Inline (host in the auth string)
uictlapi get -a 'user:pass@192.168.1.1' --no-verify \
  'https://192.168.1.1/proxy/network/v2/api/site/default/trafficroutes'

# Same via Docker (mount the auth file)
docker run --rm -v "$HOME/.config/uictlapi/auth:/auth:ro" akinfold/uictlapi:latest \
  get -a @/auth --no-verify \
  'https://192.168.1.1/proxy/network/v2/api/site/default/trafficroutes'

# POST JSON body (from string or @file)
uictlapi post -a @$HOME/.config/uictlapi/auth --no-verify \
  -j '{"enabled":true}' \
  'https://192.168.1.1/proxy/network/v2/api/site/default/some-endpoint'

uictlapi --version

Common flags mirror curl-ish habits: -H / -p / -d / -j / -o / --show-headers / --status-only / --no-verify / -t. Exit status 1 on HTTP ≥ 400, 2 on transport errors.

Releasing

Version lives in pyproject.toml and src/uictlapi/__init__.py. Bump on main first (GitHub Actions → Bump version, or locally with bump-my-version), then:

git tag vX.Y.Z
git push origin vX.Y.Z

The Publish workflow runs tests, uploads to PyPI, pushes multi-arch Docker images (X.Y.Z, X.Y, and latest when appropriate), and creates a GitHub Release.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uictlapi-0.1.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uictlapi-0.1.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file uictlapi-0.1.3.tar.gz.

File metadata

  • Download URL: uictlapi-0.1.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uictlapi-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0d4409e2fa12ef6d1dccf722736aeff6af39dda40fd9592f6e4d54ffc4cc1cbc
MD5 65155a8121cc3879eec0dbfaaad7a238
BLAKE2b-256 5fe86801a775a5ff3634ab3fc564e0dbc0756e298857e9c8ee388017d0ae6dd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for uictlapi-0.1.3.tar.gz:

Publisher: publish.yml on akinfold/uictlapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uictlapi-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: uictlapi-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for uictlapi-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1972b194165646be20b565bc1cb9e38c720f07631a1c9d8e0ab9a316ada1791c
MD5 8cf8227708333a0c8042303759910ed9
BLAKE2b-256 0646d3ef080536b01d828b0846856a76e93888ebdb4232abe69b875552e90cb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for uictlapi-0.1.3-py3-none-any.whl:

Publisher: publish.yml on akinfold/uictlapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page