Skip to main content
This guide covers the authentication flows and REST API endpoints provided by django-allauth headless.

API Base URLs

The headless API provides two base URLs for different client types:
  • Browser clients: /_allauth/browser/v1/
  • App clients: /_allauth/app/v1/

Client Types

Browser Clients

For single-page applications on the same domain:
  • Uses Django sessions and CSRF tokens
  • Authentication state stored in session cookies
  • Requires X-CSRFToken header in POST requests
  • No additional token management needed

App Clients

For mobile apps or cross-origin SPAs:
  • Uses session tokens or JWT tokens
  • Authentication state stored in X-Session-Token header
  • No CSRF protection (stateless)
  • Requires token storage in the client

Authentication API Endpoints

Get Configuration

Retrieve API configuration and available features:
Response:

Get Session Status

Check current authentication status:
Response (authenticated):
Response (not authenticated):

User Registration (Signup)

Create Account

Response:
With ACCOUNT_EMAIL_VERIFICATION = "mandatory", the user must verify their email before logging in.

Verify Email

When the user clicks the link in their email, extract the key from the URL and verify:
Response:
Then confirm the verification:
Response:

Login Flows

Standard Login (Email/Password)

Success Response:
Error Response:

Login by Code (Passwordless)

Request a login code:
Response:
Confirm the code:
Response:

Password Reset

Request Password Reset

Response:

Verify Reset Key

Response:

Reset Password

Response:

Logout

Response:

JWT Token Management

When using JWT token strategy, tokens are returned in the meta field:

Initial Authentication

After successful login or signup:

Using Access Tokens

Include the access token in the Authorization header:

Refreshing Tokens

When the access token expires, use the refresh token:
Response:

Account Management

Get Email Addresses

Response:

Add Email Address

Change Password

Response:

Reauthentication

For sensitive operations, request reauthentication:
Response:

Securing Your API Endpoints

Django REST Framework

Use the provided authentication classes:

Django Ninja

Use the provided security classes:

Error Handling

All error responses follow this format:
Common HTTP status codes:
  • 200 - Success
  • 400 - Bad request (validation error)
  • 401 - Not authenticated
  • 403 - Forbidden (e.g., signup disabled)
  • 409 - Conflict (e.g., invalid flow state)
  • 429 - Rate limited
  • 500 - Internal server error

Next Steps