Skip to main content

iota-hub

iota-hub is the command-line tool and Python library for submitting asteroid occultation observations to IOTA Hub NA. It uploads your files, runs the observer checks and submits the observation when it is ready.

Use the CLI to submit a folder or manage observations. Use the Python library to add these operations to your own scripts.

Quickstart

Create an API key. If you have uv, you can run the CLI without installing it:

uvx iota-hub auth login
cd 20180305_9721_Doty_Observer_POS
uvx iota-hub submit

auth login prompts for your key and saves it. To install the command instead, run uv tool install iota-hub or pipx install iota-hub, then use iota-hub in place of uvx iota-hub.

To upgrade, run uv tool upgrade iota-hub or pipx upgrade iota-hub. uvx can reuse a cached older version; run uvx iota-hub@latest ... to get the latest release.

The CLI creates a draft, uploads the files directly to storage, waits for checks and submits when the draft is ready. Progress goes to stderr; the result goes to stdout. A successful result includes these lines (other fields omitted):

Observation:  3c9a7e52-8f14-4b6d-a0e2-5d71c8b4f936
Outcome:      submitted

If checks find missing requirements or findings that need attention, the observation stays in your Drafts. The CLI prints the findings, commands to address them and a Web: link to the draft. It exits with code 4. Failed submissions do not delete the draft.

Option Effect
--draft Upload and run checks, but leave the observation as a draft for review.
--dry-run Show the selected files, their sizes and the target API without sending a request.
--json Return the result as JSON for scripts and agents.
--no-wait Return after upload and finalization, without waiting for checks or submitting.
--timeout S Set the wait for checks in seconds. The default is 600; request time is additional.

Skipped checks appear as warnings with a reason for each one. They do not block submission. Check 12 ("Near predicted time"), for example, needs an Occult Watcher Cloud (OWC) event link. If the Hub cannot select an event, the CLI lists candidates and commands to choose one (drafts owc <id> --pick <owc_event_id>), provide a link (--link <url>) or proceed without one (--none). Use submit --draft to review these warnings before submitting.

If an earlier command stopped or you lost its output, check for an existing observation before running submit again:

iota-hub observations check --asteroid-id 9721 --asteroid-name Doty --star-id 123456 --date 2018-03-05

Take the values from the report (the Doty example report's star is TYC 123456), spelled as the report spells them, with the UTC date. This finds your newest matching draft or submission, or reports whether the event exists. The event is looked up only with --asteroid-id. If the report's name carries a station number (..._Observer_2_POS.xlsx or ..._POS-2.xlsx), add --station 2: the Hub stores that station with the observation, and a lookup without it does not match. A new submit command creates a new draft. To submit an existing draft, use iota-hub drafts submit <id>. That command also succeeds if the observation has already been submitted.

Files to submit

submit reads the current folder, or a folder you specify. It selects files by extension and filename:

File Filename requirements Required
report One .xlsx, .xls or Tangra .json report Yes
lightcurve One .csv file For POS/UNSURE
log One .txt file with log in its name For POS/UNSURE
vizier One .dat file No
aperture_record One Tangra .lc or PyMovie .pymovie file No

A missing report stops the command before upload. The Hub reads the report to determine the observation result. If a POS or UNSURE observation is missing a light curve or log, it remains a draft and lists the missing files.

The CLI skips subfolders, dotfiles and symbolic links, and says which links it skipped. Extensions and the log filename match are case-insensitive. Keep each observation in its own folder. Folders containing multiple stations (_Observer_1_POS, _Observer_2_POS) are not supported.

File names

The Hub expects each file to be named YYYYMMDD_<number>_<Name>_<LastName>[_<N>]_<POS|NEG|UNS>, followed by the file's suffix:

File Standard name
report 20180305_9721_Doty_Observer_POS.xlsx (or .xls)
lightcurve 20180305_9721_Doty_Observer_POS.csv
log (PyOTE) 20180305_9721_Doty_Observer_POS.pyote_log.txt
aperture_record 20180305_9721_Doty_Observer_POS.pymovie (or .lc)

Write a provisional designation with an underscore (1999_RM158) and UNS for an unsure result. If you observed from several stations, put the station number after your last name, not after the result: ..._Observer_2_POS.xlsx. See the submission naming convention.

The CLI selects files by the rules above whatever their names. The Hub reports a name that differs from the standard as a "File names" finding (check 13). The Hub does not rename files uploaded through the API. On a draft created through the API, this finding does not block submission: the CLI shows it, labelled does not block submission, and the draft can still be ready and submitted. Rename the file and upload it again with iota-hub drafts files add <id> <slot> <path>, or dismiss the finding.

If more than one file matches, specify which one to use:

iota-hub submit --report observation.xlsx --lightcurve corrected.csv

The available flags are --report, --lightcurve, --log, --vizier and --aperture-record. Explicit paths must have the correct extension, and a relative path is relative to your current directory, not to the folder. The folder's other candidates for a slot you choose are not uploaded; add --attach PATH to upload one as an attachment. --log accepts any .txt filename, including a Tangra fit log. A folder with both a spreadsheet and a JSON file needs --report to select one.

Attachments

Other files in the folder, such as plots and notes, are uploaded as attachments. The CLI checks these limits before creating the draft:

  • Up to 25 attachments per observation.
  • Up to 50 MB per attachment.
  • No executables or scripts: .exe, .bat, .cmd, .sh, .ps1, .js, .py, .php, .pl, .rb, .jar, .msi, .dll or .so.

A violation exits with code 2 and lists the affected files. The aperture record is separate from attachments and has a 500 MB limit.

Use --no-attachments to exclude the extra files, or repeat --attach PATH to add individual files, including files outside the folder. --dry-run shows attachments as well as the main observation files.

To add or remove an attachment later:

iota-hub drafts files add <id> attachment <path>
iota-hub drafts files rm <id> attachment <attachment_id> --yes

--yes confirms the removal; without a terminal the command otherwise fails with confirmation_required. Find attachment IDs with iota-hub drafts show <id>.

Correct a submitted observation

Replace a file with the same command used for drafts:

iota-hub drafts files add <id> <slot> <path>

The observation becomes amended. A replacement report must describe the same observation; otherwise the API returns identity_changed (exit 2) and leaves the original unchanged. Once the event is in review, replacements return already_processed (exit 1); the observation's status is then locked. Contact a coordinator for changes at that stage. A replacement runs the observer checks again, but their results appear only on the observation's page on IOTA Hub, not in the CLI.

API keys and profiles

Create keys on the API keys page. Each key is shown once, stored hashed by the Hub and limited to its owner's permissions. An account can have up to 10 keys.

  • Choose read for read operations and observations:write for writes. A missing scope returns 403 insufficient_scope.
  • Choose an expiry of 30 days, 90 days, 1 year (the default) or never. An expired key returns 401 expired_api_key.

Run iota-hub auth login to save a key, or set IOTA_HUB_API_KEY in your script or CI environment. Never put a key in a command-line argument: it can appear in shell history and process listings.

iota-hub auth status checks the key with a read request and shows the profile, API address and key prefix. It never prints the secret. iota-hub auth logout removes the selected profile.

Every command selects a profile in this order: --profile, IOTA_HUB_PROFILE, the saved default_profile, then a profile named default. The first profile you save becomes the default. Login asks before replacing an existing key on a terminal; --yes skips that prompt. A piped key replaces the existing key, with a notice on stderr.

Logging out of the default profile does not select a replacement. If profiles remain, the CLI lists them. Commands without a profile selection then use a profile named default, or report that no key is configured.

A profile saves the key and its API address together. The address is IOTA Hub's unless you give another with --base-url:

iota-hub auth login --profile <name> --base-url <API base URL>
iota-hub submit --profile <name>

Settings use flags first, then environment variables, saved settings and defaults. A saved key stays with the address saved beside it: if --base-url or IOTA_HUB_BASE_URL differs from a profile key's address, the CLI returns invalid_config. Log in to a profile for that address, or set IOTA_HUB_API_KEY to a key for it. IOTA_HUB_API_KEY needs its own address too: with a profile that stores a non-production address, set IOTA_HUB_BASE_URL as well, or unset IOTA_HUB_API_KEY to use the profile.

--json, --profile and --base-url work before or after the subcommand. If the same option appears in both places, the value after the subcommand wins. For a non-default API address, the CLI prints Target: <base URL> on stderr. With --json, that line is held until the command returns a result.

The configuration file is stored here:

Platform Path
Linux ~/.config/iota-hub/config.toml
macOS ~/Library/Application Support/iota-hub/config.toml
Windows %LOCALAPPDATA%\iota-hub\config.toml

On Linux and macOS, setting XDG_CONFIG_HOME to an absolute path moves the file to $XDG_CONFIG_HOME/iota-hub/config.toml. Windows ignores XDG_CONFIG_HOME.

On POSIX, the file has mode 0600. On Windows, it relies on your user profile directory's permissions; the CLI does not set an ACL. There is no OS keyring integration.

Scripts and agents

Every command accepts --json. Results are one JSON document on stdout. Errors go to stderr, with stdout left empty:

{
  "code": "open_findings",
  "message": "...",
  "hint": "...",
  "details": {},
  "status": 409,
  "retry_after": null,
  "exit_code": 4
}

Check code, not the message text. Invalid arguments return usage_error with exit code 2. A submit that ends with needs_attention exits 4 with its full result on stdout, not an error. Errors after draft creation include details.observation_id so you can recover the draft. A network failure during an upload or a download returns transport_error with the file's details.slot and details.filename.

In JSON mode, progress and target messages are buffered. They are printed to stderr when a result is returned and discarded on error, leaving only the JSON error. Interactive prompts can still appear on stderr; noninteractive commands do not prompt. Destructive commands require --yes without a terminal.

Exit code Meaning
0 Success, including --draft, --dry-run and --no-wait.
1 Other errors, including server and network failures, local configuration problems (invalid_config) and existing download files (file_exists).
2 Invalid arguments or files, including ones the server rejects (validation_error), ambiguous file selection, or identity_changed.
3 Missing key or an authorization error.
4 Findings to address, missing requirements or a check timeout.
5 Rate limit still exceeded after automatic retries.
130 Interrupted with Ctrl-C outside a prompt.

An interrupted run has no result to report, so it writes no JSON error: stdout is empty and stderr holds only any buffered messages. Check for exit code 130 before parsing stderr as JSON. An interrupted submit may leave a draft without naming it; run drafts list before submitting again. A Ctrl-C in the first moments of startup kills the process by signal instead (a shell still reports 130; Python's subprocess reports -2), so treat that the same way.

submit --json includes next_commands for available actions, skipped_checks with their reasons, owc_commands for an unresolved OWC link and advisory_findings, the findings the Hub lists but does not count toward submission (such as a File names finding). Skipped checks, an unresolved link and advisory findings do not change the exit code. Its uploads is {slot: filename}; submit --dry-run --json lists uploads as [{slot, filename, path, size}] instead.

auth status exits 0 even when the key check fails. Read check in auth status --json (valid or the API's error code).

The client retries temporary API failures. Do not wrap calls in your own retry loop; see the retry rules.

Output is styled on a terminal and plain when piped, under --json or when NO_COLOR is set. Plain labels use ASCII for compatibility with Windows consoles.

Run iota-hub guide for the full offline CLI guide. SKILL.md provides instructions for agents submitting or managing observations.

Python library

Install with pip install iota-hub or uv add iota-hub:

from iota_hub import Client, resolve

# The key and address from IOTA_HUB_API_KEY and IOTA_HUB_BASE_URL, or from a
# profile saved with `iota-hub auth login`.
settings = resolve()
with Client(settings.api_key, settings.base_url) as client:
    result = client.submit_folder("path/to/observation")
    print(result.outcome, result.observation_id)

    if result.outcome == "needs_attention":
        print(result.observation.web_url)
        checks = result.observation.checks
        for finding in checks.findings if checks else []:
            print(finding.fingerprint, finding.message, finding.how_to_fix)
result.outcome Meaning
submitted The observation is submitted.
ready Ready to submit, but submit=False left it as a draft.
needs_attention Findings, missing requirements or a failed check run need attention.
draft Uploaded and finalized with wait=False; the client did not wait for checks.

result.observation.web_url links to the observation in the web app. Its status describes the observation as draft, submitted, amended or locked.

Use the same client to look up observations, replace files or download them:

# These examples assume an open client and an existing observation_id.
existing = client.check_observation(
    asteroid_id="9721",
    asteroid_name="Doty",
    star_id="123456",
    observed_date="2018-03-05",
)
client.replace_file(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", observation_id, "downloads/")

The library has methods for individual API operations, such as create_draft and list_events, and methods that combine steps, such as submit_folder, submit_files, wait_for_checks, replace_file and download_files. Responses use Pydantic models that ignore unknown fields.

API requests retry network failures, 429 and 5xx, respecting Retry-After. Workflow methods create idempotency keys and declare SHA-256 checksums for uploads. When calling individual API operations, supply their idempotency_key argument where supported. Do not add an outer retry loop.

All library errors inherit from IotaHubError, with code, message, hint, details, status and retry_after. Catch AuthError, RateLimitError, NotFoundError, ConflictError, RequestError or TransportError to handle an error category.

See the Python library guide for the full workflow and examples. It is also published at iota-hub.com/developers/library.

Environments

The default API address is https://api.iota-hub.com, the production IOTA Hub. A key from the API keys page works there without further settings.

To use another deployment, create a key on that deployment and save it in its own profile. The deployment's /developers page lists its API address:

iota-hub auth login --profile <name> --base-url <API base URL>
iota-hub observations list --profile <name>

--base-url and IOTA_HUB_BASE_URL take the API base address, with or without a trailing /public/v1; the client adds that path when it is missing. For a local API checkout, use --base-url http://localhost:8000. The package has no built-in development URL.

HTTP API and other clients

To call /public/v1 directly, use the HTTP API guide, interactive reference or Markdown guide.

For a client in another language, start with spec/openapi.json and client conventions. The OpenAPI document is copied from the deployed API and checked for changes in CI. The conventions define configuration, retries, polling, file selection, exit codes and output.

Requirements

Python 3.10 or newer on Windows, macOS or Linux. Runtime dependencies are httpx, pydantic, typer and rich, plus tomli on Python 3.10.

Versioning

The package uses semantic versioning. Removing a command or flag, or changing a --json output structure, requires a major version bump. New commands, optional flags and JSON fields are additive changes.

Contributing

Submit issues and pull requests to skycarl/iota-hub-python. You can also report API issues there, such as an incorrect status code, a missing filter or an unclear finding. The maintainer will pass them to the API project.

License

MIT. See LICENSE.

Metadata

Release files for iota-hub 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iota-hub 1.3.0
File Size Uploaded Provenance Actions
iota_hub-1.3.0.tar.gz 72.6 kB With provenance Details for iota_hub-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iota-hub 1.3.0
File Interpreter ABI Platform Actions
iota_hub-1.3.0-py3-none-any.whl Python 3 none any Details for iota_hub-1.3.0-py3-none-any.whl

Total release size: 152.9 kB

Release files / iota_hub-1.3.0.tar.gz

Download URL iota_hub-1.3.0.tar.gz
Size 72.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f649a424544f7687ab73a6e3860fc2b005c42d94cc8c2b61314f15ddde7779a4
BLAKE2b-256 checksum
How to use checksums
bb2c04c7700dda6dfa8a53b2785f6de3fb0c412e9af9c648942c05e3b7a23cb4
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 30, 2026.

Transparency log

Release files / iota_hub-1.3.0-py3-none-any.whl

Download URL iota_hub-1.3.0-py3-none-any.whl
Size 80.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
239090b8d70e334f3f0f43ad28c0477f2a9f082b6d1d0957dd6b292b2d47357b
BLAKE2b-256 checksum
How to use checksums
5e21e9c163ea62ae465f24a63a3dce7a160152c97f2d634d4441babf21ea7ab2
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 30, 2026.

Transparency log

Security for iota-hub 1.3.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.

Select from 2 files

Attestation for iota_hub-1.3.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 30, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page