cURL
Authentication
Login
POST
cURL
Overview
This endpoint authenticates users and initiates a login session. It validates user credentials (email and password) and returns authentication tokens or session information upon successful authentication.Request Details
Required Fields
-
email (string, required): The user’s registered email address
- Must be a valid email format
-
Example:
user@example.com
-
password (string, required): The user’s account password
- Should meet the application’s password requirements
- Transmitted securely over HTTPS
Request Headers
-
Content-Type: application/json- Indicates JSON payload -
Accept: application/json- Expects JSON response -
apikey: xxx- Can be generated from the admin dashboard
Expected Response
Success Response (200 OK)
Returns authentication credentials and user information:- Authentication token(s) for subsequent API requests
- User profile data
- Session expiration details
Error Responses
- 400 Bad Request: Missing or invalid email/password format
- 401 Unauthorized: Invalid credentials
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server-side error
Authentication Flow
- User submits email and password via POST request
- Server validates credentials against stored user data
-
Upon successful validation:
- Authentication token is generated
- Session is created
- Token and user data are returned
- Client stores token for authenticated requests
- Token is included in subsequent API calls (typically in Authorization header)
Usage Notes & Best Practices
- Security: Always use HTTPS in production to protect credentials in transit
- Token Storage: Store authentication tokens securely (e.g., httpOnly cookies, secure storage)
- Error Handling: Never expose detailed error messages that could aid attackers
- Password Requirements: Ensure passwords meet security standards (length, complexity)
- Session Management: Implement proper logout functionality to invalidate tokens

