Getting started

Authentication

Authenticate every request with a team API key in the Authorization header.
header
Authorization: Bearer aio_3kq…

API keys#

  • Owners and admins create keys in Team settings → API keys. The full key is shown once; only a SHA-256 hash is stored.
  • A key belongs to exactly one team. Generations it creates are charged to that team and appear in its library.
  • A key acts with the current role of the member who created it, capped at editor. If that member is downgraded to viewer the key becomes read-only; if they leave the team the key stops working.
  • Revoking a key takes effect immediately.

Keep keys server-side

CORS is open on /api/v1 so you can prototype from a browser, but a key embedded in client code can be copied and spend your credits. In production, call the API from your backend.

What a key can do#

Creator roleKey acts asRead catalog & generationsGenerate / upload / delete
owner, admin, editoreditoryesyes
viewervieweryesno, returns FORBIDDEN

Check a key#

GET/api/v1/me
Returns the team the key belongs to, the effective role and the credit balance. Useful as a health check at startup.
bash
curl https://<your-host>/api/v1/me -H "Authorization: Bearer $AIO_KEY"
200 OK
{
  "object": "account",
  "user": { "id": "a41c…", "email": "dev@example.com" },
  "team": { "id": "7e02…", "name": "Studio North", "slug": "studio-north", "plan": "pro", "is_personal": false },
  "role": "editor",
  "auth": "api_key",
  "credits": { "balance": 1840, "low": false, "low_threshold": 50, "top_up_url": "https://<your-host>/pricing" }
}

Failures#

A missing, malformed or revoked key returns 401 UNAUTHORIZED. A valid key whose role is too low for the action returns 403 FORBIDDEN. See Errors.

401
{ "error": { "code": "UNAUTHORIZED", "message": "Invalid or revoked API key." } }