Skip to main content

atlas-backend

The official Python backend SDK for Atlas — a typed client over the sk_ Backend API (BAPI) and the psk_ Platform API. It is the Python peer of the TypeScript @atlasauth/backend SDK.

  • Covers every Backend API and Platform API operation in the public API reference.
  • Typed (py.typed): request bodies and responses are TypedDicts in atlas_backend.models, generated from the API reference.
  • Sync AtlasClient and async AsyncAtlasClient, built on httpx; the platform-key surface is AtlasPlatformClient / AsyncAtlasPlatformClient.
  • The { errors: [{ code, message, param }] } envelope surfaces as AtlasError, with every stable code on ErrorCode.
  • Cursor pagination helpers, Idempotency-Key on creates, strict request bodies.
  • Session-token, API-key and back-channel logout-token verification.

Install

pip install atlas-backend

Quick start

from atlas_backend import AtlasClient, AtlasError, paginate

atlas = AtlasClient("sk_live_...", base_url="https://api.atlasauth.net")

# Create a user (idempotency key optional, forwarded as Idempotency-Key).
user = atlas.users.create(
    {"email_address": "ada@example.com", "first_name": "Ada"},
    idempotency_key="signup-ada-001",
)
print(user["id"])

# List organizations (a single cursor page).
page = atlas.organizations.list(limit=20)
print(page["data"], page["has_more"], page["next_cursor"])

# Auto-iterate every page.
for org in paginate(atlas.organizations.list):
    print(org["name"])

# Errors carry the HTTP status and the stable BAPI error code.
try:
    atlas.users.get("user_does_not_exist")
except AtlasError as err:
    print(err.status)          # e.g. 404
    print(err.code)            # e.g. "NOT_FOUND"
    print(err.errors[0].get("param"))
    if err.has_code("NOT_FOUND"):
        ...

Context manager

with AtlasClient("sk_live_...") as atlas:
    atlas.users.list(limit=10)
# underlying httpx.Client is closed on exit

Async

import asyncio
from atlas_backend import AsyncAtlasClient, acollect

async def main() -> None:
    async with AsyncAtlasClient("sk_live_...") as atlas:
        user = await atlas.users.create({"email_address": "grace@example.com"})
        orgs = await acollect(atlas.organizations.list)
        print(user["id"], len(orgs))

asyncio.run(main())

Configuration

Argument Default Notes
secret_key — sk_...; sent as Authorization: Bearer <key>.
base_url https://api.atlasauth.net The instance's Backend API origin.
timeout 30.0 Per-request timeout, seconds.
http_client a new httpx.Client Pass your own for pooling / proxies / retries.
strict None True/False sends Atlas-Strict on every write (below).
on_unknown_fields log a warning Called with fields Atlas ignored on a write (below).

Strict request bodies

By default a write that includes a field the endpoint does not accept still succeeds; Atlas ignores the field and names it in the Atlas-Unknown-Fields response header. The SDK reports that header to you, so a typo never goes unnoticed:

def report(fields: list[str], method: str, path: str) -> None:
    print(f"Atlas ignored {fields} on {method} {path}")

atlas = AtlasClient("sk_live_...", on_unknown_fields=report)

Without a hook the SDK logs a warning on the atlas_backend logger.

To refuse unknown fields instead (422 with code UNKNOWN_FIELD, before anything changes), turn on strict mode for the whole client, or for one call:

from atlas_backend import AtlasClient, AtlasError, ErrorCode

atlas = AtlasClient("sk_live_...", strict=True)       # every write is strict

try:
    AtlasClient("sk_live_...").with_options(strict=True).users.update(
        "user_123", {"first_name": "Ada", "nickname": "ada"}
    )
except AtlasError as err:
    if err.has_code(ErrorCode.UNKNOWN_FIELD):
        print("unknown field:", err.errors[0].get("param"))

strict=False sends Atlas-Strict: false, opting a request out when your instance makes strict bodies the default. with_options(...) returns a copy that shares the connection; it works on every client class.

Platform client and Sign in with Atlas apps

A platform key (psk_...) manages the apps and instances your platform owns, and registers Sign in with Atlas apps (OpenID Connect clients on https://atlasauth.net):

from atlas_backend import AtlasPlatformClient

platform = AtlasPlatformClient("psk_live_...")

app = platform.atlas_id_apps.create(
    {
        "name": "Acme",
        "redirect_uris": ["https://acme.example/auth/callback"],
        "post_logout_redirect_uris": ["https://acme.example/"],
        "backchannel_logout_uri": "https://acme.example/auth/backchannel-logout",
        "backchannel_logout_session_required": True,
        "allowed_scopes": ["openid", "profile", "email"],
        "branding": {
            "theme": "auto",
            "accent_color": "#4f46e5",
            "privacy_policy_url": "https://acme.example/privacy",
            "copy": {"sign_in_title": "Sign in to Acme"},
            "design": {"preset": "glass"},
        },
    },
    idempotency_key="acme-siwa-app",
)
print(app["client_id"], app.get("client_secret"))   # the secret is shown once

apps = platform.atlas_id_apps.list()
print(apps["issuer"], apps["discovery_url"])

platform.atlas_id_apps.update(app["id"], {"branding": {"copy": {"sign_in_title": None}}})
platform.atlas_id_apps.rotate_secret(app["id"])
preview = platform.atlas_id_apps.preview_design({"design": {"preset": "midnight"}})

with open("logo.png", "rb") as f:
    asset = platform.design_assets.upload(f.read(), kind="logo")

Other namespaces: apps (create, list, archive, transfer, instances, secret rotation), accountless_apps, design_assets.

Setup check (preflight)

report = atlas.instance.preflight()
for finding in report["findings"]:      # errors first, then warnings, then info
    print(finding["severity"], finding["code"], finding["message"], "->", finding["fix"])

Design

The sign-in page design is typed end to end (models.AtlasDesign for a full design, models.AtlasDesignPatch for a partial update where None removes a setting):

atlas.design.update({"design": {"preset": "forest", "palette": {"primary": "#0f766e"}}})
atlas.design.replace({"design": {"version": 1, "preset": "atlas", "colorScheme": "auto"}})
preview = atlas.design.preview({"design": {"preset": "bold"}})
catalog = atlas.design.catalog()           # presets, fonts, CSS variables

# Per-organization overrides
atlas.organizations.design.update("org_123", {"design": {"palette": {"accent": "#f59e0b"}}})

# Images: send the raw bytes; the type is detected (PNG, JPEG, GIF, WebP)
with open("background.jpg", "rb") as f:
    asset = atlas.design.assets.upload(f.read(), kind="background")
atlas.design.update({"design": {"background": {"image": {"assetId": asset["asset_id"]}}}})
atlas.instance.cookie_consent.set(
    {
        "script_url": "https://cmp.example/consent.js",
        "site_id": "site_123",
        # Optional "cookie settings" link that reopens the CMP preferences
        "settings_link": {"label": "Cookie settings", "preset": "cookiebot"},
    }
)
print(atlas.instance.cookie_consent.get()["enabled"])
atlas.instance.cookie_consent.delete()

A settings link needs a preset ("cookiemunch", "cookiebot", "onetrust" or "custom") or at least one entry in attributes (data-*, aria-*, id, class, href). None removes the link. The response's settings_link.rendered_attributes are the attributes the rendered link carries: yours plus the preset's trigger.

Messaging providers

Each transport has its own typed config (models.EmailProviderConfig, models.SmsProviderConfig):

atlas.messaging_providers.set_email(
    {
        "transport": "smtp",
        "from_address": "Acme <no-reply@acme.example>",
        "config": {"host": "smtp.acme.example", "port": 587, "username": "u", "password": "p"},
    }
)
atlas.messaging_providers.set_sms(
    {"transport": "twilio", "config": {"account_sid": "AC...", "auth_token": "..."}}
)
atlas.messaging_providers.test("email", {"to": "ops@acme.example"})

Removing the email provider while email-dependent features are on (and nothing else would deliver email) raises a 409 EMAIL_PROVIDER_IN_USE; the error's meta["features"] lists them. Pass force=True to remove it anyway:

atlas.messaging_providers.delete("email", force=True)

Social and wallet sign-in providers

configured = atlas.oauth_providers.list(provider=["google", "github"], configured=True)

# Re-brand a button without touching credentials; None clears an override
atlas.oauth_providers.upsert("google", {"display_name": "Google Workspace", "icon_url": None})

# Wallet providers take verifier settings instead of credentials
atlas.oauth_providers.upsert(
    "siwe", {"settings": {"domain": "app.acme.example", "chain_ids": [1, 10]}}
)
atlas.oauth_providers.set_enabled("siwe", {"enabled": True})

Webhooks

ep = atlas.webhooks.endpoints
created = ep.create({"url": "https://acme.example/hooks", "enabled_events": ["user.created"]})
ep.update(created["id"], {"active": False})
ep.reveal_secret(created["id"])
ep.rotate_secret(created["id"])
ep.test(created["id"])
for delivery in ep.list_deliveries(created["id"], limit=20)["data"]:
    ep.redeliver(created["id"], delivery["id"])

verify_webhook accepts an atlas-signature header that carries several signatures separated by spaces (v1,<sig> v1,<sig>). While an endpoint secret rotates, Atlas may sign each delivery with the old and the new secret; the delivery verifies when any one signature matches.

By default a rotation stops the old secret at once. Pass overlap_seconds (at most 7 days) to keep it signing each delivery next to the new one while you deploy the new secret. Choose an overlap only once every receiver verifies with a verifier that accepts several signatures.

rotated = ep.rotate_secret(created["id"], {"overlap_seconds": 3600})
rotated["previous_secret_expires_at"]  # epoch ms, or None when the old secret already stopped

Policy acceptance

Terms of Service, privacy policies and any other policy your users accept at sign-up (and again at sign-in when a new version takes effect). A version goes draft, published (with an effective_at), retired; each acceptance is kept as evidence.

atlas.policies.create({"key": "tos", "title": "Terms of Service", "applies_to": "sign_in_and_sign_up",
                       "reaccept": "grace", "grace_days": 14})
atlas.policies.versions.create("tos", {"version": "2026-10-24", "content_markdown": "# Terms\n..."})
atlas.policies.versions.publish("tos", "2026-10-24", {"effective_at": "2026-11-01T00:00:00Z"})
atlas.policies.list_acceptances("tos", version="2026-10-24", limit=50)
csv_text = atlas.policies.export_acceptances_csv("tos")
atlas.policies.for_user("user_123")            # standing on every policy, incl. needs_acceptance
atlas.policies.settings.update({"session_claim": True})   # put `pol` on session tokens

With the session claim on, SessionClaims.policies / accepted_policy_version("tos") read the pol claim. The user.policy_accepted and policy.version_published webhook events have the constants WEBHOOK_EVENT_USER_POLICY_ACCEPTED and WEBHOOK_EVENT_POLICY_VERSION_PUBLISHED.

Serving policies from your own system (policy source)

Point Atlas at a CMS or service with atlas.policy_source.update({"enabled": True, "endpoint_url": ..., "signing_secret": ...}) (the secret is write-only), then test() / sync(). In your service, verify Atlas's signed GET {endpoint}/policies[?key=...] and answer a feed:

from atlas_backend import verify_policy_feed_request, sign_policy_source_event

v = verify_policy_feed_request(request.method, request.full_path, request.headers, secret)
if not v.verified:
    abort(401)
feed = {"object": "policy_list", "policies": build_policies(only=v.key)}

# When a policy changes, tell Atlas (it re-fetches; nothing in the event is trusted as content):
signed = sign_policy_source_event({"type": "policy.published", "key": "tos", "version": "2026-10-24"}, secret)
httpx.post(webhook_url, content=signed.body, headers={"content-type": "application/json", **signed.headers})

OAuth client secret rotation

The previous secret keeps working for overlap_seconds (default 24 hours, at most 7 days), so you can deploy the new one without downtime. Pass 0 to revoke it now, for example after a leak.

rotated = atlas.oauth_clients.rotate_secret(client_id, {"overlap_seconds": 3600})
rotated["client_secret"]               # shown once
rotated["previous_secret_expires_at"]  # epoch ms, or None when the old secret already stopped

Trusted reverse proxy

If a reverse proxy serves the Frontend API from your own origin, give it a proxy secret. It sends the secret in X-Atlas-Proxy-Secret and the browser's IP in X-Atlas-Client-IP; Atlas then uses that IP for rate limits, lockout, risk signals and audit logs.

created = atlas.instance.create_proxy_secret()
created["secret"]                      # shown once; store it in your proxy's environment
atlas.instance.get_proxy_secret()      # set, created_at, previous_expires_at (never the secret)
atlas.instance.create_proxy_secret({"overlap_seconds": 3600})  # rotate; the old one works 1 hour
atlas.instance.delete_proxy_secret()

Rotation overlaps on the platform

platform.apps.rotate_instance_secret(app_id, instance_id, {"overlap_seconds": 0})  # default 72 hours
platform.atlas_id_apps.rotate_secret(app["id"], {"overlap_seconds": 3600})        # default 24 hours
platform.atlas_id_apps.rotate_webhook_secret(app["id"], {"overlap_seconds": 3600}) # default 0

Development email

A development instance can send Atlas's sign-in emails through your own provider without a verified domain. Subjects start with [Atlas test] and sends are capped.

dev = atlas.messaging_providers.development_email
dev.enable({"provider_id": "mp_123"})  # or {"transport": "resend", "config": {"api_key": "re_..."}}
dev.get()
dev.disable()  # back to standard mode; the provider stays

API key spend caps

Give an end-user API key caps per unit and period ("request", "day", "month" or "total"), then meter what each call costs. A debit that would exceed a cap records nothing and comes back with allowed: False; it is not raised as an error.

key = atlas.api_keys.create({
    "subject_type": "user",
    "subject_id": "user_123",
    "limits": [
        {"unit": "requests", "amount": 1000, "period": "day"},
        {"unit": "usd_cents", "amount": 5000, "period": "month"},
    ],
})

debit = atlas.api_keys.record_usage(
    key["id"],
    {"unit": "usd_cents", "amount": 12, "idempotency_key": "req_8f2c"},  # retries count once
)
if not debit["allowed"]:
    ...  # debit["code"] == "LIMIT_EXCEEDED"; debit["exceeded"] lists the caps

print(atlas.api_keys.get_usage(key["id"])["usage"])  # used / remaining / resets_at per cap
atlas.api_keys.update(key["id"], {"limits": None})  # remove the caps

api_keys.verify(...) also returns the key's name, scopes, constraints, limits and current usage.

Session keep-alive

If your app loads the Atlas frontend SDK only on some pages, time spent on the other pages can count as inactivity. Touch the session from your backend to slide its inactivity window:

s = atlas.sessions.touch(session_id)
# s["idle_expires_at"] is the new deadline; s["extended"] is False when a touch in the last minute already did it

A touch never extends past the session's absolute expiry and never revives an ended session (409 SESSION_REVOKED, SESSION_IDLE_EXPIRED or SESSION_EXPIRED). It writes at most once a minute, so calling it on every request is safe.

Every session read (sessions.get, sessions.list, users.list_sessions) carries idle_expires_at (the same value as abandon_at), last_active_organization_id and impersonated_by.

Skipping the logout confirmation

A first-party OAuth client can set skip_logout_confirmation=True on oauth_clients.create / update. Sign-out through /oauth2/logout with that client_id and an exactly registered post_logout_redirect_uri then ends the session and redirects straight back with state, without the confirmation page. A third-party client is refused with 422 VALIDATION_FAILED.

atlas.oauth_clients.update(client_id, {"skip_logout_confirmation": True})

Acknowledging preflight findings

A warning or info finding you know about and accept can be acknowledged with a reason (and an optional expiry). instance.preflight() still lists it, with acknowledged; count only the findings without it. Errors are never acknowledged (422).

atlas.instance.acknowledge_preflight("webhook_endpoint_off_origin", {"reason": "Receiver runs on our ops host"})
todo = [f for f in atlas.instance.preflight()["findings"] if "acknowledged" not in f]
atlas.instance.delete_preflight_ack("webhook_endpoint_off_origin")

Fetching a generated client secret once more

A create or rotate that generated the secret answers client_secret_reveal (path, expires_at): within 10 minutes, oauth_clients.reveal_secret(client_id) returns it a single time. Or send your own client_secret (32-256 random printable characters) on create. require_verified_email=True issues no authorization code for a user whose primary email is not verified.

secret = atlas.oauth_clients.reveal_secret(client_id)["client_secret"]

Signing a user out of your app and Atlas

oauth_clients.logout(client_id, sid) ends the user's Atlas session from your backend (the sid is the id_token's sid): it revokes this client's grants under that sid, ends the session and queues a back-channel logout to every other app signed in through it. No browser redirect to /oauth2/logout is needed. Needs oauth_clients:write and sessions:write.

out = atlas.oauth_clients.logout(client_id, id_token_claims["sid"])
print(out["session"], out["grants_revoked"], out["backchannel_logouts"])  # "revoked" | "already_ended"

A first-party client with refresh_touches_session=True keeps the Atlas session alive on every refresh, and its refresh fails (invalid_grant) once that session has ended. add_redirect_origins=True on create / update also adds the redirect URIs' origins to the instance's allowed_origins; the response lists them in added_origins.

Entitlements and organization policy

atlas.entitlement_overrides.create(
    {"subject_type": "org", "subject_id": "org_123", "limits": {"seats": -1}}  # -1 = unlimited
)
print(atlas.organizations.get_entitlements("org_123"))

# Policy keys are camelCase; None clears an override
atlas.organizations.update_policy(
    "org_123",
    {"requireMfa": True, "allowedSignInMethods": ["password", "oauth:google"], "ipAllowlist": None},
)

Domain moves, logout fan-out and managed email

# Move every URL from the old origin to the new one. dry_run first shows the diff.
preview = atlas.instance.move_origin({"from": "https://old.example.com", "to": "https://example.com", "dry_run": True})
for change in preview["changes"]:
    print(change["object"], change["field"], change["before"], "->", change["after"])

# Send the same logout_token your OIDC apps get to another service.
atlas.logout_notify_endpoints.create({"url": "https://api.example.com/atlas/logout"})

# Send email from your own domain through Atlas, then publish the returned DNS records.
managed = atlas.messaging_providers.managed_email.create({"from_address": "Acme <no-reply@example.com>"})
print(managed["records"])

On the platform client, atlas_id_apps.find_users(app_id, email) answers a privacy request for one app, atlas_id_apps.revoke_grant(app_id, grant_id) revokes one person's approval, and atlas_id_publisher claims and verifies the publisher name shown on consent screens.

Referral attribution

With referral attribution on, Atlas reports every interactive sign-up to your referral platform before user.created is sent. The user gains referral (where attribution stands and, once attributed, who referred them; None when the user was never reported), referral_code and referral_link. referral["status"] is pending, attributed, none, failed, held or flagged; the platform's own status is referral["referral_status"].

atlas.instance.referrals.update({
    "enabled": True,
    "provider": "webhook",  # the Atlas referral protocol; or "referalli" (the former "referally" is accepted) or another built-in adapter
    "endpoint_url": "https://referrals.example.com/atlas",
    "signing_secret": os.environ["REFERRAL_SIGNING_SECRET"],
    "auto_enroll_users": True,
    "security": {"on_high_risk": "hold"},
})
print(atlas.instance.referrals.test())            # {"ok": True, "http_status": 404, ...}
failed = atlas.instance.referrals.list_calls(status="failed", limit=20)
atlas.instance.referrals.retry_call(failed["data"][0]["id"])

atlas.users.update("user_123", {"referral_code": "ada-1"})   # 409 REFERRAL_CODE_TAKEN if held
atlas.users.flag_referral("user_123", reason="self-referral")

More tools for the connection:

referrals = atlas.instance.referrals
referrals.update({"forward_lifecycle": True, "include_referral_claims": True,
                  "signup_code_field": True})
referrals.simulate(code="ACME10")             # a sign-up call for a made-up user; nothing is stored
referrals.retry_failed(error_code="signature_rejected")   # after pasting the new secret
page = referrals.list_calls(limit=1000, error_code="timeout")
while page["has_more"]:
    page = referrals.list_calls(limit=1000, starting_after=page["data"][-1]["id"])
job = referrals.backfill({"since": "2026-01-01", "code_metadata_path": "public_metadata.referral_code"})
referrals.get_backfill(job["id"])             # running, then completed
referrals.get_for_user("user_123")            # the stored result, no call to the platform

atlas.users.set_external_id("user_123", "cust_42")   # forwarded to the platform as an alias

To give each user your own id before the first referral call, turn on the before_user_create hook. Atlas then sends your endpoint a signed POST (verify it with verify_webhook) of type user.before_create for every self-service sign-up, and stamps the external_id and metadata you answer:

atlas.instance.hooks.update_before_user_create({
    "enabled": True,
    "url": "https://app.example.com/hooks/before-create",
    "signing_secret": os.environ["BEFORE_CREATE_SECRET"],
})
atlas.instance.hooks.test_before_user_create()   # {"ok": True, "answer": {...}}

Enabling without what the provider needs is 422 REFERRALS_NOT_CONFIGURED. When the platform has not answered by the time user.created is sent, referral["status"] is pending and the user.referral_resolved webhook follows with the final user (attributed, none or failed). user.referral_attributed (UserReferralAttributedEvent) still fires for a late attribution.

A referral platform that implements the Atlas referral protocol verifies Atlas's calls with verify_referral_request. Every call is a POST signed like a webhook, and its JSON body says which operation it is (op: signup, erase, export, partner, signal, alias, user, ping). Pass the path the call arrived on: a signed body whose op does not match the endpoint is refused (op_mismatch).

from atlas_backend import verify_referral_request

result = verify_referral_request(raw_body, headers, secret, path=request.path)
if not result.verified:
    return 401
if result.op == "signup":
    return {"referral": match(result.payload), "partner": None}
if result.op == "export":
    return 404 if result.test else export_for(result.customer_ref)
if result.op == "alias":       # the user's external_id changed: re-key the customer
    rekey(result.payload["fromCustomerRef"], result.payload["toCustomerRef"])
if result.op == "ping":
    return {"ok": True, "serverTime": datetime.now(timezone.utc).isoformat()}

result.protocol_version is the Atlas-Referrals-Version header (2026-10-21).

A retry of one call keeps its delivery_id; sign-ups are idempotent on customerRef, so answer a retry the same way.

Browser capture: browser_sources lists the referral programs whose script or cookie the browser reads (None on update goes back to the provider's default, reported by browser_sources_default), and consent_provider picks the consent manager that decides (auto, one manager, or app).

Two-way sync

A provider with the inbound capability can send referral changes made after sign-up back to Atlas. The settings report inbound (url to give the platform, secret_set, endpoint_id and last_event with at, type, outcome). Store the platform's event secret with inbound_secret (write-only, 16-512 characters) and its subscription id with inbound_endpoint_id; None clears.

A platform on the Atlas referral protocol sends a referral.updated event to inbound.url, signed like an Atlas webhook with the inbound secret (or the connection's signing secret when none is set):

from atlas_backend import sign_referral_updated_event

event = sign_referral_updated_event(
    inbound_url, secret, {"customerRef": "user_123", "referralId": "ref_1", "status": "qualified"}
)
httpx.post(event.url, content=event.body, headers=event.headers)

Back-channel logout

When a user signs out of Atlas, Atlas POSTs a signed logout_token to your app's backchannel_logout_uri. Verify it, end the matching local sessions, and answer 200:

from atlas_backend import LogoutTokenVerifier, VerificationError, logout_token_from_form

verifier = LogoutTokenVerifier(
    issuer="https://atlasauth.net",        # the issuer in your id_tokens
    client_id="your_client_id",
)

def backchannel_logout(raw_body: bytes) -> tuple[int, dict[str, str]]:
    """Framework-agnostic handler: returns (status, headers)."""
    headers = {"Cache-Control": "no-store"}
    try:
        claims = verifier.verify(logout_token_from_form(raw_body))
    except VerificationError:
        return 400, headers
    if claims.sid:
        sessions.delete_by_atlas_sid(claims.sid)       # your session store
    else:
        sessions.delete_all_for_user(claims.sub)       # "sign out everywhere"
    return 200, headers

The verifier checks the RS256 signature against the issuer's keys (cached, with a throttled refetch), iss, that aud contains your client id, iat (not in the future), exp when present, jti, the back-channel logout event, that sid or sub is present, that there is no nonce, and typ: logout+jwt.

Replay protection. Pass jti_seen= a callable that records each jti and returns True when it has seen it before (the token is then refused with reason "replayed"). Keep entries a few minutes — logout tokens live two. With several app servers, back it with a shared store such as Redis (SET jti 1 NX EX 300).

Application webhooks, browser tickets and instance settings (0.21)

Send your app's own events to endpoints your customers (organizations) register. Atlas signs each delivery the Standard Webhooks way, retries, tracks health and keeps the delivery log.

atlas.app_events.types.create({"type": "call.completed", "description": "A call finished."})
ep = atlas.app_events.endpoints.create("org_1", {"url": "https://hooks.acme.example/atlas"})
print(ep["secret"])  # whsec_..., in this response only (or endpoints.reveal_secret)

sent = atlas.app_events.publish(
    {"organization_id": "org_1", "type": "call.completed", "data": {"call_id": "c1"}},
    idempotency_key="c1",  # a repeat returns the first event with idempotent_replay=True
)
atlas.app_events.endpoints.app_event_types("org_1")  # what the endpoint picker offers

The receiving side verifies with verify_standard_webhook (webhook-id, webhook-timestamp in seconds, webhook-signature as a space-separated v1,<base64> list):

from atlas_backend import verify_standard_webhook

result = verify_standard_webhook(request.body, request.headers, "whsec_...")
if not result.verified:
    return 400  # result.reason: missing_headers, malformed_signature, stale_timestamp, signature_mismatch

Browser tickets. sessions.create_browser_ticket(user_id, redirect_url=, expires_in_seconds=) mints a one-time ticket that signs a browser in as the user and, with redirect_url, a ready url to open. It replaces sign_in_tokens.create (deprecated, sunset 2027-04-01). The ticket exchange's 10-second same-client replay allowance applies to development instances only. On development instances, testing.create_sign_in_url(user_id, redirect_url=) does the same for end-to-end tests.

Instance settings. instance.sign_in_with_atlas and instance.hosted_pages (get, update); privacy.integration (get, connect) wires a consent manager, orchestrator, completion webhook and executor key in one idempotent call. instance.update and instance.referrals.update results may carry warnings.

Test and review accounts (0.20)

Make logins for app-store reviewers, CI and demos that are confined to one Sign in with Atlas app. Needs the platform:atlas_id_apps:provision scope (or the per-app atlas_id_apps:<app id>:provision scope) on the platform key.

acct = platform.atlas_id_apps.provisioned_accounts.create(
    app["id"], {"email": "review@acme.example", "label": "app-store reviewer"}
)
print(acct["password"])  # shown once; pass secret_recipient=... to get sealed_password

platform.domains.claim("acme.example")   # publish the TXT record, then:
platform.domains.check(domain_id)
platform.atlas_id_apps.update(app["id"], {"test_mode": True})

Errors: TEST_ACCOUNT_RESTRICTED, PROVISIONED_ACCOUNT_LIMIT_REACHED, DOMAIN_NOT_VERIFIED on ErrorCode.

Partner platforms and per-call audiences (0.19)

from atlas_backend import AtlasClient

atlas = AtlasClient("atlas_live_sk_...")

# This instance as a partner platform: what to send the partner, then the token it hands back.
reg = atlas.partner_platforms.registration("acme-consent")
atlas.partner_platforms.store_token("acme-consent", partner_token)  # write-only, never returned
atlas.partner_platforms.deliveries("acme-consent", limit=20)

# A per-call audience on the integration token mint.
atlas.sessions.get_token(session_id, "acme", audience_params={"tenant": "t1"})
atlas.sessions.get_token(session_id, "acme", audience="acme:t1")

partner_platforms (list, get, set, delete, registration, store_token, deliveries) is typed (PartnerPlatform, PartnerPlatformRegistration, PartnerDelivery). The partner token is write-only: no response, model or error carries it. users.list(include_deleted=True) also returns soft-deleted users. The privacy orchestrator takes site_id, partner_link_id and cancel_deletion_on_sign_in.

Integrator platform (0.17)

from atlas_backend import AtlasClient, KeyFormat, Traceparent

atlas = AtlasClient("atlas_live_sk_...", traceparent=Traceparent.generate())
atlas.whoami.get()                                  # kind, scopes, expiry, owner
KeyFormat.is_secret_key("atlas_live_sk_abc")        # True; "sk_live_abc" too
  • Keys. secret_keys (create / list / get / update / rotate / revoke; owner, expires_at (default one year, never longer), allowed_origins (browser-origin lock, refused with ORIGIN_NOT_ALLOWED), external_ref, metadata, secret_recipient for a sealed secret you open with SealedBox), keys.list, keys.revoke_leaked, platform.keys, platform.whoami. KeyFormat accepts atlas_<env>_<kind>_... and the legacy sk_ / pk_ / psk_ / whsec_.
  • Partner links, no pasted key. A partner calls request_partner_link(...); you list partner_links.requests.list(direction="inbound") and approve(id) / deny(id); Atlas delivers the credentials to the partner's callback, which checks them with verify_partner_link_delivery. partner_links.outbound.request(partner, {...}) asks a partner for a link; partner_links.set_certificates(id, [...]) locks one to client certificates (mTLS).
  • Dry run, trace, idempotency. dry_run=True on the provisioning calls, external_ref and metadata in bodies, idempotency_key= on writes, a traceparent on the client (or atlas.with_options(traceparent=...)).
  • Webhooks. Endpoint get, put_by_url, test(wait=...), redeliver_window, replay (since="failing_since" replays from the start of the last failure streak; endpoints report last_failing_since after they recover), delivery filters and cursors, webhooks.egress_ips(), delivery_health. verify_webhook(..., url=, require_v2=) checks URL-bound v2 signatures. canonical_webhook_event(name) maps the deprecated spellings.
  • Privacy executor. privacy (discover, lookup, requests), verify_privacy_case_request, verify_privacy_completion, valid_privacy_idempotency_key.
  • Integrations. integrations and sessions.get_token(session_id, for_="referalli"); atlas_id_integration_token(frontend_api, publishable_key, "referalli", access_token) is the browser route (POST /v1/client/integrations/{id}/atlas_id_tokens) for Sign in with Atlas users.
  • OIDC relying parties. oidc_organization_of(claims) (org_id / org_slug / org_role / org_permissions), oidc_organizations_of(claims) (orgs, from the organizations scope), oidc_sso_of(claims) (sso_connection_id / sso_tenant_id / sso_issuer / sso_domain) and oidc_authorize_url_with_organization(url, "acme").
  • Also. status, notices, security_advisories, audit_exports, sub_processors, entitlements, integration_health, embed, openapi.diff, instance.unknown_fields_report, instance.preflight(min_severity=...), users.list(updated_after=...), events.list(since=...), BackchannelLogoutApp (WSGI) and handle_backchannel_logout, OperatorLogin (device flow, token exchange), errors with did_you_mean, is_insufficient_scope, is_step_up_required.

Sealed secrets need PyNaCl: pip install "atlas-backend[sealed]".

Namespaces

AtlasClient / AsyncAtlasClient:

users (+ identities, phone_numbers, consents, deletion, directives, approval_requests, grants, erasure, notification_preferences), sessions, organizations (+ memberships, invitations, domains, group_roles, audit_streams, branding, design, settings, end_users, reader_domain), roles, permissions, oauth_clients (+ grants), oauth_providers, resource_servers, sso_connections, sso_onboarding, scim_tokens, scim_provisioning_targets, org_ldap_connections, domains, redirect_urls, email_addresses, waitlist, allowlist, blocklist, invitations, attack_protection, actor_tokens, sign_in_tokens, api_keys, tokens, m2m_tokens, machines, machine_enrolment_tokens, tickets, grants, session_exchange_apps, instance (+ cookie_consent, security, sign_in_with_atlas, hosted_pages), design (+ assets), branding, localizations, email_templates, sms_templates, messaging_providers, notifications (+ categories, templates), webhooks (+ endpoints), log_streams, audit_logs, audit_events, config_changelog, events, usage, jobs, user_imports, user_exports, data_subject_requests, entitlement_overrides, organization_settings_schema, billing (+ plans, subscriptions), actions, policies (+ versions, settings), policy_source, connectors, directory, fga (+ stores, authorization_models), openfga (+ stores, authorization_models), jwt_templates, legacy_auth_connection, network_acls, radius_clients, lti_platforms, rate_limit_policy, risk_based_mfa (+ list_events, event_metrics, event_feedback, fraud_lookup), bot_labels, bot_signals, captcha, managed_waf, diagnostics, mcp, mcp_connector, pca, testing, whoami, secret_keys, keys, partner_links (+ requests, outbound), partner_platforms, atlas_id_grants, privacy (+ orchestrator, integration), app_events (+ types, endpoints), integrations, status, notices, security_advisories, audit_exports, sub_processors, entitlements, integration_health, embed, openapi, delivery_health, meta.

AtlasPlatformClient / AsyncAtlasPlatformClient: apps, accountless_apps, atlas_id_apps, design_assets, whoami, keys, audit (+ streams).

Pagination

paginate(list_fn, **params) and collect(list_fn, **params) walk every cursor page of any list that returns { data, has_more, next_cursor }. Async peers: aiterate / acollect.

Errors

Every non-2xx raises AtlasError, carrying:

  • status — the HTTP status code.
  • errors — the full [{ code, message, param?, meta? }] envelope.
  • code — the first error's stable code (what you branch on).
  • has_code(code) — True if any error in the envelope has that code.

ErrorCode lists the stable codes, for example ErrorCode.UNKNOWN_FIELD, ErrorCode.INVALID_KEY, ErrorCode.WRONG_KEY_SURFACE (a valid key used on the wrong API, e.g. a platform key on an instance route), ErrorCode.PLAN_IN_USE, ErrorCode.EMAIL_DELIVERY_NOT_CONFIGURED, ErrorCode.EMAIL_PROVIDER_REQUIRED and ErrorCode.EMAIL_PROVIDER_IN_USE.

Development

pip install -e ".[dev]"
ruff check .
mypy
pytest

The async namespaces are generated from the sync ones. After editing atlas_backend/resources.py, run:

python scripts/gen_async.py && ruff format atlas_backend/aresources.py

tests/test_parity.py fails if the two drift, and tests/test_coverage.py checks every operation in tests/openapi_operations.txt has a method.

Every operation, typed (0.25)

All Backend API and Platform API operations are methods. Shapes are TypedDicts in atlas_backend.catalog_models; a list that pages has an iter_ twin:

for bundle in atlas.iga.iter_list_bundles():
    ...
atlas.billing.delete_coupon("coupon_1", idempotency_key="k-1")
atlas.iga.create_bundle({...}, dry_run=True)   # preview

Sign-in for your own server (relying party)

from atlas_backend import RelyingParty
from atlas_backend.fastapi.rp import rp_router     # or atlas_backend.flask.rp.register_rp / atlas_backend.django.rp.rp_urlpatterns

rp = RelyingParty(
    issuer="https://id.example.com", client_id="...", client_secret="...",
    redirect_uri="https://app.example.com/auth/callback", secret=SESSION_SECRET,   # 32+ chars
    on_signed_in=lambda user, tokens, request, result: create_session(user, result.response),
)
app.include_router(rp_router(rp))   # GET /auth/sign-in, GET /auth/callback, POST /auth/sign-out

rp.require_recent_auth(request, 300, sub=..., auth_time=...) answers a re-authentication redirect or None; rp.touch_if_due(sid, last) keeps the session alive; rp.bind_session(sid, app_session_id, expires_at) plus on_backchannel_logout ends your sessions when Atlas signs the user out. authenticated_within(claims, 300), used_multi_factor(claims) and mfa_satisfied(claims) read a verified token's claims.

Checks that need no network call

KeyMirror (end-user API keys), ResourceRoleMirror (can(subject, permission, resource)), SidRevocationList, verify_and_dedupe(body, headers, secret, store), verify_transaction_token(...), WebBotAuthVerifier(...) and MachineClient (enrol, mint, DPoP) keep the request path local; call sync() on a timer. CliLogin signs a command-line tool in through the browser (loopback or device code).

Retries, tracing and the doctor

from atlas_backend import AtlasClient, RetryPolicy, Telemetry
atlas = AtlasClient("sk_live_...", retry=RetryPolicy(max_retries=3, status_aware=True), telemetry=Telemetry())

retry honours Retry-After and never replays a write without idempotency_key; telemetry needs pip install 'atlas-backend[otel]' and is off by default. python -m atlas_backend doctor checks the key, clock skew, reachability, the JWKS and the status endpoint (ATLAS_SECRET_KEY, ATLAS_API_URL, ATLAS_JWKS_URL, ATLAS_ISSUER).

Metadata

Release files for atlas-backend 0.25.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 atlas-backend 0.25.0
File Size Uploaded Provenance Actions
atlas_backend-0.25.0.tar.gz 1.6 MB Without provenance Details for atlas_backend-0.25.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for atlas-backend 0.25.0
File Interpreter ABI Platform Actions
atlas_backend-0.25.0-py3-none-any.whl Python 3 none any Details for atlas_backend-0.25.0-py3-none-any.whl

Total release size: 2.5 MB

Release files / atlas_backend-0.25.0.tar.gz

Download URL atlas_backend-0.25.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
86105c0efd7270870e95e090ab8f8b755b6361093a84b2cbf88c1fb3ebabf209
BLAKE2b-256 checksum
How to use checksums
1006e82d652d513d89843e7ca74624da3109e9e56f18a3d0fb4e1dee4b5779f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / atlas_backend-0.25.0-py3-none-any.whl

Download URL atlas_backend-0.25.0-py3-none-any.whl
Size 914.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
449d2be6110c64725301671b2e7d08a0c52af041e22ebbc5b0e245d2cedd3f50
BLAKE2b-256 checksum
How to use checksums
ec05db462f4c7d89712ec14adf57c0cf90b009ab4aff152b75057ca7db65a108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for atlas-backend 0.25.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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