auth

Create anonymous session

Create an anonymous user session for guest access. Users can later convert to full accounts.

POST/api/auth/anonymous

Authentication

Public — No Auth Required

Request Body

Optional projectId and deviceId for the anonymous session.

json
{
  "projectId": "685ad30be129932fbb7a1047",
  "deviceId": "device-uuid-123"
}
{
  "projectId": "685ad30be129932fbb7a1047",
  "deviceId": "device-uuid-123"
}

SDK setup

Create a client instance. No authentication is required for this endpoint.

import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();
import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const result = await client.auth.createAnonymous({
  projectId: "proj_MQuAFww6fs1M",
  deviceId: "9o7M6MIpLj1EZoZr"
});
const result = await client.auth.createAnonymous({
  projectId: "proj_MQuAFww6fs1M",
  deviceId: "9o7M6MIpLj1EZoZr"
});

Try It Live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

No Request Yet

Send a request to see the full inspector

Responses

200Anonymous session created
json
{
  "message": "Anonymous session created",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 86400,
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "anonymous_abc123@anonymous.local",
    "firstName": "Anonymous",
    "lastName": "User",
    "role": "viewer",
    "isAnonymous": true
  }
}
{
  "message": "Anonymous session created",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 86400,
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "anonymous_abc123@anonymous.local",
    "firstName": "Anonymous",
    "lastName": "User",
    "role": "viewer",
    "isAnonymous": true
  }
}
400Bad request or validation error.
403Access denied or insufficient permissions.
404Project not found (exact backend message).

Errors

CodeMeaning
400Bad request or validation error.
403Access denied or insufficient permissions.
404Project not found (exact backend message).
Edit this page on GitHub