Skip to main content

synorb

Official Python client for the Synorb REST API — source-grounded, cited context for AI agents.

pip install synorb

Zero dependencies. Everything is standard library. An agent installs this into an environment it does not control, so a client that cannot drag in a transitive supply chain or fight an existing requests/httpx pin is worth more than a few convenience methods.

Quick start

from synorb import SynorbClient, connect

# Free 72-hour demo key — no email, no card, no sales contact.
key = connect()["credentials"]["synorb_key"]

client = SynorbClient(token=key)
client.account()
client.streams(page_size=5)
client.stream_search("central bank policy")

Or read the credential from the environment:

export SYNORB_TOKEN="synorb_..."
SynorbClient().account()

Two credentials, one header

Synorb Key OAuth 2.0 access token
Lifetime Long-lived Short-lived
Scopes None — full plan access Scoped, and enforced per endpoint
Revocable Regenerate the key Yes, RFC 7009
Get one synorb.com/connect synorb.oauth

Both go in Authorization: Bearer. The client does not try to tell them apart — the server does. The Synorb Key is the default and is not deprecated; most integrations should just use it.

OAuth 2.0

Authorization code + PKCE (S256 only). Public clients, no client secret, and no dynamic client registration — client_id values are issued by Synorb.

from synorb import SynorbClient, oauth

pkce = oauth.generate_pkce()
state = oauth.generate_state()

url = oauth.build_authorize_url(
    client_id="synorb-cli",
    redirect_uri="http://127.0.0.1:8765/callback",
    code_challenge=pkce.challenge,
    scope="read:api read:mcp",     # ask for only what you need
    state=state,
)
# open `url`, sign in, catch the redirect on your loopback listener

tokens = oauth.exchange_code(
    code=code_from_redirect,
    redirect_uri="http://127.0.0.1:8765/callback",
    client_id="synorb-cli",
    code_verifier=pkce.verifier,
)
client = SynorbClient(token=tokens["access_token"])

Two things to know before building against it:

  • scope is honoured exactly. Omit it and you get the full default read-only grant. Ask for something that cannot be granted — a write: scope, or anything outside that default — and the request is refused with invalid_scope rather than quietly trimmed, so a token never claims a permission it does not hold.
  • Refresh tokens rotate, and reuse is treated as theft. Presenting a refresh token twice revokes the entire family. Store the newest one you were handed; never retry with an old one.

Discovery, if you would rather read it off the wire:

oauth.discover()   # https://api.synorb.com/.well-known/oauth-authorization-server

Errors you can actually act on

Synorb's error envelopes are actionable, so they are not collapsed into a bare HTTPError:

from synorb import SynorbAuthError, SynorbInsufficientScope, SynorbRateLimited

try:
    client.account()
except SynorbInsufficientScope as exc:
    exc.required_scope        # "read:webhooks" — the scope the token lacked
except SynorbRateLimited as exc:
    exc.retry_after           # seconds, from Retry-After
except SynorbAuthError as exc:
    exc.resource_metadata     # RFC 9728 pointer to the authorization server

SynorbInsufficientScope can only come from an OAuth token. A Synorb Key has no scope concept and is never scope-checked.

Quota

manifests_query() bills only the Manifests it returns. mode="count", "orient" and "plan" are zero-quota previews — plan first, then replay the exact body with the returned plan_token:

plan = client.manifests_query(mode="plan", stream_ids=["..."], lookback_hours=24)
rows = client.manifests_query(stream_ids=["..."], lookback_hours=24, plan_token=plan["data"]["plan_token"])

Discovery calls (streams, stream_search, ask, ontology_tags) do not consume Manifest quota.

No billing methods, on purpose

The @synorb/cli package has synorb billing checkout, which opens a hosted Stripe page for a human to complete. That is a sensible thing to type and a bad thing for a library to expose — an agent calling client.checkout() in a retry loop is a failure mode worth designing out rather than documenting around. Billing stays a deliberate, human, command-line act.

Security

Keep the credential in a server-side secret store. It never belongs in browser code, a repository, logs, or a prompt. Report issues to team@synorb.com.

MIT licensed.

Metadata

Release files for synorb 0.1.2

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

Source distribution (sdist)

Source distribution for synorb 0.1.2
File Size Uploaded
synorb-0.1.2.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synorb 0.1.2
File Interpreter ABI Platform
synorb-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.9 kB

Release files / synorb-0.1.2.tar.gz

Download URL synorb-0.1.2.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d1a2748aecf8f737f13cf10df50494eb75e2dea40a9f867dc5e3b1a3580cf135
BLAKE2b-256 checksum
How to use checksums
3ce478d4b3180b634ca2957cda7ea864a5a80911dfb2bc1d8a466e2c097da331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / synorb-0.1.2-py3-none-any.whl

Download URL synorb-0.1.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70a8c263ddb7062570456f3dec85802baebeff09e11618cbef6df954463d6e35
BLAKE2b-256 checksum
How to use checksums
6e04d87afd55f6e2203afada336e2b8a86259c2bc3a12ab1fedd254669bc2265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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