Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt

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

The register endpoint creates a new user account in the Ocha system. On success, the API returns a signed JWT token that can be used immediately to authenticate subsequent requests. Email addresses and display names must each be unique across all accounts; the API validates both before persisting the record.
No authentication is required for this endpoint. It is publicly accessible.
Method: POST   Path: /api/v1/auth

Request body

email
string
required
The user’s email address. Must be a valid email format. Normalized to lowercase before storage. Must not already be registered.
password
string
required
The user’s password in plain text. Hashed with bcrypt before storage. Must meet all of the following rules:
  • Minimum 8 characters
  • At least one uppercase letter (A–Z)
  • At least one lowercase letter (a–z)
  • At least one digit (0–9)
  • At least one special character (e.g. !, @, #, _)
display_name
string
required
The user’s public display name. Must be between 3 and 30 characters. Only letters, numbers, and underscores (_) are allowed. Must not already be taken.
phone
string
Optional phone number. Non-digit characters are stripped before validation. The cleaned value must contain at least 8 digits.

Response — 201 Created

message
string
Human-readable confirmation. Value: "User successfully registered".
token
string
Signed JWT authentication token. Include this in the Authorization: Bearer <token> header for protected endpoints.
user
object
Basic profile data for the newly created user.

Error codes

StatusMeaningCause
400 Bad RequestMissing required fieldemail, password, or display_name is absent or empty
409 ConflictDuplicate valueThe email or display name is already registered
422 Unprocessable EntityValidation failureEmail format is invalid, password does not meet complexity rules, display name contains invalid characters or is out of range, or phone has fewer than 8 digits
500 Internal Server ErrorUnexpected errorAn unhandled server-side error occurred

Example

curl --request POST \
  --url https://api.example.com/api/v1/auth \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "password": "Password_123?",
    "display_name": "test_user",
    "phone": "12345678"
  }'
{
  "message": "User successfully registered",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "6642f1a2c3d4e5f6a7b8c9d0",
    "email": "[email protected]",
    "display_name": "test_user"
  }
}

Build docs developers (and LLMs) love