Skip to content

Getting started

This walkthrough takes you from a fresh account to a live, metered API in about ten minutes. If any term is unfamiliar, skim Core concepts first.

1. Create your account and workspace

  1. Sign up at app.microauth.com and verify your email with the one-time code.
  2. Create your workspace (for example, "Acme APIs"). You can invite teammates later from workspace settings.

2. Create a tenant

A tenant is one API business with its own developer portal.

  1. From the workspace home, click New tenant.
  2. Pick a name and a subdomain — e.g. proweather gives your customers a portal at https://proweather.microauth.dev.
  3. Tenants start on the free plan; you can upgrade any time from the tenant's Settings tab (custom domains and higher developer limits are plan features).

3. Copy the tenant secret key

On the tenant's Overview tab you'll find the tenant secret key (mas_...). This is the credential your backend uses to talk to MicroAuth.

Keep it secret

The full key is shown once (and on rotation). Store it in your server's environment — never in client-side code or version control.

4. Configure pricing

On the tenant's Pricing tab, decide how customers pay:

  • Pay-as-you-go — set a default per-request price (in micro-USD; 1,000,000 = $1) and default RPS.
  • Subscription plans — create plans with a monthly credit grant, per-request price, RPS and optional quota. Mark plans private to show them only to assigned customers.

Optionally connect Stripe (Stripe tab) so top-ups and subscriptions are fully automated — or grant credits from your own billing via the external credits endpoint.

By default only 200 responses are billable; adjust billable status codes in tenant settings if you charge for other statuses.

5. Protect your API

If you use FastAPI, integration is two lines — see the full FastAPI SDK guide:

python
from fastapi import FastAPI, Security
from microauth_fastapi import MicroAuth, Customer

app = FastAPI()
auth = MicroAuth(app)  # reads MICROAUTH_SECRET_KEY from the environment

@app.get("/forecast")
async def forecast(customer: Customer = Security(auth)):
    return {"hello": customer.id}
bash
pip install microauth-fastapi
MICROAUTH_SECRET_KEY=mas_... uvicorn main:app

Any other language works too — the custom integration guide documents the three SDK API endpoints the FastAPI SDK is built on.

6. Make the first customer request

  1. Open your portal (https://<subdomain>.microauth.dev) and sign up as a customer would.
  2. Create an API key (map_...) on the Keys page.
  3. Top up credits or subscribe to a plan (Billing page). As the tenant owner you can also grant credits manually from the customer's detail page in the MicroAuth app.
  4. Call your API:
bash
curl https://api.yourdomain.com/forecast \
  -H "X-API-Key: map_..."

The request is authenticated, rate-limited at the customer's effective RPS, and — if the response status is billable — counted and charged against their credit balance.

7. Watch it flow

  • Tenant → Overview / Customers in the MicroAuth app: usage, balances, and the per-customer credit ledger.
  • Portal → Usage / Billing: what your customer sees.
  • Portal → Activity (admins): the tenant portal audit trail.

Where to go next

  • Brand the portal and connect a custom domain (Branding tab).
  • Automate operations with a workspace API key (mak_...) and the management API.
  • Read the FastAPI SDK guide for tuning, Redis-backed rate limiting and failure behavior.

MicroAuth is a product of Zyref, LLC.