Authentication

Email and password

POST /auth/v1/signup creates a user and returns a session. Sign in later with the password grant; the access token is the JWT for your Data API calls.

Sign up

Sign up · request
POST https://example-project.api.cubibase.com/auth/v1/signup
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json

{
  "email": "mina@example.com",
  "password": "<USER_PASSWORD>"
}
201 · response (trimmed)
{
  "user": {
    "id": "3f2b8c1e-9a47-4d02-b6e5-1c8f0a3d7e29",
    "email": "mina@example.com",
    "emailVerifiedAt": "2026-11-18T09:12:44.000Z",
    "providers": ["email"],
    "mfaEnabled": false
  },
  "accessToken": "<ACCESS_JWT>",
  "refreshToken": "<REFRESH_TOKEN>",
  "tokenType": "Bearer",
  "expiresIn": 3600
}
  • The password must meet the project’s minimum length — 8 characters by default — and must not equal the email address.
  • An optional data object is stored as the user’s metadata.
  • The response carries the user, an accessToken, a refreshToken, and the expiry.
  • A duplicate email returns 409 user_exists.

Sign in

Sign in · request
POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=password
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json

{
  "email": "mina@example.com",
  "password": "<USER_PASSWORD>"
}

A correct email and password return the same session shape as signup. Wrong credentials return 401 invalid_credentials — the same error whether the email exists or not.

Using the session

  1. Store the refreshToken safely on the client.
  2. Send the accessToken as Authorization: Bearer … on Data API calls.
  3. When it expires (1 hour by default), refresh with grant_type=refresh_token and store the new pair.
  4. On sign-out, POST /auth/v1/logout with the refresh token revokes the session.
Refresh · request
POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=refresh_token
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json

{
  "refreshToken": "<REFRESH_TOKEN>"
}

Read and update the user

GET /auth/v1/user returns the signed-in user from the bearer token. PATCH /auth/v1/user updates the password or metadata (and converts anonymous users — see Anonymous users).

Read the current user
GET https://example-project.api.cubibase.com/auth/v1/user
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <ACCESS_JWT>

Additional resources