iota-hub
IOTA Hub is where observers of asteroid occultations send
their observations to IOTA: a report, a light curve, an instrument log, and
optionally a VizieR file, checked and reviewed in one place instead of by email.
iota-hub is the command-line tool and Python library for its public API v1 —
it creates the draft, uploads the files, runs the observer checks, and submits
when the checks are clean. It is meant for observers who want their submission
scripted or reduced to one command, and for AI agents acting on an observer's
behalf. There are three ways in, in the order you should try them: the CLI
first, the Python library second when you are building something of your
own, and the raw HTTP API last, documented at
https://iota-hub.com/developers/api.
Quickstart (CLI)
No install needed if you have uv:
uvx iota-hub auth login # paste your API key when prompted
cd 20180305_9721_Doty_Observer_POS
uvx iota-hub submit
Prefer it on your PATH: uv tool install iota-hub, or pipx install iota-hub,
and then run iota-hub instead of uvx iota-hub.
A clean run looks about like this (progress on stderr, the result on stdout):
Creating draft (4 files)...
Uploading report (1/4)...
Uploading lightcurve (2/4)...
Uploading log (3/4)...
Uploading attachment field_notes.png (4/4)...
Finalizing draft...
Waiting for checks...
Submitted obs_01HZY4A1K2QX
report 20180305_9721_Doty_Observer_POS.xlsx
lightcurve 20180305_9721_Doty_Observer_POS.csv
log 20180305_9721_Doty_Observer_POS_pyote_log.txt
attachment field_notes.png
checks complete, 0 open findings
submit is the whole job: it creates a draft, uploads each file straight to
storage (files never travel through the API), finalizes, waits for the observer
check run, and submits the observation when — and only when — the draft comes
back ready. If the run leaves open findings, or something required is still
missing, it does not submit: the draft stays in your Drafts, the findings are
printed with the exact commands that resolve them, along with the draft's
Web: link to finish it in the browser, and the exit code is 4. Nothing is
ever guessed and nothing is ever thrown away — a draft it could not submit is
recoverable in the web app. Submitting something that is already submitted is
not an error either: it reports submitted.
Skipped checks are said out loud. A check that could not run never blocks
submit, so after "Waiting for checks..." submit prints a WARNING block on
stderr naming every skipped check and why. The usual one is check 11 (near the
predicted time), which needs an Occult Watcher Cloud link: the Hub matches the
OWC event itself after the upload, and when it cannot choose (several
candidates, a mismatch, nothing found) the block lists the candidates and the
commands to settle it — iota-hub drafts owc <id> --pick <owc_event_id>,
--link <url> or --none. Use submit --draft if you want to settle it
before submitting.
Useful variations:
iota-hub submit --draft— do everything except the final submit, so you can review it in the web app first.iota-hub submit --dry-run— print the slot mapping, the file sizes and the target, and call nothing.iota-hub submit --json— one JSON document on stdout, for scripts and agents.iota-hub submit --no-wait— return after the upload with the draft id and itsWeb:link;--timeout Schanges how long it waits (default 10 minutes).
Not sure whether an earlier run already created the draft? Ask before creating a second one — it finds your own draft or submission by what it observed, or says whether the event exists:
iota-hub observations check --asteroid-id 9721 --asteroid-name Doty \
--star-id 1234-56789 --date 2018-03-05
Which file goes where
submit takes a directory (the current one by default) and maps its files onto
the five slots by rules only. The observer naming convention
(YYYYMMDD_<number>_<name>_<lastname>_POS|NEG[-X], see
https://iota-hub.com/data-submission) already carries enough signal, so there
is no classification and no content sniffing:
| Slot | Rule | Required |
|---|---|---|
report |
exactly one .xlsx / .xls, or a Tangra .json report |
yes |
lightcurve |
at most one .csv |
POS/UNSURE |
log |
at most one .txt whose name contains log |
POS/UNSURE |
vizier |
at most one .dat |
no |
aperture_record |
at most one Tangra .lc or PyMovie .pymovie |
no |
A folder with no report stops the command before anything is sent. Only the Hub knows the result, once it has read the report, so a POS or UNSURE observation with no light curve or log becomes a draft that lists what it still needs.
The listing is non-recursive and skips subdirectories and dotfiles; extensions
match case-insensitively, so .CSV is a light curve.
The NA spreadsheet is still the primary report; a folder holding both a
spreadsheet and a .json is ambiguous, so name the one you mean with
--report. The aperture record has its own slot (up to 500 MB), so it is not
an attachment.
Anything the rules do not claim — field_notes.txt, a PyOTE .png — is
uploaded as an attachment, just like the web app's
"Optional Attachments". The web app's limits apply, and are checked before
anything is created, so a folder that breaks one fails whole (exit code 2)
with every offending file named:
- at most 25 attachments per observation,
- at most 50 MB each,
- no executables or scripts (
.exe,.bat,.cmd,.sh,.ps1,.js,.py,.php,.pl,.rb,.jar,.msi,.dll,.so).
--no-attachments uploads only the five slots and lists the rest as not
uploaded; --attach PATH (repeatable) adds a file from outside the folder.
--dry-run shows the attachments too. Afterwards,
iota-hub drafts files add <id> attachment <path> adds one and
iota-hub drafts files rm <id> attachment <attachment_id> removes one (the ids
are in iota-hub drafts show <id>).
Ambiguity is an error, never a guess. Two candidates for one slot, or no
report, stops the command with the names of the files involved and
the flag that settles it. The overrides are --report PATH,
--lightcurve PATH, --log PATH, --vizier PATH and --aperture-record PATH;
each is checked only for the slot's extension. The "contains log" rule only
tells two .txt files in a folder apart, so --log PATH takes any .txt — a
Tangra fit log or notes.txt alike.
Correcting a submitted observation is the same command as fixing a draft:
iota-hub drafts files add <id> <slot> <path> replaces the file and marks the
observation amended. A replacement report must still describe the same
observation (otherwise identity_changed, exit code 2, and nothing changes),
and once its event is in review the Hub refuses (already_processed, exit code
1) — ask a coordinator then.
Getting a key
Sign in to IOTA Hub and open the Developers page (/developers); the
API keys section is there. The key is shown once, is stored hashed, and you
may have up to 10.
- Scopes, fixed when the key is created:
readfor every read,observations:writefor every write. A key missing the scope a call needs is403 insufficient_scope. - Lifetime, chosen when the key is created: 30 days, 90 days, 1 year (the
default), or never. An expired key is
401 expired_api_key. - A key acts as its owner — exactly what that account can do in the web app, nothing more.
Give the key to the tool in one of two ways, never as a command-line argument
(it would land in your shell history and in ps):
iota-hub auth login # prompts with hidden input, stores it
export IOTA_HUB_API_KEY=... # the CI and agent path, no login step
iota-hub auth status shows which profile is in use, the target base URL and
the identifying prefix of the key (iotahub_<key_id>_..., never the secret),
and makes one cheap read to say whether the key is actually valid.
iota-hub auth logout removes a stored profile.
Both select a profile like every other command: --profile, then
IOTA_HUB_PROFILE, then the config file's default_profile (the first profile
you saved), then default, and both print the one they used. If it already
holds a key, auth login asks before replacing it on a terminal (--yes skips
the question); with a piped key, it replaces the key and says so on stderr.
Profiles keep a key and its base URL together, so a development key is never sent to production or the reverse:
iota-hub auth login --profile dev --base-url <dev base URL>
iota-hub submit --profile dev # or IOTA_HUB_PROFILE=dev
--json, --profile and --base-url are accepted after the subcommand, as
above, and before it (iota-hub --profile dev submit) — whichever reads better.
When both carry a value, the one after the subcommand wins.
Whenever the resolved target is not the production default, the CLI prints
Target: <base URL> on stderr before acting, so a test run is never mistaken
for a real submission. Settings resolve flag > environment > config file >
default, and the config file lives where the platform puts configuration:
| Platform | Path |
|---|---|
| Linux | ~/.config/iota-hub/config.toml |
| macOS | ~/Library/Application Support/iota-hub/config.toml |
| Windows | %LOCALAPPDATA%\iota-hub\config.toml |
On POSIX the file is written 0600. On Windows the protection is the ACL on
your user profile directory; the tool does not set permissions itself. There is
no OS keyring integration.
For scripts and agents
-
--jsonworks on every command: exactly one JSON document on stdout and nothing else. Errors are JSON too, on stderr, in the API's problem-details shape plus the HTTP status, the retry wait and the exit code:{"code": "open_findings", "message": "...", "hint": "...", "details": {}, "status": 409, "retry_after": null, "exit_code": 4}. That document is all a failed run writes to stderr;Target:and progress lines appear only once a run has succeeded. An error after a draft was created says which one indetails.observation_id. Branch oncode, never onmessage. A bad invocation is JSON too, asusage_errorwith exit code2. -
Exit codes — branch on these rather than parsing output:
Code Meaning Typical cause 0success also --draft,--dry-runand--no-wait, which end where you asked1error any other failure, including 5xxand network failures2usage bad flags, missing argument, an ambiguous or incomplete slot mapping, a replacement report for another observation ( identity_changed)3auth no key configured, or the API rejected it 4open findings / not ready findings to fix or dismiss, something required missing, or a wait timeout 5rate limited still rate limited after the built-in retries -
iota-hub guideprints the full workflow guide, bundled in the package — no network, and the same text an agent can read before acting. -
SKILL.mdin this repository is a ready-made skill for Claude Code or any agent that readsSKILL.md. Point your agent at it. -
Never prompts when stdin is not a TTY. Destructive commands take
--yes. -
On a terminal, output is colored and spaced for reading; it is plain, colorless text when piped, under
--jsonor whenNO_COLORis set, and is plain ASCII by default so a non-UTF-8 Windows console survives it. -
The literal next command for every action the API says is available is printed in human output and returned as
next_commandsinsubmit --json, so neither a person nor an agent has to translate a verb into a command. -
submit --jsonalso carriesskipped_checks(every check that did not run, with its reason) andowc_commands(the commands that settle an unresolved OWC link; empty when there is nothing to settle). Neither changes the exit code: they warn, they never block.
Python library
The library is the same code the CLI is built on, importable on its own. Its
guide is docs/library.md, also at
https://iota-hub.com/developers/library.
import os
from iota_hub import Client
with Client(api_key=os.environ["IOTA_HUB_API_KEY"]) as client:
result = client.submit_folder("path/to/observation")
print(result.outcome, result.observation_id)
if result.outcome == "needs_attention":
checks = result.observation.checks
for finding in checks.findings if checks else []:
print(finding.fingerprint, finding.message, finding.how_to_fix)
# Fix one and the draft re-arms its checks:
client.replace_file(result.observation_id, "lightcurve", "fixed.csv")
for observation in client.iter_observations(submission_status="draft"):
print(observation.observation_id, observation.submission_status)
client.download_files("observation", result.observation_id, "downloads/")
result.outcome is the vocabulary to branch on: submitted (also when it
already was), ready (clean but left a draft), needs_attention (findings,
something missing, or the run errored), or draft (wait=False, uploaded and
finalized but not waited on). result.observation.web_url is the observation in
the web app, and result.observation.status is the derived draft /
submitted / amended / locked. client.check_observation(asteroid_name=..., star_id=..., observed_date="YYYY-MM-DD", asteroid_id=...) is the lookup before
a create.
Two layers, deliberately kept apart. The transport layer is one method per
public API operation (create_draft, submit_draft, list_events,
list_observation_files, ...), returning hand-written pydantic models. The
workflow layer is what the API cannot do for you: submit_folder,
submit_files, wait_for_checks, replace_file, download_files, and the
folder-to-slot mapping in iota_hub.files.
Retries (429/5xx, honouring Retry-After), one idempotency key per logical
call, and the base64 SHA-256 declared on every upload are all handled for you.
Errors are one exception type, IotaHubError, carrying .code, .message,
.hint, .details, .status and .retry_after; the subclasses AuthError,
RateLimitError, NotFoundError, ConflictError, RequestError and
TransportError group the codes by category, so you can catch broadly without
enumerating them. Models ignore fields they do not know, so an additive API
change never breaks an installed version.
Environments
The default target is production, https://api.iota-hub.com. The public API
is not live in production yet — its release is pending, and until then the
development deployment is where third-party developers build: sign up there,
create a key, and use a dev profile. The development base URL is published on
that site's /developers page; no non-production URL is baked into this
package.
iota-hub auth login --profile dev --base-url <the dev base URL>
iota-hub observations list --profile dev
--base-url (and IOTA_HUB_BASE_URL) is the API base; the client appends
/public/v1 itself. Local development against a checkout of the API is
--base-url http://localhost:8000.
Under the hood: the HTTP API
Everything here is a client of one frozen, versioned HTTP surface, /public/v1,
which stays public for anyone the CLI and the library do not fit. It is the hard
way — presigned S3 uploads, polling, idempotency keys — which is exactly why
this package exists.
The raw-HTTP walkthrough is at https://iota-hub.com/developers/api
(interactive reference at /developers/reference, the raw workflow guide at
/developers/guide.md; keys are on /developers). Porting a client to another language starts from
spec/openapi.json, vendored here and checked against the
live document in CI, and
docs/client-conventions.md, which specifies
everything the API itself does not: configuration, retries, polling, folder
mapping, exit codes and output.
Requirements
Python 3.10 or newer, on Windows, macOS or Linux. Runtime dependencies are
httpx, pydantic, typer and platformdirs.
Versioning
Semantic versioning, 0.x until the public API's production release. A
major bump is removing a command or a flag, or changing the shape of a
--json document. New commands, new optional flags and new fields in a --json
document are additive and are not.
Contributing
Issues and pull requests go to skycarl/iota-hub-python — including issues about the API itself (a wrong status code, a missing filter, an unclear finding), which the maintainer takes to the API from there.
License
MIT. See LICENSE.
Metadata
Release files for iota-hub 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iota_hub-0.2.0.tar.gz | 58.2 kB | With provenance | Details for iota_hub-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iota_hub-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for iota_hub-0.2.0-py3-none-any.whl |
Total release size: 123.6 kB
Release files / iota_hub-0.2.0.tar.gz
| Download URL | iota_hub-0.2.0.tar.gz |
|---|---|
| Size | 58.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13645e40ebab02b525e10ebc5da560223459a219ccdd3a98df3498be02a36d4e
|
|
BLAKE2b-256 checksum How to use checksums |
a81470dcee8f5300c353eeca6b43e8ec2d16d2656c1085e6128baa87146cbfd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / iota_hub-0.2.0-py3-none-any.whl
| Download URL | iota_hub-0.2.0-py3-none-any.whl |
|---|---|
| Size | 65.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9fdd32e4c8fc454d02435f509a932e70a71c00b62caefdf11be656379874b55
|
|
BLAKE2b-256 checksum How to use checksums |
f315b8f02097c9f57baf71d871ec4bd47a43353c730d67c7b9725bf2d7b93d62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for iota-hub 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for iota_hub-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.