Skip to content

Authentication

Every authenticated request sends a token in the Authorization header:

Authorization: Bearer <access token or API key>

<base> below is https://virvi.io for hosted Virvi, or your server’s PUBLIC_URL.

API keys

Use an API key for anything that isn’t a person in a browser.

Create one in the dashboard under Settings → API keys, or with the API while signed in with an account (not with another key):

POST <base>/api/keys
Authorization: Bearer <access token>
Content-Type: application/json
{ "name": "my script", "expiresAt": "2027-01-01T00:00:00Z" }
FieldRequiredMeaning
nameYesA label for the key
expiresAtNoISO date. After it, the key returns 401. No date: the key doesn’t expire
orgIdNoAn organization you belong to. Default: your active organization

The response (201) holds the key once:

{ "id": "…", "name": "my script", "key": "virvi_k1_…", "keyPrefix": "virvi_k1", "expiresAt": "2027-01-01T00:00:00.000Z", "createdAt": "…" }

Only a hash is stored. Copy key now; it can’t be shown again.

Use it like a token: Authorization: Bearer virvi_k1_….

What it can do: everything its account can, and no more. Keys have no scopes. A key can’t create keys (POST /api/keys with a key returns 403).

List and delete: GET /api/keys lists your keys (no secrets). DELETE /api/keys/:keyId deletes one at once.

Keep keys in environment variables or a secret store. Never put one in scene code, which anyone can read.

Email and password

Register

POST <base>/api/auth/register
Content-Type: application/json
{ "email": "user@example.com", "password": "…", "displayName": "User" }

Returns { user, accessToken, refreshToken }. On a self-hosted install, the first account becomes the instance admin. 409 if the email is taken.

Sign in

POST <base>/api/auth/login
Content-Type: application/json
{ "email": "user@example.com", "password": "…" }

Returns { user, accessToken, refreshToken }, or 401 Invalid email or password.

Register, sign-in and password routes allow 20 requests per minute per IP address.

Refresh

Send the refresh token as the bearer token. There is no body.

POST <base>/api/auth/refresh
Authorization: Bearer <refresh token>

Returns { accessToken }.

Access tokens last JWT_ACCESS_EXPIRY (15 minutes by default); refresh tokens last JWT_REFRESH_EXPIRY (7 days by default). A request with an expired access token gets 401: refresh, then retry.

Other account routes

MethodPathAuthWhat it does
GET/api/auth/providersNo{ google, discord }: which OAuth providers are on
GET/api/auth/google, /api/auth/discordNoStarts OAuth in a browser. 501 if not configured
POST/api/auth/forgot-passwordNo{ email }. Always 200; sends a reset email when SMTP is set up
POST/api/auth/reset-passwordNoCompletes a reset with the emailed token
PUT/api/auth/profileYesChanges displayName
PUT/api/auth/passwordYes{ currentPassword, newPassword } (at least 8 characters)
DELETE/api/auth/accountYes{ password }. Deletes the account (password accounts only)
POST/api/auth/wallet/challenge, /api/auth/wallet/verifyNoSign in with an Ethereum wallet
GET/api/auth/walletsYesYour linked wallets

In-world sign-in (platform auth)

Scene code doesn’t use passwords or keys. @virvixr/dcl signs in for you:

POST <base>/api/auth/platform
Content-Type: application/json
(Decentraland signed-fetch headers)
{ "sceneId": "…", "user": { "id": "0x…", "displayName": "Player" }, "world": "decentraland", "location": { … }, "environment": { … } }
  • With valid Decentraland signed-fetch headers, the server verifies the wallet and returns a scene pass: the player’s role in the scene set up at that location, and nothing else. See Scene pass.
  • Without them, it returns a guest token (guest: true, refreshToken: null) that can only view.
  • A self-hosted, non-cloud server with ALLOW_UNVERIFIED_PLATFORM_AUTH=true accepts unverified identities instead. For local previews only.

Errors

StatusMeaning
401Missing, invalid or expired token or key
403Signed in, but not allowed (for example, not a host of that scene)
404Not found, or not yours. Other accounts’ scenes usually answer 404 rather than 403
429Rate limited. The global limit is RATE_LIMIT_MAX requests per minute per IP (300 by default)