Docs/SDKs & CLI/Python SDK & CLI

Python SDK & CLI

eminidatabase-sdk on PyPI ships both the official async Python client (PlatformClient) and a CLI (platform) built entirely on top of it. Same philosophy as the TypeScript SDK: every method is a thin wrapper over one API call, nothing more.

Install

pip install eminidatabase-sdk

SDK usage

import asyncio
from eminidatabase_sdk import PlatformClient

async def main():
    client = PlatformClient()  # defaults to https://api.astrabase.app/api/v1
    await client.login("[email protected]", "a-strong-password")

    org = await client.create_organization("Acme Inc.", "acme")
    project = await client.create_project(org["id"], "Shop", "shop")

    result = await client.create_database(org["id"], project["id"], "production", "eu-west")
    await client.wait_for_job(result["job_id"])

    connection = await client.get_connection(org["id"], project["id"], result["database"]["id"])
    print(connection["connection_string"])

asyncio.run(main())

Every method returns a plain dict (the raw JSON response) — there's no hand-maintained model layer to drift out of sync with the API.

Errors

Non-2xx responses raise eminidatabase_sdk.exceptions.ApiError with the real status code and detail message from the backend:

from eminidatabase_sdk.exceptions import ApiError

try:
    await client.create_database(org["id"], project["id"], "prod", "eu-west")
except ApiError as e:
    print(e.status_code, e.detail)

CLI

The platform command wraps the same client — useful for scripting or for managing resources without writing any code.

platform login --email [email protected] --password ...
platform whoami

platform organizations create "Acme Inc." acme
platform organizations list

platform projects create acme "Shop" shop
platform db create acme shop production --region eu-west --wait

platform db list acme shop
platform db connect acme shop production
platform db sql acme shop production "SELECT 1"

platform db backup create acme shop production --wait
platform db backup list acme shop production

platform webhooks create acme https://example.com/hook database.created backup.completed

Organization/project/database arguments accept a slug or a UUID — you never have to look one up by hand first. Credentials are stored in ~/.eminidatabase/credentials.json; override the target API with --api-url or the EMINIDATABASE_API_URL environment variable.

Webhook signature verification

If you're consuming Astrabase webhooks from a Python service, verify the X-Eminidatabase-Signature header like this:

import hashlib
import hmac

expected = hmac.new(secret.encode(), body_bytes, hashlib.sha256).hexdigest()
assert hmac.compare_digest(expected, received_signature.removeprefix("sha256="))

See Webhooks for the full event list and payload shape.

Source

The SDK and CLI are part of the Astrabase repository — MIT licensed.