Authentication
User signup, verification, and password recovery 14 Endpunkte. Basis-URL: https://xapi.ambertech.cloud/api/v1
Bootstrap session payload#
/auth/bootstrapTokenOne-shot endpoint returning user + organization + spaces + permissions for fast dashboard initialization. Replaces 3-4 sequential calls.
Antworten
- 200Bootstrap payload
- 401Not authenticated
curl -X GET "https://xapi.ambertech.cloud/api/v1/auth/bootstrap" \
-H "Authorization: Bearer $XISUITE_TOKEN"Exchange a Supabase auth code for a session#
/auth/exchange-codeÖffentlichUsed by the password-reset confirmation page and other flows where the user lands on the frontend with a one-time `code` from a Supabase email link. Returns tokens and writes auth cookies.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
codePflicht | string | One-time Supabase auth code from a recovery / invite email link or OAuth callback. |
Antworten
- 200Code exchanged — cookies set
- 400Invalid or expired code
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/exchange-code" \
-H "Content-Type: application/json" \
-d '{"code":"…"}'Request password reset#
/auth/forgot-passwordÖffentlichSends a password reset email with a secure link. Always returns success to prevent email enumeration.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
emailPflicht | string | User email address |
Antworten
- 200Password reset email sent (always returns success)
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/forgot-password" \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com"}'Get current user + tenant context#
/auth/meTokenReturns the authenticated user's profile alongside the multi-tenant context: the currently active organization (matching the active_org_id cookie) and every organization the caller is a member of. Replaces the legacy single-org `/auth/me` shape — callers that used to read `.organization_id` should now read `.activeOrganization.id`. `.user` carries the bare profile for back-compat.
Antworten
- 200User profile + tenant context
- 401Not authenticated
curl -X GET "https://xapi.ambertech.cloud/api/v1/auth/me" \
-H "Authorization: Bearer $XISUITE_TOKEN"Refresh access token for browser navigation#
/auth/refreshÖffentlichReads refresh_token from the HttpOnly cookie, rotates auth cookies, and redirects back to an allowlisted frontend URL.
Antworten
- 200OK
curl -X GET "https://xapi.ambertech.cloud/api/v1/auth/refresh"Refresh access token#
/auth/refreshÖffentlichExchanges a refresh token for a new pair. Token is read from the body OR from the refresh_token cookie (browser-friendly). New cookies are written on the response.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
refreshToken | string | Refresh token. Optional when the refresh_token cookie is present. |
Antworten
- 200Token refreshed — cookies rotated
- 401Invalid or expired refresh token
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/refresh" \
-H "Content-Type: application/json" \
-d '{"refreshToken":"pcnpngwwbrge"}'Transfer a browser session to a published site origin#
/auth/refresh/transfer-sessionÖffentlichValidates backend-owned HttpOnly cookies and redirects to an allowlisted published return URL with a short-lived bearer in the URL hash. The `/auth/refresh/transfer-session` alias is used by browsers so the path-scoped refresh_token cookie can recover expired access sessions.
Antworten
- 200OK
curl -X GET "https://xapi.ambertech.cloud/api/v1/auth/refresh/transfer-session"Resend verification OTP#
/auth/resend-verificationÖffentlichGenerates a new OTP for an unconfirmed user and sends it via email. Returns a generic response to prevent email enumeration.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
emailPflicht | string | User email address |
Antworten
- 200Verification email resent
- 400Could not generate verification code
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/resend-verification" \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com"}'Sign in with email and password#
/auth/signinÖffentlichAuthenticates a user with email/password. Returns the user profile and writes `access_token` + `refresh_token` HttpOnly cookies on the response. Cookie-based clients can rely on the browser to send these on subsequent requests; header-based clients can read the body tokens.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
emailPflicht | string | User email address |
passwordPflicht | string | User password |
Antworten
- 200Sign-in successful — cookies set, body returns tokens + user
- 401Invalid email or password
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/signin" \
-H "Content-Type: application/json" \
-d '{"email":"prince@abjexperts.com","password":"Admin@123"}'Sign out#
/auth/signoutTokenInvalidates the user's current session refresh token on the server and clears auth cookies. With `?everywhere=true`, revokes ALL of this user's sessions across devices.
Parameter
| Name | Ort | Typ | Beschreibung |
|---|---|---|---|
everywherePflicht | Query | string | – |
Antworten
- 200Signed out successfully
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/signout" \
-H "Authorization: Bearer $XISUITE_TOKEN"Register a new user#
/auth/signupÖffentlichCreates a new user account via Supabase Auth and sends an OTP verification email. The database trigger `handle_new_user` automatically creates the public.users profile.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
firstNamePflicht | string | User first name |
lastNamePflicht | string | User last name |
emailPflicht | string | User email address |
passwordPflicht | string | Password (min 6 characters) |
Antworten
- 200Signup successful — OTP email sent
- 400Validation error or signup failed
- 503Verification email could not be sent (code: email_send_failed) — the account is created; retrying signup re-sends the OTP once mail delivery is fixed
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/signup" \
-H "Content-Type: application/json" \
-d '{"firstName":"Prince","lastName":"Jadiya","email":"user@example.com","password":"SecurePass123"}'Transfer a browser session to a published site origin#
/auth/transfer-sessionÖffentlichValidates backend-owned HttpOnly cookies and redirects to an allowlisted published return URL with a short-lived bearer in the URL hash. The `/auth/refresh/transfer-session` alias is used by browsers so the path-scoped refresh_token cookie can recover expired access sessions.
Antworten
- 200OK
curl -X GET "https://xapi.ambertech.cloud/api/v1/auth/transfer-session"Update password#
/auth/update-passwordTokenChanges the password for the currently authenticated user. Token is read from the access_token cookie or the Authorization header.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
passwordPflicht | string | New password (min 6 characters) |
Antworten
- 200Password updated successfully
- 400Failed to update password
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/update-password" \
-H "Authorization: Bearer $XISUITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"password":"NewSecurePass456"}'Verify email with OTP#
/auth/verify-otpÖffentlichVerifies the user's email using the OTP code. Returns JWT tokens and writes auth cookies.
Request-Body
| Name | Typ | Beschreibung |
|---|---|---|
emailPflicht | string | User email |
tokenPflicht | string | The 6-digit OTP received via email |
Antworten
- 200OTP verified — cookies set
- 400Invalid or expired OTP
curl -X POST "https://xapi.ambertech.cloud/api/v1/auth/verify-otp" \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","token":"123456"}'