D
DreamLake

API Reference

Auth

Authentication flow via vuer-auth token exchange.


POST /auth/exchange

Exchange a vuer-auth JWT for a long-lived dreamlake JWT. Creates the user and namespace on first login.

PropertyValue
AuthNone (accepts vuer-auth token)
DB roundtrips2–4
#QueryCondition
1user.findUnique({ sub })Always
2user.create()If user doesn't exist
3namespace.findUnique({ slug })Always
4namespace.create()If namespace doesn't exist

Headers

Authorization: Bearer <vuer-auth-token>

Response 200

{
  "success": true,
  "dreamlake_token": "eyJ...",
  "user": {
    "sub": "vuer-auth-user-id",
    "email": "alice@example.com",
    "name": "Alice",
    "username": "alice",
    "id": "dreamlake-user-id",
    "isNewUser": false
  },
  "namespace": {
    "id": "namespace-id",
    "slug": "alice"
  }
}

Errors

StatusCondition
401Missing/invalid Authorization header
401vuer-auth token verification failed
400Unable to extract claims from token
500Failed to create user account
500Failed to generate token

GET /auth/me

Get the authenticated user's profile and namespace.

PropertyValue
AuthJWT
DB roundtrips4
#QueryCondition
1user.findUnique({ sub })Always (inside findOrCreateUser)
2namespace.findUnique({ slug })Always (inside findOrCreateUser)
3user.findUnique({ id })Always
4namespace.findUnique({ id })Always

Response 200

{
  "id": "user-id",
  "sub": "vuer-auth-user-id",
  "email": "alice@example.com",
  "name": "Alice",
  "username": "alice",
  "given_name": "Alice",
  "family_name": "Smith",
  "picture": "https://...",
  "email_verified": true,
  "namespace": {
    "id": "namespace-id",
    "slug": "alice"
  },
  "createdAt": "2026-04-14T00:00:00.000Z"
}

PATCH /auth/me

Update the authenticated user's profile. Only provided fields are updated.

PropertyValue
AuthJWT
DB roundtrips2
#QueryCondition
1user.findUnique({ sub })Always
2user.update({ id })Always

Body (all fields optional)

FieldTypeDescription
namestringDisplay name
usernamestringUsername
picturestringAvatar URL
metadataobjectArbitrary metadata

Response 200

{
  "id": "user-id",
  "name": "Alice Smith",
  "username": "alice",
  "picture": "https://...",
  "metadata": { "bio": "Robotics researcher" },
  "updatedAt": "2026-04-14T..."
}

Errors

StatusCondition
404User not found