Skip to content

totask API Documentation

Base URL

https://totask.app/v1/

Authentication Routes

All authentication-related endpoints are prefixed with /auth.

Register a User

Endpoint: /auth/register

Method: POST

Description: Registers a new user.

Request Body:

json
{
  "name": "User's Name",
  "email": "user@example.com",
  "password": "userpassword"
}

Response:

  • 201 Created
    json
    {
      "user": {
        "id": "user_id",
        "name": "User's Name",
        "email": "user@example.com",
        ...
      }
    }

Login with Email and Password

Endpoint: /auth/login

Method: POST

Description: Logs in a user using their email and password.

Request Body:

json
{
  "email": "user@example.com",
  "password": "userpassword"
}

Response:

  • 200 OK
    json
    {
      "user": "user_id",
      "tokens": {
        "access": {
          "token": "access_token",
          "expires": "expiry_time"
        },
        "refresh": {
          "token": "refresh_token",
          "expires": "expiry_time"
        }
      }
    }

Logout

Endpoint: /auth/logout

Method: POST

Description: Logs out the current user and destroys their session.

Response:

  • 204 No Content

Forgot Password

Endpoint: /auth/forgot-password

Method: POST

Description: Sends a password reset email to the user.

Request Body:

json
{
  "email": "user@example.com"
}

Response:

  • 204 No Content

Reset Password

Endpoint: /auth/reset-password

Method: POST

Description: Resets the user's password using a token.

Request Body:

json
{
  "password": "newpassword"
}

Query Parameters:

  • token: The reset password token received via email.

Response:

  • 204 No Content

Change Password

Endpoint: /auth/change-password

Method: POST

Description: Changes the user's password.

Request Body:

json
{
  "email": "user@example.com",
  "password": "currentpassword",
  "newPassword": "newpassword"
}

Response:

  • 204 No Content

Send Verification Email

Endpoint: /auth/send-verification-email

Method: POST

Description: Sends a verification email to the user.

Response:

  • 204 No Content

Verify Email

Endpoint: /auth/verify-email

Method: POST

Description: Verifies the user's email using a token.

Query Parameters:

  • token: The email verification token.

Response:

  • 204 No Content

Authentication Controller Methods

register

Registers a new user and creates a default workspace for them.

emailAndPasswordLogin

Logs in a user using their email and password, generates authentication tokens, and saves the session.

logout

Logs out the user, destroys the session, and clears the authentication cookie.

forgotPassword

Generates a password reset token and sends a password reset email to the user.

resetPassword

Resets the user's password using the provided reset token.

changePassword

Changes the user's password after verifying the current password.

sendVerificationEmail

Sends an email verification token to the user's email address.

verifyEmail

Verifies the user's email using the provided verification token and updates the session.