Skip to content

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/v1

Scripts 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 ​

IDWhere to find it
Workspace IDThe Workspace page, above the list of workspace API keys
API IDSettings, General, or GET /workspaces/{wid}/apis
Customer IDThe 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 } }
  ]
}
StatusMeaning
400, 422The request is malformed or a field is invalid. errors says which
401The key is missing, revoked or wrong
403The key's role isn't enough for this operation
404Not found, or not in this workspace
409Conflicts with the current state, like an address that's taken
429Too 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_micro adds credit when positive and removes it when negative. 25000000 is $25.
  • note is required and shows in the customer's balance history.
  • ref makes the call idempotent. A second call with the same ref changes nothing and returns "applied": false with 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 402 until they top up.

The SDK picks up the new balance on its next snapshot, within 30 seconds.

Common tasks ​

TaskCall
List your APIsGET /workspaces/{wid}/apis
Find a customer by emailGET /apis/{id}/customers?q=dev@example.com
Suspend or reactivatePATCH /apis/{id}/customers/{customer} with {"status": "suspended"} or "active"
Put a customer on a planPATCH /apis/{id}/customers/{customer} with {"plan_id": "..."}, or "" to remove it
Set custom limitsPUT /apis/{id}/customers/{customer}/limits with rps, monthly_quota and price_per_request_micro, null to inherit
Invite a customerPOST /apis/{id}/customers/invite with {"email": "..."}
Read a customer's ledgerGET /apis/{id}/customers/{customer}/ledger
Export customersGET /apis/{id}/customers/export
Read the activity logGET /workspaces/{wid}/audit

MicroAuth is a product of Zyref, LLC.