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.
/api/auth/local/registerAuthentication
Request Body
Registration payload (email, password, firstName, lastName, projectId).
{
"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
Email verification ON (default) — no token until verified
{
"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
{
"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
}
}Errors
| Code | Meaning |
|---|---|
400 | Bad request or validation error. |
401 | Authentication required or invalid token. |
403 | Access denied or insufficient permissions. |
404 | Project not found (exact backend message). |
429 | Rate limit exceeded. |
500 | Internal server error. |