Appearance
Platform API
Everything the dashboard does goes through the platform API, so your scripts, CI and billing system can do it too. Every operation is listed in the API reference, and the OpenAPI document is at /docs/openapi.json for code generators.
Base URL and authentication
text
https://microauth.com/api/v1Scripts authenticate with a workspace API key:
bash
curl https://microauth.com/api/v1/workspaces/$WORKSPACE_ID/apis \
-H "Authorization: Bearer mak_..."The key's role decides what it can do, the same way it does for people. A few operations, such as creating keys, connecting Stripe and changing your MicroAuth plan, always need someone signed in to the dashboard. The reference marks them as needing a dashboard session.
The SDK API is separate: it lives on api.microauth.com and uses the SDK secret key instead.
Finding IDs
| ID | Where to find it |
|---|---|
| Workspace ID | The Workspace page, above the list of workspace API keys |
| API ID | Settings, General, or GET /workspaces/{wid}/apis |
| Customer ID | The customer's page address in the dashboard, the CSV export, or GET /apis/{id}/customers?q=<email> |
Requests and errors
Requests and responses are JSON. Money is in micro-USD, and times are RFC 3339 in UTC.
Errors use application/problem+json:
json
{
"status": 422,
"title": "Unprocessable Entity",
"detail": "validation failed",
"errors": [
{ "location": "body", "message": "expected required property note to be present", "value": { "amount_micro": 25000000 } }
]
}| Status | Meaning |
|---|---|
400, 422 | The request is malformed or a field is invalid. errors says which |
401 | The key is missing, revoked or wrong |
403 | The key's role isn't enough for this operation |
404 | Not found, or not in this workspace |
409 | Conflicts with the current state, like an address that's taken |
429 | Too many requests. The limit is 20 a second per client network |
Pagination
Lists take limit, from 1 to 200 with a default of 50. When there is more, the response carries a cursor: pass next_cursor back as cursor for customers and ledgers, and next_before back as before for the activity log. An empty cursor means you reached the end.
bash
curl "https://microauth.com/api/v1/apis/$API_ID/customers?limit=200&cursor=$NEXT" \
-H "Authorization: Bearer mak_..."Credit from your own billing
When you bill customers yourself, add credit once an invoice is paid:
bash
curl -X POST "https://microauth.com/api/v1/apis/$API_ID/customers/$CUSTOMER_ID/credits" \
-H "Authorization: Bearer mak_..." \
-H "Content-Type: application/json" \
-d '{"amount_micro": 25000000, "note": "Invoice INV-1042", "ref": "INV-1042"}'json
{ "applied": true, "balance_micro": 37500000 }amount_microadds credit when positive and removes it when negative.25000000is $25.noteis required and shows in the customer's balance history.refmakes the call idempotent. A second call with the samerefchanges nothing and returns"applied": falsewith the current balance, so a retried job can't add credit twice. Use your invoice or payment ID.- Removing credit can take a balance below zero. The customer then gets
402until they top up.
The SDK picks up the new balance on its next snapshot, within 30 seconds.
Common tasks
| Task | Call |
|---|---|
| List your APIs | GET /workspaces/{wid}/apis |
| Find a customer by email | GET /apis/{id}/customers?q=dev@example.com |
| Suspend or reactivate | PATCH /apis/{id}/customers/{customer} with {"status": "suspended"} or "active" |
| Put a customer on a plan | PATCH /apis/{id}/customers/{customer} with {"plan_id": "..."}, or "" to remove it |
| Set custom limits | PUT /apis/{id}/customers/{customer}/limits with rps, monthly_quota and price_per_request_micro, null to inherit |
| Invite a customer | POST /apis/{id}/customers/invite with {"email": "..."} |
| Read a customer's ledger | GET /apis/{id}/customers/{customer}/ledger |
| Export customers | GET /apis/{id}/customers/export |
| Read the activity log | GET /workspaces/{wid}/audit |