{ "openapi": "3.1.1", "info": { "title": "Openfort Auth", "description": "API Reference for Openfort Auth", "version": "1.0.0" }, "components": { "schemas": { "User": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "emailVerified": { "type": "boolean", "default": false, "readOnly": true }, "image": { "type": "string" }, "createdAt": { "type": "string", "default": "Generated at runtime" }, "updatedAt": { "type": "string", "default": "Generated at runtime" }, "isAnonymous": { "type": "boolean" }, "phoneNumber": { "type": "string" }, "phoneNumberVerified": { "type": "boolean", "readOnly": true } }, "required": ["id", "name", "email", "createdAt", "updatedAt"] }, "Session": { "type": "object", "properties": { "id": { "type": "string" }, "expiresAt": { "type": "string" }, "token": { "type": "string" }, "createdAt": { "type": "string", "default": "Generated at runtime" }, "updatedAt": { "type": "string" }, "ipAddress": { "type": "string" }, "userAgent": { "type": "string" }, "userId": { "type": "string" } }, "required": [ "id", "expiresAt", "token", "createdAt", "updatedAt", "userId" ] }, "Account": { "type": "object", "properties": { "id": { "type": "string" }, "accountId": { "type": "string" }, "providerId": { "type": "string" }, "userId": { "type": "string" }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" }, "idToken": { "type": "string" }, "accessTokenExpiresAt": { "type": "string" }, "refreshTokenExpiresAt": { "type": "string" }, "scope": { "type": "string" }, "password": { "type": "string" }, "createdAt": { "type": "string", "default": "Generated at runtime" }, "updatedAt": { "type": "string" } }, "required": [ "accountId", "providerId", "userId", "createdAt", "updatedAt" ] }, "Verification": { "type": "object", "properties": { "id": { "type": "string" }, "identifier": { "type": "string" }, "value": { "type": "string" }, "expiresAt": { "type": "string" }, "createdAt": { "type": "string", "default": "Generated at runtime" }, "updatedAt": { "type": "string", "default": "Generated at runtime" } }, "required": [ "identifier", "value", "expiresAt", "createdAt", "updatedAt" ] }, "Jwks": { "type": "object", "properties": { "id": { "type": "string" }, "publicKey": { "type": "string" }, "privateKey": { "type": "string" }, "createdAt": { "type": "string" } }, "required": ["publicKey", "privateKey", "createdAt"] }, "OtpVerificationResponse": { "type": "object", "description": "Response from OTP verification check", "properties": { "success": { "type": "boolean", "description": "Indicates whether the OTP verification was successful" } }, "required": ["success"] }, "SignOutResponse": { "type": "object", "description": "Response from sign out operation", "properties": { "success": { "type": "boolean", "description": "Indicates whether the sign out was successful" } }, "required": ["success"] }, "UnlinkAccountResponse": { "type": "object", "description": "Response from unlink account operation", "properties": { "status": { "type": "boolean", "description": "Indicates whether the account was successfully unlinked" } }, "required": ["status"] }, "ResetPasswordResponse": { "type": "object", "description": "Response from reset password operation", "properties": { "status": { "type": "boolean", "description": "Indicates whether the password was successfully reset" } }, "required": ["status"] } }, "securitySchemes": { "apiKeyCookie": { "type": "apiKey", "in": "cookie", "name": "apiKeyCookie", "description": "Session cookie authentication. Set automatically by the browser after sign-in." }, "auth_token": { "type": "http", "scheme": "bearer", "description": "Auth session token. Use the session token received from sign-in/sign-up responses as the Bearer token." }, "projectKey": { "type": "apiKey", "in": "header", "name": "x-project-key", "description": "Publishable key to identify the project. Format: pk_test_ (sandbox) or pk_live_ (live)." } } }, "security": [ { "apiKeyCookie": [], "auth_token": [], "projectKey": [] } ], "servers": [ { "url": "https://api.openfort.io/iam/v2/auth" } ], "paths": { "/sign-in/social": { "post": { "tags": ["auth v2"], "description": "Sign in with a social provider", "summary": "Sign in with a social provider.", "operationId": "socialSignIn", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "callbackURL": { "type": "string", "description": "Callback URL to redirect to after the user has signed in", "nullable": true }, "newUserCallbackURL": { "type": "string", "nullable": true }, "errorCallbackURL": { "type": "string", "description": "Callback URL to redirect to if an error happens", "nullable": true }, "provider": { "type": "string" }, "disableRedirect": { "type": "boolean", "description": "Disable automatic redirection to the provider. Useful for handling the redirection yourself", "nullable": true }, "idToken": { "type": "object", "properties": { "token": { "type": "string", "description": "ID token from the provider" }, "nonce": { "type": "string", "description": "Nonce used to generate the token", "nullable": true }, "accessToken": { "type": "string", "description": "Access token from the provider", "nullable": true }, "refreshToken": { "type": "string", "description": "Refresh token from the provider", "nullable": true }, "expiresAt": { "type": "number", "description": "Expiry date of the token", "nullable": true } }, "required": ["token"], "nullable": true }, "scopes": { "type": "array", "description": "Array of scopes to request from the provider. This will override the default scopes passed.", "items": { "type": "string" }, "nullable": true }, "requestSignUp": { "type": "boolean", "description": "Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider", "nullable": true }, "loginHint": { "type": "string", "description": "The login hint to use for the authorization code request", "nullable": true } }, "required": ["provider"] } } } }, "responses": { "200": { "description": "Success - Returns either session details or redirect URL", "content": { "application/json": { "schema": { "type": "object", "description": "Session response when idToken is provided", "properties": { "redirect": { "type": "boolean", "enum": [false] }, "token": { "type": "string", "description": "Session token" }, "url": { "type": "string", "nullable": true }, "user": { "type": "object", "properties": { "id": { "type": "string" }, "email": { "type": "string" }, "name": { "type": "string", "nullable": true }, "image": { "type": "string", "nullable": true }, "emailVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "isAnonymous": { "type": "boolean" } }, "required": [ "id", "email", "emailVerified", "createdAt", "updatedAt" ] } }, "required": ["redirect", "token", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/get-session": { "get": { "tags": ["auth v2"], "description": "Get the current session", "summary": "Get the current session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [ { "name": "disableCookieCache", "in": "query", "required": false, "schema": { "type": "boolean" }, "description": "Disable cookie cache and fetch session from database" } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "session": { "$ref": "#/components/schemas/Session" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["session", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-out": { "post": { "tags": ["auth v2"], "description": "Sign out the current user", "summary": "Sign out.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-up/email": { "post": { "tags": ["auth v2"], "description": "Sign up a user using email and password", "summary": "Sign up with email and password.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of the user" }, "email": { "type": "string", "description": "The email of the user" }, "password": { "type": "string", "description": "The password of the user" }, "image": { "type": "string", "description": "The profile image URL of the user" }, "callbackURL": { "type": "string", "description": "The URL to use for email verification callback" }, "rememberMe": { "type": "boolean", "description": "If this is false, the session will not be remembered. Default is `true`." } }, "required": ["name", "email", "password"] } } } }, "responses": { "200": { "description": "Successfully created user", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "nullable": true, "description": "Authentication token for the session" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "422": { "description": "Unprocessable Entity. User already exists or failed to create user.", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-in/email": { "post": { "tags": ["auth v2"], "description": "Sign in with email and password", "summary": "Sign in with email and password.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email of the user" }, "password": { "type": "string", "description": "Password of the user" }, "callbackURL": { "type": "string", "description": "Callback URL to use as a redirect for email verification", "nullable": true }, "rememberMe": { "type": "boolean", "nullable": true } }, "required": ["email", "password"] } } } }, "responses": { "200": { "description": "Success - Returns either session details or redirect URL", "content": { "application/json": { "schema": { "type": "object", "description": "Session response when idToken is provided", "properties": { "redirect": { "type": "boolean", "enum": [false] }, "token": { "type": "string", "description": "Session token" }, "url": { "type": "string", "nullable": true }, "user": { "type": "object", "properties": { "id": { "type": "string" }, "email": { "type": "string" }, "name": { "type": "string", "nullable": true }, "image": { "type": "string", "nullable": true }, "emailVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "isAnonymous": { "type": "boolean" } }, "required": [ "id", "email", "emailVerified", "createdAt", "updatedAt" ] } }, "required": ["redirect", "token", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/forget-password": { "post": { "tags": ["auth v2"], "description": "Send a password reset email to the user", "summary": "Forget password.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address of the user to send a password reset email to" }, "redirectTo": { "type": "string", "description": "The URL to redirect the user to reset their password. If the token isn't valid or expired, it'll be redirected with a query parameter `?error=INVALID_TOKEN`. If the token is valid, it'll be redirected with a query parameter `?token=VALID_TOKEN", "nullable": true } }, "required": ["email"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "message": { "type": "string" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/reset-password": { "post": { "tags": ["auth v2"], "description": "Reset the password for a user", "summary": "Reset password.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "newPassword": { "type": "string", "description": "The new password to set" }, "token": { "type": "string", "description": "The token to reset the password", "nullable": true } }, "required": ["newPassword"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetPasswordResponse" } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/verify-email": { "get": { "tags": ["auth v2"], "description": "Verify the email of the user.\nUsually this endpoint is called when user clicks 'Verify email' link from the letter.", "summary": "Verify email.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [ { "name": "token", "in": "query", "description": "The token to verify the email", "required": true, "schema": { "type": "string" } }, { "name": "callbackURL", "in": "query", "description": "The URL to redirect to after email verification", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "user": { "type": "object", "properties": { "id": { "type": "string", "description": "User ID" }, "email": { "type": "string", "description": "User email" }, "name": { "type": "string", "description": "User name" }, "image": { "type": "string", "description": "User image URL" }, "emailVerified": { "type": "boolean", "description": "Indicates if the user email is verified" }, "createdAt": { "type": "string", "description": "User creation date" }, "updatedAt": { "type": "string", "description": "User update date" } }, "required": [ "id", "email", "name", "image", "emailVerified", "createdAt", "updatedAt" ] }, "status": { "type": "boolean", "description": "Indicates if the email was verified successfully" } }, "required": ["user", "status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/send-verification-email": { "post": { "tags": ["auth v2"], "description": "Send a verification email to the user", "summary": "Send verification email.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The email to send the verification email to", "example": "user@example.com" }, "callbackURL": { "type": "string", "description": "The URL to use for email verification callback", "example": "https://example.com/callback", "nullable": true } }, "required": ["email"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the email was sent successfully", "example": true } } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "Error message", "example": "Verification email isn't enabled" } } } } } }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/change-email": { "post": { "description": "Change user's email", "summary": "Change email.", "tags": ["auth v2"], "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "newEmail": { "type": "string", "description": "The new email address to set must be a valid email address" }, "callbackURL": { "type": "string", "description": "The URL to redirect to after email verification", "nullable": true } }, "required": ["newEmail"] } } } }, "responses": { "200": { "description": "Email change request processed successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the request was successful" }, "message": { "type": "string", "enum": ["Email updated", "Verification email sent"], "description": "Status message of the email change process", "nullable": true } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "422": { "description": "Unprocessable Entity. Email already exists", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/change-password": { "post": { "tags": ["auth v2"], "description": "Change the password of the user", "summary": "Change password.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "newPassword": { "type": "string", "description": "The new password to set" }, "currentPassword": { "type": "string", "description": "The current password is required" }, "revokeOtherSessions": { "type": "boolean", "description": "Must be a boolean value", "nullable": true } }, "required": ["newPassword", "currentPassword"] } } } }, "responses": { "200": { "description": "Password successfully changed", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "nullable": true, "description": "New session token if other sessions were revoked" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/reset-password/{token}": { "get": { "tags": ["auth v2"], "description": "Redirects the user to the callback URL with the token", "summary": "Reset password callback.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [ { "name": "token", "in": "path", "required": true, "schema": { "type": "string", "description": "The reset password token" } }, { "name": "callbackURL", "in": "query", "schema": { "type": "string", "description": "The URL to redirect the user to reset their password" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/request-password-reset": { "post": { "tags": ["auth v2"], "description": "Send a password reset email to the user", "summary": "Request password reset.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "The email address of the user to send a password reset email to" }, "redirectTo": { "type": "string", "description": "The URL to redirect the user to reset their password. If the token isn't valid or expired, it'll be redirected with a query parameter `?error=INVALID_TOKEN`. If the token is valid, it'll be redirected with a query parameter `?token=VALID_TOKEN", "nullable": true } }, "required": ["email"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean" }, "message": { "type": "string" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/list-sessions": { "get": { "tags": ["auth v2"], "description": "List all active sessions for the user", "summary": "List sessions.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Session" } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/revoke-session": { "post": { "tags": ["auth v2"], "description": "Revoke a single session", "summary": "Revoke session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "The token to revoke" } }, "required": ["token"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the session was revoked successfully" } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/revoke-sessions": { "post": { "tags": ["auth v2"], "description": "Revoke all sessions for the user", "summary": "Revoke sessions.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if all sessions were revoked successfully" } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/revoke-other-sessions": { "post": { "tags": ["auth v2"], "description": "Revoke all other sessions for the user except the current one", "summary": "Revoke other sessions.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if all other sessions were revoked successfully" } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/link-social": { "post": { "tags": ["auth v2"], "description": "Link a social account to the user", "summary": "Link social account.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "callbackURL": { "type": "string", "description": "The URL to redirect to after the user has signed in", "nullable": true }, "provider": { "type": "string" }, "idToken": { "type": "object", "properties": { "token": { "type": "string" }, "nonce": { "type": "string", "nullable": true }, "accessToken": { "type": "string", "nullable": true }, "refreshToken": { "type": "string", "nullable": true }, "scopes": { "type": "array", "items": { "type": "string" }, "nullable": true } }, "required": ["token"], "nullable": true }, "requestSignUp": { "type": "boolean", "nullable": true }, "scopes": { "type": "array", "description": "Additional scopes to request from the provider", "items": { "type": "string" }, "nullable": true }, "errorCallbackURL": { "type": "string", "description": "The URL to redirect to if there is an error during the link process", "nullable": true }, "disableRedirect": { "type": "boolean", "description": "Disable automatic redirection to the provider. Useful for handling the redirection yourself", "nullable": true } }, "required": ["provider"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "description": "The authorization URL to redirect the user to" }, "redirect": { "type": "boolean", "description": "Indicates if the user should be redirected to the authorization URL" }, "status": { "type": "boolean" } }, "required": ["redirect"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/list-accounts": { "get": { "tags": ["auth v2"], "description": "List all accounts linked to the user", "summary": "List lined accounts.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "provider": { "type": "string" }, "createdAt": { "type": "integer", "format": "int64" }, "updatedAt": { "type": "integer", "format": "int64" }, "accountId": { "type": "string" }, "chainType": { "type": "string" }, "chainId": { "type": "string" }, "connectorType": { "type": "string" }, "walletClientType": { "type": "string" } }, "required": [ "provider", "createdAt", "updatedAt", "accountId", "chainType", "chainId", "connectorType", "walletClientType" ] } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/unlink-account": { "post": { "tags": ["auth v2"], "description": "Unlink an account", "summary": "Unlink account.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "providerId": { "type": "string" }, "accountId": { "type": "string", "nullable": true } }, "required": ["providerId"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UnlinkAccountResponse" } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/refresh-token": { "post": { "tags": ["auth v2"], "description": "Refresh the access token using a refresh token", "summary": "Refresh access token.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "providerId": { "type": "string", "description": "The provider ID for the OAuth provider" }, "accountId": { "type": "string", "description": "The account ID associated with the refresh token", "nullable": true }, "userId": { "type": "string", "description": "The user ID associated with the account", "nullable": true } }, "required": ["providerId"] } } } }, "responses": { "200": { "description": "Access token refreshed successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "tokenType": { "type": "string" }, "idToken": { "type": "string" }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" }, "accessTokenExpiresAt": { "type": "string", "format": "date-time" }, "refreshTokenExpiresAt": { "type": "string", "format": "date-time" } } } } } }, "400": { "description": "Invalid refresh token or provider configuration" }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/get-access-token": { "post": { "tags": ["auth v2"], "description": "Get a valid access token, doing a refresh if needed", "summary": "Get access token.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "providerId": { "type": "string", "description": "The provider ID for the OAuth provider" }, "accountId": { "type": "string", "description": "The account ID associated with the refresh token", "nullable": true }, "userId": { "type": "string", "description": "The user ID associated with the account", "nullable": true } }, "required": ["providerId"] } } } }, "responses": { "200": { "description": "A Valid access token", "content": { "application/json": { "schema": { "type": "object", "properties": { "tokenType": { "type": "string" }, "idToken": { "type": "string" }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" }, "accessTokenExpiresAt": { "type": "string", "format": "date-time" }, "refreshTokenExpiresAt": { "type": "string", "format": "date-time" } } } } } }, "400": { "description": "Invalid refresh token or provider configuration" }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/account-info": { "post": { "tags": ["auth v2"], "description": "Get the account info provided by the provider", "summary": "Get account info.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "accountId": { "type": "string", "description": "The provider given account id for which to get the account info" } }, "required": ["accountId"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "user": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "image": { "type": "string" }, "emailVerified": { "type": "boolean" } }, "required": ["id", "emailVerified"] }, "data": { "type": "object", "properties": {}, "additionalProperties": true } }, "required": ["user", "data"], "additionalProperties": false } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-in/anonymous": { "post": { "tags": ["auth v2"], "description": "Sign in anonymously", "summary": "Anonymous sign in.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "responses": { "200": { "description": "Sign in anonymously", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Session token" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["token", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-in/phone-number": { "post": { "tags": ["auth v2"], "description": "Use this endpoint to sign in with phone number", "summary": "Sign in with phone.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "phoneNumber": { "type": "string", "description": "Phone number to sign in. Eg: \"+1234567890\"" }, "password": { "type": "string", "description": "Password to use for sign in." }, "rememberMe": { "type": "boolean", "description": "Remember the session. Eg: true", "nullable": true } }, "required": ["phoneNumber", "password"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Session token" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["token", "user"] } } } }, "400": { "description": "Invalid phone number or password" }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/phone-number/send-otp": { "post": { "tags": ["auth v2"], "description": "Use this endpoint to send OTP to phone number", "summary": "Send OTP to phone number.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "phoneNumber": { "type": "string", "description": "Phone number to send OTP. Eg: \"+1234567890\"" } }, "required": ["phoneNumber"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/phone-number/verify": { "post": { "tags": ["auth v2"], "description": "Use this endpoint to verify phone number", "summary": "Verify phone OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "phoneNumber": { "type": "string", "description": "Phone number to verify. Eg: \"+1234567890\"" }, "code": { "type": "string", "description": "OTP code. Eg: \"123456\"" }, "disableSession": { "type": "boolean", "description": "Disable session creation after verification. Eg: false", "nullable": true }, "updatePhoneNumber": { "type": "boolean", "description": "Check if there is a session and update the phone number. Eg: true", "nullable": true } }, "required": ["phoneNumber", "code"] } } } }, "responses": { "200": { "description": "Phone number verified successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the verification was successful", "enum": [true] }, "token": { "type": "string", "nullable": true, "description": "Session token if session is created, null if disableSession is true or no session is created" }, "user": { "type": "object", "nullable": true, "properties": { "id": { "type": "string", "description": "Unique identifier of the user" }, "email": { "type": "string", "format": "email", "nullable": true, "description": "User's email address" }, "emailVerified": { "type": "boolean", "nullable": true, "description": "Whether the email is verified" }, "name": { "type": "string", "nullable": true, "description": "User's name" }, "image": { "type": "string", "format": "uri", "nullable": true, "description": "User's profile image URL" }, "phoneNumber": { "type": "string", "description": "User's phone number" }, "phoneNumberVerified": { "type": "boolean", "description": "Whether the phone number is verified" }, "createdAt": { "type": "string", "format": "date-time", "description": "Timestamp when the user was created" }, "updatedAt": { "type": "string", "format": "date-time", "description": "Timestamp when the user was last updated" } }, "required": [ "id", "phoneNumber", "phoneNumberVerified", "createdAt", "updatedAt" ], "description": "User object with phone number details, null if no user is created or found" } }, "required": ["status"] } } } }, "400": { "description": "Invalid OTP" }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/phone-number/forget-password": { "post": { "tags": ["auth v2"], "description": "Request OTP for password reset via phone number", "summary": "Reset password reset with phone(forget password flow).", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "phoneNumber": { "type": "string", "description": "The phone number which is associated with the user. Eg: \"+1234567890\"" } }, "required": ["phoneNumber"] } } } }, "responses": { "200": { "description": "OTP sent successfully for password reset", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the OTP was sent successfully", "enum": [true] } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/phone-number/request-password-reset": { "post": { "tags": ["auth v2"], "description": "Request OTP for password reset via phone number", "summary": "Request password reset with phone.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "phoneNumber": { "type": "string" } }, "required": ["phoneNumber"] } } } }, "responses": { "200": { "description": "OTP sent successfully for password reset", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the OTP was sent successfully", "enum": [true] } }, "required": ["status"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/phone-number/reset-password": { "post": { "tags": ["auth v2"], "description": "Reset password using phone number OTP", "summary": "Reset password with phone OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "otp": { "type": "string", "description": "The one time password to reset the password. Eg: \"123456\"" }, "phoneNumber": { "type": "string", "description": "The phone number to the account which intends to reset the password for. Eg: \"+1234567890\"" }, "newPassword": { "type": "string", "description": "The new password. Eg: \"new-and-secure-password\"" } }, "required": ["otp", "phoneNumber", "newPassword"] } } } }, "responses": { "200": { "description": "Password reset successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetPasswordResponse" } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/email-otp/send-verification-otp": { "post": { "tags": ["auth v2"], "description": "Send verification OTP", "summary": "Request email verification with OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address to send the OTP" }, "type": { "type": "string", "description": "Type of the OTP" } }, "required": ["email", "type"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/email-otp/check-verification-otp": { "post": { "operationId": "checkVerificationOtp", "tags": ["auth v2"], "description": "Check if a verification OTP is valid", "summary": "Check email OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address the OTP was sent to" }, "type": { "type": "string", "enum": [ "email-verification", "sign-in", "forget-password" ], "description": "Type of the OTP" }, "otp": { "type": "string", "description": "OTP to verify" } }, "required": ["email", "type", "otp"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/email-otp/verify-email": { "post": { "tags": ["auth v2"], "description": "Verify email with OTP", "summary": "Verify email with OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address to verify" }, "otp": { "type": "string", "description": "OTP to verify" } }, "required": ["email", "otp"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "boolean", "description": "Indicates if the verification was successful", "enum": [true] }, "token": { "type": "string", "nullable": true, "description": "Session token if autoSignInAfterVerification is enabled, otherwise null" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["status", "token", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/sign-in/email-otp": { "post": { "tags": ["auth v2"], "description": "Sign in with OTP", "summary": "Sign in with email OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address to sign in" }, "otp": { "type": "string", "description": "OTP sent to the email" } }, "required": ["email", "otp"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Session token for the authenticated session" }, "user": { "$ref": "#/components/schemas/User" } }, "required": ["token", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/forget-password/email-otp": { "post": { "tags": ["auth v2"], "description": "Send a password reset OTP to the user", "summary": "Request password reset with email OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address to send the OTP" } }, "required": ["email"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "description": "Indicates if the OTP was sent successfully" } } } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/email-otp/reset-password": { "post": { "tags": ["auth v2"], "description": "Reset user password with OTP", "summary": "Reset password with email OTP.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "description": "Email address to reset the password" }, "otp": { "type": "string", "description": "OTP sent to the email" }, "password": { "type": "string", "description": "New password" } }, "required": ["email", "otp", "password"] } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetPasswordResponse" } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Usually due to missing parameters, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "403": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Forbidden. You do not have permission to access this resource or to perform this action." }, "404": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Not Found. The requested resource was not found." }, "429": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Too Many Requests. You have exceeded the rate limit. Try again later." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/siwe/nonce": { "post": { "tags": ["auth v2"], "description": "Generate a nonce for Sign-In With Ethereum (SIWE) authentication", "summary": "Initialize SIWE login.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "walletAddress": { "type": "string", "description": "Ethereum wallet address (must be 42 characters starting with 0x)", "pattern": "^0[xX][a-fA-F0-9]{40}$", "minLength": 42, "maxLength": 42 }, "chainId": { "type": "number", "description": "Blockchain network chain ID (default: 1 for Ethereum mainnet)", "default": 1, "minimum": 1, "maximum": 2147483647 } }, "required": ["walletAddress"] } } } }, "responses": { "200": { "description": "Nonce generated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "nonce": { "type": "string", "description": "Cryptographically secure random nonce to be used in SIWE message" } }, "required": ["nonce"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Invalid wallet address format or parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. Due to missing or invalid authentication." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/siwe/verify": { "post": { "tags": ["auth v2"], "description": "Verify a signed SIWE message and authenticate the user", "summary": "Login with SIWE.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The SIWE message string that was signed", "minLength": 1 }, "signature": { "type": "string", "description": "The signature from the user's wallet", "minLength": 1 }, "walletAddress": { "type": "string", "description": "Ethereum wallet address (must be 42 characters starting with 0x)", "pattern": "^0[xX][a-fA-F0-9]{40}$", "minLength": 42, "maxLength": 42 }, "chainId": { "type": "number", "description": "Blockchain network chain ID (must match the Chain ID in SIWE message, default: 1)", "default": 1, "minimum": 1, "maximum": 2147483647 }, "walletClientType": { "type": "string", "description": "Type of wallet client used (e.g., 'Phantom', 'MetaMask')" }, "connectorType": { "type": "string", "description": "Type of connector used (e.g., 'injected', 'walletConnect')" } }, "required": ["message", "signature", "walletAddress"] } } } }, "responses": { "200": { "description": "Authentication successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Session token" }, "success": { "type": "boolean", "description": "Always true on successful authentication" }, "user": { "type": "object", "properties": { "id": { "type": "string", "description": "User ID" }, "walletAddress": { "type": "string", "description": "Ethereum wallet address" }, "chainId": { "type": "number", "description": "Chain ID used for authentication" } }, "required": ["id", "walletAddress", "chainId"] } }, "required": ["token", "success", "user"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Invalid parameters or email required when anonymous is disabled." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string", "description": "Error code (e.g., UNAUTHORIZED_INVALID_OR_EXPIRED_NONCE)" } }, "required": ["message"] } } }, "description": "Unauthorized. Invalid or expired nonce, invalid signature, or chainId mismatch." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. This is a problem with the server that you cannot fix." } } } }, "/link-siwe/nonce": { "post": { "tags": ["auth v2"], "summary": "Initialize SIWE link.", "description": "Generates a cryptographically secure nonce for creating a SIWE message to link a wallet to the current authenticated user. Requires active session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "walletAddress": { "type": "string", "description": "Ethereum wallet address (must be 42 characters starting with 0x)", "pattern": "^0[xX][a-fA-F0-9]{40}$", "minLength": 42, "maxLength": 42 }, "chainId": { "type": "number", "description": "Blockchain network chain ID (default: 1 for Ethereum mainnet)", "default": 1, "minimum": 1, "maximum": 2147483647 } }, "required": ["walletAddress"] } } } }, "responses": { "200": { "description": "Nonce generated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "nonce": { "type": "string", "description": "Cryptographically secure nonce to use in SIWE message" } }, "required": ["nonce"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Bad Request. Invalid wallet address format or parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": ["message"] } } }, "description": "Unauthorized. User must be logged in to link a wallet." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error." } } } }, "/link-siwe/verify": { "post": { "tags": ["auth v2"], "summary": "Verify and link SIWE wallet.", "description": "Verifies the SIWE signature and links the wallet to the currently authenticated user. Requires active session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "description": "The SIWE message string that was signed", "minLength": 1 }, "signature": { "type": "string", "description": "The signature from the user's wallet", "minLength": 1 }, "walletAddress": { "type": "string", "description": "Ethereum wallet address (must be 42 characters starting with 0x)", "pattern": "^0[xX][a-fA-F0-9]{40}$", "minLength": 42, "maxLength": 42 }, "chainId": { "type": "number", "description": "Blockchain network chain ID (must match the Chain ID in SIWE message, default: 1)", "default": 1, "minimum": 1, "maximum": 2147483647 }, "walletClientType": { "type": "string", "description": "Type of wallet client used (e.g., 'Phantom', 'MetaMask')" }, "connectorType": { "type": "string", "description": "Type of connector used (e.g., 'injected', 'walletConnect')" } }, "required": ["message", "signature", "walletAddress"] } } } }, "responses": { "200": { "description": "Wallet linked successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "description": "Whether the wallet was successfully linked" }, "walletAddress": { "type": "string", "description": "The checksummed Ethereum address that was linked" }, "chainId": { "type": "number", "description": "The blockchain network chain ID" }, "isPrimary": { "type": "boolean", "description": "Whether this is the user's primary wallet (first wallet linked)" }, "connectorType": { "type": "string", "description": "Type of connector used (e.g., 'injected', 'walletConnect')" }, "walletClientType": { "type": "string", "description": "Type of wallet client used (e.g., 'Phantom', 'MetaMask')" }, "ensName": { "type": "string", "description": "ENS name associated with the wallet (if available)" }, "ensAvatar": { "type": "string", "description": "ENS avatar URL (if available)" }, "message": { "type": "string", "description": "Optional informational message" } }, "required": [ "success", "walletAddress", "chainId", "isPrimary" ] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string", "enum": ["WALLET_ALREADY_LINKED", "BAD_REQUEST"], "description": "Error code indicating the type of error" } }, "required": ["message"] } } }, "description": "Bad Request. Wallet already linked to another account or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string", "enum": [ "UNAUTHORIZED", "INVALID_OR_EXPIRED_NONCE", "INVALID_SIGNATURE" ], "description": "Error code indicating the authentication failure reason" } }, "required": ["message"] } } }, "description": "Unauthorized. User not logged in, invalid/expired nonce, or invalid signature." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. Failed to link wallet." } } } }, "/link-siwe/list-wallets": { "get": { "tags": ["auth v2"], "summary": "List linked wallets.", "description": "Get all SIWE wallets linked to the authenticated user with full wallet metadata including primary status and chain information. Requires active session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "responses": { "200": { "description": "Wallets retrieved successfully", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Unique identifier for this wallet record" }, "userId": { "type": "string", "description": "User ID this wallet is linked to" }, "address": { "type": "string", "description": "Checksummed Ethereum wallet address", "pattern": "^0[xX][a-fA-F0-9]{40}$" }, "chainId": { "type": "number", "description": "Blockchain network chain ID" }, "isPrimary": { "type": "boolean", "description": "Whether this is the user's primary wallet" }, "createdAt": { "type": "string", "format": "date-time", "description": "Timestamp when the wallet was linked" } }, "required": [ "id", "userId", "address", "chainId", "isPrimary", "createdAt" ] } } } } }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Unauthorized. User is not authenticated." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error." } } } }, "/link-siwe/unlink": { "post": { "tags": ["auth v2"], "summary": "Unlink SIWE wallet.", "description": "Remove a linked wallet from the authenticated user account. If the wallet being unlinked is the primary wallet, another wallet will be automatically promoted to primary. Requires active session.", "security": [ { "auth_token": [], "projectKey": [] } ], "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "walletAddress": { "type": "string", "description": "Ethereum wallet address to unlink (must be 42 characters starting with 0x)", "pattern": "^0[xX][a-fA-F0-9]{40}$", "minLength": 42, "maxLength": 42 }, "chainId": { "type": "number", "description": "Blockchain network chain ID (default: 1 for Ethereum mainnet)", "default": 1, "minimum": 1, "maximum": 2147483647 } }, "required": ["walletAddress"] } } } }, "responses": { "200": { "description": "Wallet unlinked successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "description": "Indicates successful wallet unlinking" } }, "required": ["success"] } } } }, "400": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "code": { "type": "string", "enum": [ "BAD_REQUEST", "CANNOT_UNLINK_LAST_ACCOUNT", "WALLET_NOT_FOUND" ], "description": "Error code indicating the type of error" } }, "required": ["message"] } } }, "description": "Bad Request. Cannot unlink last authentication method, wallet not found, or invalid parameters." }, "401": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Unauthorized. User is not authenticated." }, "500": { "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } }, "description": "Internal Server Error. Failed to unlink wallet." } } } } } }