Api

Authentication

Manage user accounts, authentication tokens, and user profiles.

Authentication

Manage user accounts, authentication tokens, and user profiles.

Sign Up

POST /auth/signup

Create a new user account with Suble.io. This endpoint registers a new user and immediately returns authentication tokens for seamless onboarding.

ℹ️ Regional Availability: Currently available in Denmark (DK), Norway (NO), Sweden (SE), and Finland (FI).

Request Body

NameTypeDescription
fullnamestringFull name of the user
emailstringValid email address for the account
passwordstringSecure password (minimum requirements apply)
countrystringCountry code (DK, NO, SE, FI)
languagestringOptional. Preferred language (defaults to "da")

Example Request:

{
  "fullname": "John Doe",
  "email": "john@example.com", 
  "password": "SecurePassword123!",
  "country": "DK",
  "language": "en"
}

Response

200 - Success

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

400 - Bad Request

{
  "error": "Invalid fullname, email, password or country"
}

Log In

POST /auth/login

Authenticate an existing user and obtain access tokens for API usage.

Request Body

NameTypeDescription
emailstringUser's email address
passwordstringUser's password

Example Request:

{
  "email": "john@example.com",
  "password": "SecurePassword123!"
}

Response

200 - Success

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

403 - Authentication Failed

{
  "error": "Invalid email or password."
}

Refresh Token

POST /auth/refresh

Refresh an expired access token using a valid refresh token. Access tokens have a limited lifespan for security purposes.

Request Body

NameTypeDescription
refresh_tokenstringValid refresh token from login

Example Request:

{
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Response

200 - Success

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Get User Profile

GET /auth/fetch

Retrieve current user information and account status.

Headers

NameTypeDescription
AuthorizationstringBearer token for authentication

Response

200 - Success

{
  "user": {
    "uid": "abc123def456",
    "role": "customer",
    "email": "john@example.com",
    "fullname": "John Doe",
    "country": "DK",
    "emailVerified": true,
    "language": "en",
    "customerBillingSetup": 1,
    "customerAgreementSetup": 1,
    "customerType": "person"
  }
}

Update Profile

PUT /auth/profile

Update user profile information such as name and language preferences.

Headers

NameTypeDescription
AuthorizationstringBearer token for authentication

Request Body

NameTypeDescription
fullnamestringOptional. Updated full name
languagestringOptional. Preferred language code

Example Request:

{
  "fullname": "John Smith",
  "language": "en"
}

Response

200 - Success

{
  "success": true
}

Password Reset

POST /auth/reset

Request a password reset email or reset password using a reset token.

Request Password Reset

Request Body:

{
  "email": "john@example.com"
}

Reset Password with Token

Request Body:

{
  "token": "reset_token_from_email",
  "password": "NewSecurePassword123!"
}

Response

200 - Success

{
  "success": true
}

Log Out

POST /auth/logout

Log out the current user session.

Headers

NameTypeDescription
AuthorizationstringBearer token for authentication

Response

200 - Success

{
  "success": true
}