API tokens
Programmatic access to Ontoshire is authenticated; human browsing is open. The client and any script that pulls a schema, shapes, or a closure needs a token — for public and private ontologies alike.
This is a signup wall, not a paywall. Pulling public schemas is free — it just isn’t anonymous, so usage can be attributed and rate-limited fairly. Browsing the website and the public SPARQL endpoint stay open to everyone.
What a token is#
- Read-only. A token can pull schemas, shapes, and closures — nothing else. It can never register repos, trigger ingestion, or touch billing.
- Prefixed and hashed. Tokens start with
ons_(so leak scanners and humans recognise them) and are stored only as a hash — Ontoshire can’t show you a token again after creation. - Revocable, optionally expiring. Revoke anytime; set an expiry when you create it.
Local development — ontogate login#
The device flow is the easiest way to get a token on your own machine. No password is typed into the CLI; you approve in a browser you’re already signed into:
- Run
ontogate login. - The CLI prints a short code and a URL. Open the URL, confirm the code matches, and click Approve.
- The CLI receives the token and writes it to
~/.ontogate/credentials(file mode0600). Done — future commands pick it up automatically.
ontogate login
$ ontogate login
To authorize this device, visit:
https://ontoshire.com/activate
and enter the code:
BCDF-GH23
Waiting for approval…
✓ Logged in. Token stored in ~/.ontogate/credentials.Only approve a code you just generated yourself. Ontoshire never sends a one-click approval link — the code confirmation is the point where you consent.
CI & automation — Settings#
For a runner or a service, mint a token in the dashboard and store it as a secret:
- Go to Settings → API Tokens.
- Give it a label (e.g.
ci-validation), optionally set an expiry, and Create. - Copy the token — it’s shown once — and store it as a CI secret.
How the client finds your token#
Resolution order, first match wins:
- The
--tokenflag. - The
ONTOGATE_API_TOKENenvironment variable. - The stored file at
~/.ontogate/credentials(written byontogate login).
examples
# explicit ontogate validate --token ons_… --schema acme/x@v1 --data d.ttl # environment (CI) export ONTOGATE_API_TOKEN=ons_… ontogate validate --schema acme/x@v1 --data d.ttl # stored (after ontogate login) — nothing to pass ontogate validate --schema acme/x@v1 --data d.ttl
Never put a token in a URL or commit it. Use the
Authorization: Bearer header (the client does this for you), environment secrets in CI, and the 0600 stored file locally.Revoking#
Delete a token anytime from Settings → API Tokens. The next pull that uses it fails with an auth error (exit code 2). Rotating is just: create a new one, update the secret, revoke the old.