Default
Default endpoints that are included with Better Auth by default. These endpoints are not part of any plugin.
Social Sign In
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Callback URL to redirect to after the user has signed in
Callback URL to redirect to if an error happens
OAuth2 provider to use
Disable automatic redirection to the provider. Useful for handling the redirection yourself
ID token from the provider to sign in the user with id token
Array of scopes to request from the provider. This will override the default scopes passed.
Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider
The login hint to use for the authorization code request
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-in/social" \ -H "Content-Type: application/json" \ -d '{ "provider": "string" }'{
"redirect": false,
"token": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/get-session
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/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": true,
"image": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"username": "string",
"displayUsername": "string",
"twoFactorEnabled": true,
"role": "string",
"banned": true,
"banReason": "string",
"banExpires": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/sign-out
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-out" \ -H "Content-Type: application/json" \ -d '{}'{
"success": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/sign-up/email
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The name of the user
The email of the user
The password of the user
The URL to use for email verification callback
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-up/email" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "email": "string", "password": "string" }'{
"token": "string",
"user": {
"id": "string",
"email": "[email protected]",
"name": "string",
"image": "http://example.com",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/sign-in/email
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Email of the user
Password of the user
Callback URL to use as a redirect for email verification
If this is false, the session will not be remembered. Default is true.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/sign-in/email" \ -H "Content-Type: application/json" \ -d '{ "email": "string", "password": "string" }'{
"redirect": false,
"token": "string",
"url": null,
"user": {
"id": "string",
"email": "string",
"name": "string",
"image": "string",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/forget-password
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The email address of the user to send a password reset email to
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
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/forget-password" \ -H "Content-Type: application/json" \ -d '{ "email": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/reset-password
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new password to set
The token to reset the password
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/reset-password" \ -H "Content-Type: application/json" \ -d '{ "newPassword": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/verify-email
Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
The token to verify the email
The URL to redirect to after email verification
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/verify-email?token=string"{
"user": {
"id": "string",
"email": "string",
"name": "string",
"image": "string",
"emailVerified": true,
"createdAt": "string",
"updatedAt": "string"
},
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/send-verification-email
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The email to send the verification email to
The URL to use for email verification callback
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/send-verification-email" \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]" }'{
"status": true
}{
"message": "Verification email isn't enabled"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/change-email
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new email to set
The URL to redirect to after email verification
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/change-email" \ -H "Content-Type: application/json" \ -d '{ "newEmail": "string" }'{
"status": true,
"message": "Email updated"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/change-password
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new password to set
The current password
Revoke all other sessions
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/change-password" \ -H "Content-Type: application/json" \ -d '{ "newPassword": "string", "currentPassword": "string" }'{
"token": "string",
"user": {
"id": "string",
"email": "[email protected]",
"name": "string",
"image": "http://example.com",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/update-user
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The name of the user
The image of the user
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/update-user" \ -H "Content-Type: application/json" \ -d '{}'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/delete-user
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/delete-user" \ -H "Content-Type: application/json" \ -d '{}'{
"success": true,
"message": "User deleted"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/reset-password/{token}
Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
The URL to redirect the user to reset their password
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/reset-password/{token}"{
"token": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/list-sessions
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/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"
}
]{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/revoke-session
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The token to revoke
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/revoke-session" \ -H "Content-Type: application/json" \ -d '{ "token": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/revoke-sessions
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/revoke-sessions" \ -H "Content-Type: application/json" \ -d '{}'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/revoke-other-sessions
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/revoke-other-sessions" \ -H "Content-Type: application/json" \ -d '{}'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/link-social
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The URL to redirect to after the user has signed in
The OAuth2 provider to use
Additional scopes to request from the provider
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/link-social" \ -H "Content-Type: application/json" \ -d '{ "provider": "string" }'{
"url": "string",
"redirect": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/list-accounts
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/list-accounts"[
{
"id": "string",
"provider": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
]{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/delete-user/callback
Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/delete-user/callback"{
"success": true,
"message": "User deleted"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/unlink-account
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/unlink-account" \ -H "Content-Type: application/json" \ -d '{ "providerId": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/refresh-token
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The provider ID for the OAuth provider
The account ID associated with the refresh token
The user ID associated with the account
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/refresh-token" \ -H "Content-Type: application/json" \ -d '{ "providerId": "string" }'{
"tokenType": "string",
"idToken": "string",
"accessToken": "string",
"refreshToken": "string",
"accessTokenExpiresAt": "2019-08-24T14:15:22Z",
"refreshTokenExpiresAt": "2019-08-24T14:15:22Z"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/get-access-token
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The provider ID for the OAuth provider
The account ID associated with the refresh token
The user ID associated with the account
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/get-access-token" \ -H "Content-Type: application/json" \ -d '{ "providerId": "string" }'{
"tokenType": "string",
"idToken": "string",
"accessToken": "string",
"refreshToken": "string",
"accessTokenExpiresAt": "2019-08-24T14:15:22Z",
"refreshTokenExpiresAt": "2019-08-24T14:15:22Z"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/ok
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/ok"{
"ok": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/error
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
text/html
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/error""string"{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}