Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/zulfikarrosadi/juadah-backend/llms.txt

Use this file to discover all available pages before exploring further.

Creates a new user account and returns authentication cookies (accessToken and refreshToken) along with the user details.

Request

email
string
required
User’s email address. Must be a valid email format.
fullname
string
required
User’s full name. Must have minimum 1 character.
password
string
required
User’s password. Must have minimum 1 character.
passwordConfirmation
string
required
Password confirmation. Must match the password field exactly.

Response

status
string
Response status. Returns “success” on successful registration.
data
object
Contains the user data object.
users
object
The created user details.
id
number
Unique identifier for the user.
fullname
string
User’s full name.
email
string
User’s email address.

Response Headers

The response includes two Set-Cookie headers:
  • Set-Cookie: accessToken - HTTP-only cookie for API authentication. Valid across all paths. Includes Secure and SameSite=None flags.
  • Set-Cookie: refreshToken - HTTP-only cookie for token renewal. Only valid for /api/refresh path. Includes Secure and SameSite=None flags.

Example Request

curl -X POST https://juadah-backend.vercel.app/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "fullname": "John Doe",
    "password": "securepassword123",
    "passwordConfirmation": "securepassword123"
  }'

Example Response

Success (201 Created)

{
  "status": "success",
  "data": {
    "users": {
      "id": 1,
      "fullname": "John Doe",
      "email": "user@example.com"
    }
  }
}
Response headers include:
Set-Cookie: accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...; Path=/; HttpOnly; Secure; SameSite=None
Set-Cookie: refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...; Path=/api/refresh; HttpOnly; Secure; SameSite=None

Validation Error (400 Bad Request)

{
  "status": "fail",
  "errors": {
    "code": 400,
    "message": "validation error",
    "details": {
      "email": "your email is in invalid format",
      "password": "password and password confirmation is not match"
    }
  }
}
Common validation errors:
  • email is required - Email field is missing
  • your email is in invalid format - Invalid email format
  • fullname should have minimum 1 characters - Fullname is empty
  • password is required - Password field is missing
  • password confirmation is required - Password confirmation field is missing
  • password and password confirmation is not match - Passwords don’t match

Build docs developers (and LLMs) love