auth

Register new user

When the project has **requireEmailVerification** enabled (default), the response is 201 with **requireVerification: true** and **no token**; the user must verify their email then sign in via login. When email verification is disabled, a token and refreshToken are returned.

POST/api/auth/local/register

Authentication

Public — No Auth Required

Request Body

Registration payload (email, password, firstName, lastName, projectId).

json
{
  "email": "amari_koss69@northwind.dev",
  "password": "Str0ng_Sample_Pass!w0rd",
  "firstName": "Marjorie",
  "lastName": "Wyman",
  "projectId": "proj_qh5hFHNT70YZ"
}
{
  "email": "amari_koss69@northwind.dev",
  "password": "Str0ng_Sample_Pass!w0rd",
  "firstName": "Marjorie",
  "lastName": "Wyman",
  "projectId": "proj_qh5hFHNT70YZ"
}

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.

async function run() {
  const result = await client.auth.register({
  email: "arvel71@northwind.dev",
  password: "Str0ng_Sample_Pass!w0rd",
  firstName: "Newton",
  lastName: "Farrell",
  projectId: "proj_Wn5d3QeJdjz4"
  });

  if (result.requireVerification) {
    console.log("Please verify your email before logging in.");
  } else {
    console.log("Token:", result.token);
  }
}

run();
async function run() {
  const result = await client.auth.register({
  email: "arvel71@northwind.dev",
  password: "Str0ng_Sample_Pass!w0rd",
  firstName: "Newton",
  lastName: "Farrell",
  projectId: "proj_Wn5d3QeJdjz4"
  });

  if (result.requireVerification) {
    console.log("Please verify your email before logging in.");
  } else {
    console.log("Token:", result.token);
  }
}

run();

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

201When project.requireEmailVerification is on (default): no token returned; use requireVerification and message to prompt email verification, then user signs in via login. When off: token and refreshToken returned.

Email verification ON (default) — no token until verified

json
{
  "message": "Check your email to verify your account",
  "requireVerification": true
}
{
  "message": "Check your email to verify your account",
  "requireVerification": true
}

Email verification OFF — token returned immediately

json
{
  "message": "Registration successful",
  "requireVerification": false,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 65051,
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "john.doe@mudbase.dev",
    "firstName": "John",
    "lastName": "Doe",
    "emailVerified": true,
    "customRole": null
  }
}
{
  "message": "Registration successful",
  "requireVerification": false,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 65051,
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "john.doe@mudbase.dev",
    "firstName": "John",
    "lastName": "Doe",
    "emailVerified": true,
    "customRole": null
  }
}
400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.
404Project not found (exact backend message).
429Rate limit exceeded.
500Internal server error.

Errors

CodeMeaning
400Bad request or validation error.
401Authentication required or invalid token.
403Access denied or insufficient permissions.
404Project not found (exact backend message).
429Rate limit exceeded.
500Internal server error.
Edit this page on GitHub