ℹ️
Base URL

All endpoints are relative to https://api.oasisomniverse.one/api (production) or http://localhost:4000/api (local ONODE).

Response Envelope

Every OASIS API response wraps its payload in a standard envelope:

json
{
  "result":    "…",          // the returned payload (object, array, or null)
  "isError":   false,       // true when a hard error occurred
  "isWarning": false,       // true for soft warnings (non-fatal)
  "message":   "Success",   // human-readable status or error message
  "detailedMessage": ""    // extended diagnostic detail (may be empty)
}

Always check isError first. A 200 OK HTTP status does not guarantee success — OASIS returns isError: true inside the envelope for business-logic failures (e.g. username already taken).

Register

POST /avatar/register

Creates a new avatar. Sends a verification email to the supplied address.

Request body

FieldTypeDescription
usernamerequiredstringUnique username (3–32 chars, alphanumeric + underscores)
emailrequiredstringUnique email address — used for login and verification
passwordrequiredstringMin 8 characters
titlestringDisplay name / avatar title
providerTypestringStorage provider override (default: configured ONODE default)
suppressVerificationEmailbooleanSkip the verification email and return verificationToken instead. Wizards always; anyone else only on a dev server with a .invalid email — see Creating many test accounts
javascript
const res = await fetch('/api/avatar/register', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    username: 'david',
    email:    'david@example.com',
    password: 's3cur3pass!',
    title:    'David'
  })
});
const { result, isError, message } = await res.json();
if (isError) throw new Error(message);

Authenticate

POST /avatar/authenticate

Authenticates an avatar by username/email + password. Returns a JWT token valid for 7 days.

Request body

FieldTypeDescription
usernamestringUsername or email (one required)
emailstringEmail or username (one required)
passwordrequiredstringAccount password

Response result

FieldTypeDescription
jwtTokenstringBearer token — include in Authorization header for all authenticated requests
idguidAvatar unique identifier
usernamestringCanonical username
emailstringVerified email address
karmaTotalnumberTotal karma score at login time
⚠️
Email verification required

Avatars with unverified email addresses will receive isError: true on authenticate until the verification link is clicked.

Multi-Factor Authentication (optional)

POST/api/avatar/authenticate-mfa

Off by default (OASIS.Security.Mfa.Enabled in OASIS_DNA.json); only avatars that enrol are asked for a second step, so existing sign-ins are unchanged. For an MFA avatar authenticate returns no tokens but result.metaData.mfaRequired and a single-use mfaChallengeToken. Send { "challengeToken", "code" } (or "recoveryCode") to authenticate-mfa to receive the normal signed-in avatar with JWT and refresh token. The same step applies to DID sign-in; gRPC refuses MFA avatars.

Self-service: GET mfa/status, POST mfa/enrol (secret and otpauth link), POST mfa/confirm (returns recovery codes once), POST mfa/disable, POST mfa/recovery-codes, GET mfa/events. Administrators (Wizard) can POST mfa/reset/{avatarId} for a lost device. Codes use a replay guard, a challenge attempt limit and a per-avatar cool-down; the secret is encrypted and never logged.

Get Avatar

GET /avatar/{id}

Returns the full avatar profile for the given ID. Requires a valid JWT in the Authorization: Bearer <token> header.

Get All Avatars

GET /avatar

Returns all avatars. Admin-only — requires an avatar with AvatarType: Admin.

Update Avatar

PUT /avatar/{id}

Updates avatar fields. Only the authenticated avatar owner or an Admin may update a profile.

Updatable fields

FieldTypeNotes
titlestringDisplay name
descriptionstringBio / about text
usernamestringUniqueness enforced — returns isError on conflict
emailstringTriggers re-verification email
imagestringURL or base64 avatar image
dobstring (ISO 8601)Date of birth

Delete Avatar

DELETE /avatar/{id}

Soft-deletes the avatar. The record is retained in storage but marked inactive. Admin-only.

Email Verification

GET /avatar/verify-email

Called automatically when the user clicks the link in their verification email. Query param: token.

POST /avatar/resend-verification-email/{email}

Re-sends the verification email. Rate-limited to 3 per hour per email address.

Creating many test accounts without email verification

Developers testing an app with lots of accounts (for example PIPER, which creates test staff for every role) can skip the verification email. This is a development-only feature with three guards, all of which must hold for a non-Wizard caller:

Otherwise suppressVerificationEmail is ignored: the real email is sent and no token is returned. Wizard callers are unaffected.

javascript
const reg = await (await fetch('/api/avatar/register', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    username: 'piper_test_slp_01',
    email:    'slp01@piper.invalid',
    password: 'a-long-test-password',
    suppressVerificationEmail: true
  })
})).json();

const token = reg.result.verificationToken;
await fetch(`/api/avatar/verify-email?token=${token}`); // now the avatar can log in

Password Reset

POST /avatar/forgot-password

Sends a password-reset email. Body: { "email": "…" }.

POST /avatar/reset-password

Resets the password using the token from the email. Body: { "token": "…", "password": "…", "confirmPassword": "…" }.