Core
Email and password sign-up and sign-in, sessions, the user's profile and linked accounts.
Sign in with a social provider
application/json- body
callbackURL?stringCallback URL to redirect to after the user has signed in
newUserCallbackURL?stringerrorCallbackURL?stringCallback URL to redirect to if an error happens
provider*|stringdisableRedirect?booleanDisable automatic redirection to the provider. Useful for handling the redirection yourself
idToken?scopes?array<string>Array of scopes to request from the provider. This will override the default scopes passed.
requestSignUp?booleanExplicitly request sign-up. Useful when disableImplicitSignUp is true for this provider
loginHint?stringThe login hint to use for the authorization code request
additionalParams?Extra query parameters to append to the provider authorization URL (e.g. Cognito identity_provider, Google hd).
additionalData?Success - Returns session details (idToken branch) or an authorize URL (redirect branch)
application/json- response
Returns session details when idToken is provided, or an authorize URL otherwise
token?stringuser?url?stringredirect*booleancurl -X POST 'https://auth.example.com/api/auth/sign-in/social' \ -H 'Content-Type: application/json' \ -d '{ "provider": "apple"}'{ "token": "string", "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }, "url": "string", "redirect": true}id*stringcode?stringerror?stringdevice_id?stringerror_description?stringstate?stringuser?stringiss?stringBad Request. Usually due to missing parameters, or invalid parameters.
application/json- response
message*stringcurl -X GET 'https://auth.example.com/api/auth/callback/string'{ "message": "string"}id*stringcode?stringerror?stringdevice_id?stringerror_description?stringstate?stringuser?stringiss?stringapplication/json- body
code?stringerror?stringdevice_id?stringerror_description?stringstate?stringuser?stringiss?stringBad Request. Usually due to missing parameters, or invalid parameters.
application/json- response
message*stringcurl -X POST 'https://auth.example.com/api/auth/callback/string' \ -H 'Content-Type: application/json' \ -d '{}'{ "message": "string"}Get the current session
disableRefresh?booleanDisable session refresh. Useful for checking session status, without updating the session
Success
application/json- response
session*user*curl -X GET 'https://auth.example.com/api/auth/get-session'{ "session": { "id": "string", "expiresAt": "2019-08-24T14:15:22Z", "token": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "ipAddress": "string", "userAgent": "string", "userId": "string", "impersonatedBy": "string", "activeOrganizationId": "string" }, "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }}Get the current session
disableRefresh?booleanDisable session refresh. Useful for checking session status, without updating the session
application/json- body
Success
application/json- response
session*user*curl -X POST 'https://auth.example.com/api/auth/get-session' \ -H 'Content-Type: application/json' \ -d '{}'{ "session": { "id": "string", "expiresAt": "2019-08-24T14:15:22Z", "token": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "ipAddress": "string", "userAgent": "string", "userId": "string", "impersonatedBy": "string", "activeOrganizationId": "string" }, "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }}Sign out the current user
application/json- body
callbackURL?stringThe URL to redirect to after provider logout
disableRedirect?booleanReturn the provider logout URL without redirecting
state?stringState to pass to the provider logout endpoint
Success
application/json- response
success?booleanurl?stringProvider logout URL when RP-initiated logout is available
redirect?booleanWhether the client should redirect to the provider logout URL
curl -X POST 'https://auth.example.com/api/auth/sign-out' \ -H 'Content-Type: application/json' \ -d '{}'{ "success": true, "url": "string", "redirect": true}Sign up a user using email and password
application/json- body
name*stringThe name of the user
email*stringThe email of the user
password*stringThe password of the user
image?stringThe profile image URL of the user
callbackURL?stringThe URL to use for email verification callback
rememberMe?booleanIf this is false, the session will not be remembered. Default is true.
username?stringdisplayUsername?stringSuccessfully created user
application/json- response
token?stringAuthentication token for the session
user*curl -X POST 'https://auth.example.com/api/auth/sign-up/email' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "email": "string", "password": "string"}'{ "token": "string", "user": { "id": "string", "email": "user@example.com", "name": "string", "image": "http://example.com", "emailVerified": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }}Sign in with email and password
application/json- body
email*stringEmail of the user
password*stringPassword of the user
callbackURL?stringCallback URL to use as a redirect for email verification
rememberMe?booleanIf this is false, the session will not be remembered. Default is true.
Success - Returns either session details or redirect URL
application/json- response
Session response when idToken is provided
redirect*falsefalsetoken*stringSession token
url?stringuser*curl -X POST 'https://auth.example.com/api/auth/sign-in/email' \ -H 'Content-Type: application/json' \ -d '{ "email": "string", "password": "string"}'{ "redirect": false, "token": "string", "url": "string", "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }}Reset the password for a user
token?stringapplication/json- body
newPassword*stringThe new password to set
token?stringThe token to reset the password
Success
application/json- response
status?booleancurl -X POST 'https://auth.example.com/api/auth/reset-password' \ -H 'Content-Type: application/json' \ -d '{ "newPassword": "string"}'{ "status": true}Verify the current user's password
application/json- body
password*stringThe password to verify
Success
application/json- response
status?booleancurl -X POST 'https://auth.example.com/api/auth/verify-password' \ -H 'Content-Type: application/json' \ -d '{ "password": "string"}'{ "status": true}Verify the email of the user
token*stringThe token to verify the email
callbackURL?stringThe URL to redirect to after email verification
Success
application/json- response
user*status*booleanIndicates if the email was verified successfully
curl -X GET 'https://auth.example.com/api/auth/verify-email?token=string'{ "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }, "status": true}Send a verification email to the user
application/json- body
email*stringThe email to send the verification email to
callbackURL?stringThe URL to use for email verification callback
Success
application/json- response
status?booleanIndicates if the email was sent successfully
curl -X POST 'https://auth.example.com/api/auth/send-verification-email' \ -H 'Content-Type: application/json' \ -d '{ "email": "string"}'{ "status": true}application/json- body
newEmail*stringThe new email address to set must be a valid email address
callbackURL?stringThe URL to redirect to after email verification
Email change request processed successfully
application/json- response
user?status*booleanIndicates if the request was successful
message?stringStatus message of the email change process
"Email updated""Verification email sent"curl -X POST 'https://auth.example.com/api/auth/change-email' \ -H 'Content-Type: application/json' \ -d '{ "newEmail": "string"}'{ "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }, "status": true, "message": "Email updated"}Change the password of the user
application/json- body
newPassword*stringThe new password to set
currentPassword*stringThe current password is required
revokeOtherSessions?booleanMust be a boolean value
Password successfully changed
application/json- response
token?stringNew session token if other sessions were revoked
user*curl -X POST 'https://auth.example.com/api/auth/change-password' \ -H 'Content-Type: application/json' \ -d '{ "newPassword": "string", "currentPassword": "string"}'{ "token": "string", "user": { "id": "string", "email": "user@example.com", "name": "string", "image": "http://example.com", "emailVerified": true, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }}Update the current session
application/json- body
[key: string]?unknownSuccess
application/json- response
session?curl -X POST 'https://auth.example.com/api/auth/update-session' \ -H 'Content-Type: application/json' \ -d '{ "property1": null, "property2": null}'{ "session": { "id": "string", "expiresAt": "2019-08-24T14:15:22Z", "token": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "ipAddress": "string", "userAgent": "string", "userId": "string", "impersonatedBy": "string", "activeOrganizationId": "string" }}Update the current user
application/json- body
name?stringThe name of the user
image?stringThe image of the user
username?stringdisplayUsername?stringSuccess
application/json- response
user?curl -X POST 'https://auth.example.com/api/auth/update-user' \ -H 'Content-Type: application/json' \ -d '{}'{ "user": { "id": "string", "name": "string", "email": "string", "emailVerified": false, "image": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "role": "string", "banned": false, "banReason": "string", "banExpires": "2019-08-24T14:15:22Z", "username": "string", "displayUsername": "string", "twoFactorEnabled": false }}Delete the user
application/json- body
callbackURL?stringThe callback URL to redirect to after the user is deleted
password?stringThe user's password. Required if session is not fresh
token?stringThe deletion verification token
User deletion processed successfully
application/json- response
success*booleanIndicates if the operation was successful
message*stringStatus message of the deletion process
"User deleted""Verification email sent"curl -X POST 'https://auth.example.com/api/auth/delete-user' \ -H 'Content-Type: application/json' \ -d '{}'{ "success": true, "message": "User deleted"}Send a password reset email to the user
application/json- body
email*stringThe email address of the user to send a password reset email to
redirectTo?stringThe 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
Success
application/json- response
status?booleanmessage?stringcurl -X POST 'https://auth.example.com/api/auth/request-password-reset' \ -H 'Content-Type: application/json' \ -d '{ "email": "string"}'{ "status": true, "message": "string"}Redirects the user to the callback URL with the token
token*stringThe token to reset the password
callbackURL*stringThe URL to redirect the user to reset their password
Success
application/json- response
token?stringcurl -X GET 'https://auth.example.com/api/auth/reset-password/string?callbackURL=string'{ "token": "string"}List all active sessions for the user
Success
application/json- response
[index: integer]?curl -X GET 'https://auth.example.com/api/auth/list-sessions'[ { "id": "string", "expiresAt": "2019-08-24T14:15:22Z", "token": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "ipAddress": "string", "userAgent": "string", "userId": "string", "impersonatedBy": "string", "activeOrganizationId": "string" }]Revoke a single session
application/json- body
token*stringThe token to revoke
Success
application/json- response
status*booleanIndicates if the session was revoked successfully
curl -X POST 'https://auth.example.com/api/auth/revoke-session' \ -H 'Content-Type: application/json' \ -d '{ "token": "string"}'{ "status": true}Revoke all sessions for the user
application/json- body
Success
application/json- response
status*booleanIndicates if all sessions were revoked successfully
curl -X POST 'https://auth.example.com/api/auth/revoke-sessions' \ -H 'Content-Type: application/json' \ -d '{}'{ "status": true}Revoke all other sessions for the user except the current one
application/json- body
Success
application/json- response
status*booleanIndicates if all other sessions were revoked successfully
curl -X POST 'https://auth.example.com/api/auth/revoke-other-sessions' \ -H 'Content-Type: application/json' \ -d '{}'{ "status": true}Link a social account to the user
application/json- body
callbackURL?stringThe URL to redirect to after the user has signed in
provider*|stringidToken?requestSignUp?booleanscopes?array<string>Additional scopes to request from the provider
errorCallbackURL?stringThe URL to redirect to if there is an error during the link process
disableRedirect?booleanDisable automatic redirection to the provider. Useful for handling the redirection yourself
loginHint?stringThe login hint to use for the authorization code request
additionalParams?Extra query parameters to append to the provider authorization URL (e.g. Cognito identity_provider, Google hd).
additionalData?Success
application/json- response
url?stringThe authorization URL to redirect the user to
redirect*booleanIndicates if the user should be redirected to the authorization URL
status?booleancurl -X POST 'https://auth.example.com/api/auth/link-social' \ -H 'Content-Type: application/json' \ -d '{ "provider": "apple"}'{ "url": "string", "redirect": true, "status": true}List all accounts linked to the user
Success
application/json- response
[index: integer]?curl -X GET 'https://auth.example.com/api/auth/list-accounts'[ { "id": "string", "providerId": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "accountId": "string", "userId": "string", "scopes": [ "string" ] }]Unlink an account
application/json- body
accountId*stringThe Better Auth account ID to unlink
Success
application/json- response
status?booleancurl -X POST 'https://auth.example.com/api/auth/unlink-account' \ -H 'Content-Type: application/json' \ -d '{ "accountId": "string"}'{ "status": true}Refresh the access token using a refresh token
application/json- body
accountId*stringThe Better Auth account ID
userId?stringThe user ID associated with the account
Access token refreshed successfully
application/json- response
tokenType?stringidToken?stringaccessToken?stringrefreshToken?stringaccessTokenExpiresAt?stringdate-timerefreshTokenExpiresAt?stringdate-timecurl -X POST 'https://auth.example.com/api/auth/refresh-token' \ -H 'Content-Type: application/json' \ -d '{ "accountId": "string"}'{ "tokenType": "string", "idToken": "string", "accessToken": "string", "refreshToken": "string", "accessTokenExpiresAt": "2019-08-24T14:15:22Z", "refreshTokenExpiresAt": "2019-08-24T14:15:22Z"}Get a valid access token, doing a refresh if needed
application/json- body
accountId*stringThe Better Auth account ID
userId?stringThe user ID associated with the account
A Valid access token
application/json- response
tokenType?stringidToken?stringaccessToken?stringaccessTokenExpiresAt?stringdate-timecurl -X POST 'https://auth.example.com/api/auth/get-access-token' \ -H 'Content-Type: application/json' \ -d '{ "accountId": "string"}'{ "tokenType": "string", "idToken": "string", "accessToken": "string", "accessTokenExpiresAt": "2019-08-24T14:15:22Z"}Get the account info provided by the provider
Success
application/json- response
user*account*data*curl -X GET 'https://auth.example.com/api/auth/account-info'{ "user": { "name": "string", "email": "string", "image": "string", "emailVerified": true }, "account": { "id": "string", "providerId": "string", "accountId": "string" }, "data": {}}Check if the API is working
API is working
application/json- response
ok*booleanIndicates if the API is working
curl -X GET 'https://auth.example.com/api/auth/ok'{ "ok": true}Displays an error page
Success
response?stringtext/htmlThe HTML content of the error page
curl -X GET 'https://auth.example.com/api/auth/error'"string"