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.
| Property | Value |
|---|---|
| Auth | None (accepts vuer-auth token) |
| DB roundtrips | 2–4 |
| # | Query | Condition |
|---|---|---|
| 1 | user.findUnique({ sub }) | Always |
| 2 | user.create() | If user doesn't exist |
| 3 | namespace.findUnique({ slug }) | Always |
| 4 | namespace.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
| Status | Condition |
|---|---|
| 401 | Missing/invalid Authorization header |
| 401 | vuer-auth token verification failed |
| 400 | Unable to extract claims from token |
| 500 | Failed to create user account |
| 500 | Failed to generate token |
GET /auth/me
Get the authenticated user's profile and namespace.
| Property | Value |
|---|---|
| Auth | JWT |
| DB roundtrips | 4 |
| # | Query | Condition |
|---|---|---|
| 1 | user.findUnique({ sub }) | Always (inside findOrCreateUser) |
| 2 | namespace.findUnique({ slug }) | Always (inside findOrCreateUser) |
| 3 | user.findUnique({ id }) | Always |
| 4 | namespace.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.
| Property | Value |
|---|---|
| Auth | JWT |
| DB roundtrips | 2 |
| # | Query | Condition |
|---|---|---|
| 1 | user.findUnique({ sub }) | Always |
| 2 | user.update({ id }) | Always |
Body (all fields optional)
| Field | Type | Description |
|---|---|---|
name | string | Display name |
username | string | Username |
picture | string | Avatar URL |
metadata | object | Arbitrary metadata |
Response 200
{
"id": "user-id",
"name": "Alice Smith",
"username": "alice",
"picture": "https://...",
"metadata": { "bio": "Robotics researcher" },
"updatedAt": "2026-04-14T..."
}Errors
| Status | Condition |
|---|---|
| 404 | User not found |