Docs
Introduction

Documentation

Learn how to integrate ConnectX into your application.

Register

Learn how to register new users in ConnectX

The registration process in ConnectX involves creating a new user account and verifying the user's email address. Users must verify their email before they can log in to the system.

  1. User submits registration form with required information
  2. System creates new user account with default role "customer"
  3. System sends verification email with OTP
  4. User verifies email using OTP
  5. User can now log in to the system

Register Request

{
  "name": "string (required)",
  "email": "string (required, unique)",
  "password": "string (required, min 8 characters)",
  "role": "string (optional, default: customer)",
  "tenant": "UUID (optional)"
}

Verify Email Request

{
  "email": "string (required)",
  "otp": "string (required)"
}

Resend Verification Request

{
  "email": "string (required)"
}

Register Response

{
  "id": "UUID",
  "name": "string",
  "email": "string",
  "role": "string",
  "is_verified": "boolean",
  "tenant": "UUID",
  "created_at": "datetime",
  "updated_at": "datetime"
}

Verify Email Response

{
  "message": "string"
}

Common Errors

  • 400 Bad Request
    {
      "error": "Email already exists"
    }
  • 400 Bad Request
    {
      "error": "Invalid OTP"
    }

Create a new user account.

Command

curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/users/' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "John Doe",
    "email": "john@example.com",
    "password": "secure_password",
    "role": "customer",
    "tenant": "123e4567-e89b-12d3-a456-426614174001"
  }'

Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "John Doe",
  "email": "john@example.com",
  "role": "customer",
  "is_verified": false,
  "tenant": "123e4567-e89b-12d3-a456-426614174001",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}

Verify user's email address using OTP.

Command

curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/auth/verify-email/' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "john@example.com",
    "otp": "123456"
  }'

Response

{
  "message": "Email verified successfully"
}

Request a new verification email.

Command

curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/auth/resend-verification/' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "john@example.com"
  }'

Response

{
  "message": "Verification email sent successfully"
}