API Endpoints¶
Complete reference for all dj-rest-auth endpoints.
Authentication Endpoints¶
Login¶
Authenticate a user and obtain a token or JWT.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
username |
string | Yes* | Username |
email |
string | Yes* | Email address |
password |
string | Yes | Password |
*Either username or email is required, depending on your allauth configuration.
When JWT_AUTH_RETURN_EXPIRATION = True:
{
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"access_expiration": "2026-02-15T12:30:00Z",
"refresh_expiration": "2026-02-22T12:00:00Z",
"user": {
"pk": 1,
"username": "testuser",
"email": "test@example.com",
"first_name": "Test",
"last_name": "User"
}
}
Error Responses:
// 400 Bad Request - Invalid credentials
{
"non_field_errors": ["Unable to log in with provided credentials."]
}
// 400 Bad Request - Missing fields
{
"password": ["This field is required."]
}
Logout¶
Revoke the authentication token and/or clear JWT cookies.
Request Headers:
| Header | Value |
|---|---|
Authorization |
Token {key} or Bearer {jwt} |
Response:
GET Method
To allow logout via GET request, set ACCOUNT_LOGOUT_ON_GET = True in your Django settings. This is not recommended for security reasons.
JWT Blacklisting
If using JWT with rest_framework_simplejwt.token_blacklist in INSTALLED_APPS, the refresh token will be blacklisted on logout.
User Details¶
Retrieve or update the authenticated user's information.
Request Headers:
| Header | Value |
|---|---|
Authorization |
Token {key} or Bearer {jwt} |
GET Response:
{
"pk": 1,
"username": "testuser",
"email": "test@example.com",
"first_name": "Test",
"last_name": "User"
}
PUT/PATCH Request Body:
| Field | Type | Description |
|---|---|---|
username |
string | Username (if allowed) |
first_name |
string | First name |
last_name |
string | Last name |
Read-only Fields
By default, pk and email are read-only. To customize which fields are editable, override the USER_DETAILS_SERIALIZER.
Password Management¶
Password Reset¶
Request a password reset email.
Request Body:
Response:
Security Note
The response is always successful even if the email doesn't exist, to prevent email enumeration attacks.
Password Reset Confirm¶
Complete the password reset using the token from the email.
Request Body:
{
"uid": "MQ",
"token": "c5p4t0-a1b2c3d4e5f6g7h8i9j0",
"new_password1": "newSecurePassword123",
"new_password2": "newSecurePassword123"
}
Response:
Error Response:
// 400 Bad Request - Invalid token
{
"token": ["Invalid value"]
}
// 400 Bad Request - Passwords don't match
{
"new_password2": ["The two password fields didn't match."]
}
Password Change¶
Change password for authenticated user.
Request Headers:
| Header | Value |
|---|---|
Authorization |
Token {key} or Bearer {jwt} |
Request Body:
{
"old_password": "currentPassword",
"new_password1": "newSecurePassword123",
"new_password2": "newSecurePassword123"
}
Old Password Field
The old_password field is only required when OLD_PASSWORD_FIELD_ENABLED = True.
Response:
JWT Endpoints¶
These endpoints are only available when USE_JWT = True.
Token Verify¶
Verify that a JWT token is valid.
Request Body:
Response:
200 OK- Token is valid (empty response body)401 Unauthorized- Token is invalid or expired
Token Refresh¶
Obtain a new access token using a refresh token.
Request Body:
Cookie-based Refresh
When using JWT_AUTH_HTTPONLY = True, the refresh token is automatically read from cookies. No request body needed.
Response:
Registration Endpoints¶
These endpoints require dj_rest_auth.registration in INSTALLED_APPS.
Register¶
Create a new user account.
Request Body:
{
"username": "newuser",
"email": "newuser@example.com",
"password1": "securePassword123",
"password2": "securePassword123"
}
Response:
Error Response:
// 400 Bad Request
{
"username": ["A user with that username already exists."],
"email": ["A user is already registered with this e-mail address."],
"password1": ["This password is too common."]
}
Verify Email¶
Verify user's email address using the key from verification email.
Request Body:
Response:
Email Verification URL
You need to configure the email verification URL in your frontend. Add this to your urls.py:
Resend Email Verification¶
Resend the email verification link.
Request Body:
Response:
Social Authentication Endpoints¶
See Social Authentication Guide for setup instructions.
Social Login¶
Authenticate using an OAuth provider.
Request Body:
| Field | Type | Description |
|---|---|---|
access_token |
string | OAuth access token |
code |
string | OAuth authorization code |
id_token |
string | OpenID Connect ID token (some providers) |
Provider-specific Fields
Different providers may require different fields. See the Social Auth Guide for provider-specific examples.
MFA Endpoints¶
See MFA Guide for setup, login flow, and endpoint contracts.
MFA Verify¶
TOTP Activate¶
TOTP Deactivate¶
MFA Status¶
Recovery Codes¶
Passkey Endpoints¶
These endpoints require dj_rest_auth.passkeys in INSTALLED_APPS. See Passkeys Guide for setup and flow details.
Passkey Register Begin¶
Authentication required. Returns WebAuthn PublicKeyCredentialCreationOptions.
Passkey Register Complete¶
Authentication required. Verifies and stores the credential (201 Created).
Passkey Login Begin¶
No authentication required. Returns WebAuthn PublicKeyCredentialRequestOptions + session_id.
Passkey Login Complete¶
No authentication required. Verifies the assertion and returns a standard auth response.
List Passkeys¶
Authentication required. Returns all passkeys for the authenticated user.
Passkey Detail¶
GET /dj-rest-auth/passkeys/{id}/
PATCH /dj-rest-auth/passkeys/{id}/
DELETE /dj-rest-auth/passkeys/{id}/
Authentication required. Retrieve, rename, or delete an individual passkey.
Response Status Codes¶
| Code | Description |
|---|---|
200 OK |
Request successful |
201 Created |
Resource created (registration) |
204 No Content |
Request successful, no response body |
400 Bad Request |
Invalid request data |
401 Unauthorized |
Authentication required or failed |
403 Forbidden |
Permission denied |
404 Not Found |
Resource not found |
429 Too Many Requests |
Rate limit exceeded |
Throttling¶
All authentication views use the dj_rest_auth throttle scope. Configure in your settings: