API Reference / Authentication

Authentication API

Overview

The Authentication API allows you to manage user authentication within your applications. This includes user registration, login, password management, and session handling. All requests to this API must be authenticated using a valid API key.

Endpoints

Register User

Registers a new user with the platform. Requires a unique email and password.

Method

POST

Path

/auth/register

Request Body

{ "email": "[email protected]", "password": "securePassword" }

Response

{ "user_id": "123e4567-e89b-12d3-a456-426614174000", "email": "[email protected]" }

Login User

Authenticates a user and returns a session token.

Method

POST

Path

/auth/login

Request Body

{ "email": "[email protected]", "password": "securePassword" }

Response

{ "session_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user_id": "123e4567-e89b-12d3-a456-426614174000" }

Logout User

Invalidates the current user session.

Method

POST

Path

/auth/logout

Headers

{ "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

Response

{ "message": "Logged out successfully" }

Authentication

All endpoints require authentication via a Bearer token. Include the session token in the Authorization header of your requests.

Example

Here's an example of how to register a user using the API with a Python request: