🏢 Xbooking API

An innovative new platform for discovering and booking premium workspaces

Work from anywhere, anytime.

About Xbooking

Xbooking was born from a simple frustration: finding the perfect workspace shouldn't be complicated. Our innovative new platform is designed to connect professionals with their ideal work environments as we expand across cities worldwide.

We combine cutting-edge technology with human-centered design to deliver seamless experiences for both workspace seekers and providers. From AI-powered recommendations to real-time availability, we're building the future of flexible work.

⚡ Instant Booking

Book your perfect workspace in seconds with our streamlined booking process.

🤖 AI-Powered Matching

Get personalized workspace recommendations based on your preferences and work style.

🔒 Secure Payments

Safe and secure payment processing with multiple payment options including Paystack and Flutterwave.

📱 Mobile First

Access XBooking anywhere, anytime with our responsive mobile-first design.

🌍 Global Network

Access premium workspaces in 50+ cities worldwide with consistent quality standards.

📊 Usage Analytics

Track your workspace usage patterns and optimize your productivity with detailed insights.

API Documentation & Testing

Base URL

http://127.0.0.1:8000/api

All API endpoints are relative to this base URL

User Registration

POST /user/register/

Description: Register a new user account with email verification and automatic avatar generation.

Request Body:

{ "full_name": "John Doe", "email": "john.doe@example.com", "password": "SecurePass123!", "confirm_password": "SecurePass123!" }

Password Requirements:

  • At least 8 characters long
  • Contains at least one uppercase letter
  • Contains at least one lowercase letter
  • Contains at least one digit
  • Contains at least one special character (!@#$%^&*()_+-=[]{}|;:,.<>?)

🧪 Test Registration Endpoint

Success Response (201):

{ "success": true, "message": "Registration was successful", "user": { "user_id": "123e4567-e89b-12d3-a456-426614174000", "user_email": "john.doe@example.com", "full_name": "John Doe", "avatar_url": "https://api.dicebear.com/9.x/personas/svg?seed=john.doe%40example.com" }, "token": { "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." } }

Error Response (400):

{ "success": false, "message": "Registration Failed", "error": { "email": ["Email already exists"], "password": ["Password must be at least 8 characters long"] } }

User Login

POST /user/login/

Description: Authenticate user credentials and return access tokens for API access.

Request Body:

{ "email": "john.doe@example.com", "password": "SecurePass123!" }

🧪 Test Login Endpoint

Success Response (200):

{ "success": true, "message": "Login was successful", "user": { "user_id": "123e4567-e89b-12d3-a456-426614174000", "user_email": "john.doe@example.com", "full_name": "John Doe", "avatar_url": "https://api.dicebear.com/9.x/personas/svg?seed=john.doe%40example.com" }, "token": { "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..." } }

Error Response (400):

{ "success": false, "message": "Login failed", "errors": { "non_field_errors": ["Invalid email or password"] } }

Google Auth

POST /user/auth/google/

Description: Authenticate or register a user using a Google OAuth code. Returns JWT tokens and user info.

Request Body:

{ "code": "GOOGLE_OAUTH_CODE" }

🧪 Test Google Auth Endpoint

Success Response (200):

{ "success": true, "message": "Login successful", "user": { "user_id": "123e4567-e89b-12d3-a456-426614174000", "user_email": "john.doe@example.com", "full_name": "John Doe", "avatar_url": "https://lh3.googleusercontent.com/a-/AOh14Gg..." }, "token": { "access": "access_token_here", "refresh": "refresh_token_here" } }

Profile

GET /user/profile/

Description: Retrieve the authenticated user's profile information. Requires JWT authentication.

Headers:

Authorization: Bearer <access_token>

🧪 Test Profile Endpoint

Forget Password

POST /user/forget-password/

Description: Request a password reset by sending a verification code to the user's email address.

Request Body:

{ "email": "john.doe@example.com" }

🧪 Test Forget Password Endpoint

Resend Password Reset Code

POST /user/resend-password-reset/

Description: Resend the password reset verification code if the previous one expired or was not received.

Request Body:

{ "email": "john.doe@example.com" }

🧪 Test Resend Password Reset Endpoint

Password Reset Confirm

POST /user/password-reset-confirm/

Description: Confirm password reset using the verification code and set a new password.

Request Body:

{ "email": "john.doe@example.com", "verification_code": "123456", "new_password": "NewSecurePass123!", "confirm_new_password": "NewSecurePass123!" }

🧪 Test Password Reset Confirm Endpoint

Workspace API Documentation

Manage workspaces, branches, and spaces for your organization. Build hierarchical workspace structures with role-based access control.

Create Workspace

POST /workspace/workspaces/create/

Description: Create a new workspace. The authenticated user becomes the workspace admin.

Permissions: Requires authenticated user

Request Body:

{ "name": "Tech Startup Workspace", "description": "Our main office workspace", "address": "123 Business St, Tech City" }

🧪 Test Create Workspace

Success Response (201):

{ "success": true, "message": "Workspace created successfully", "data": { "workspace_id": "123e4567-e89b-12d3-a456-426614174000", "name": "Tech Startup Workspace", "description": "Our main office workspace", "address": "123 Business St, Tech City", "admin_id": "user-id-here", "created_at": "2025-01-15T10:30:00Z" } }

List Workspaces

GET /workspace/workspaces/

Description: List all workspaces where the user is an admin or member.

Permissions: Requires authenticated user

Headers:

Authorization: Bearer <access_token>

🧪 Test List Workspaces

Success Response (200):

{ "success": true, "message": "Workspaces retrieved successfully", "data": [ { "workspace_id": "123e4567-e89b-12d3-a456-426614174000", "name": "Tech Startup Workspace", "description": "Our main office workspace", "admin_id": "user-id" } ] }

Get Workspace Detail

GET /workspace/workspaces/<workspace_id>/

Description: Retrieve detailed information about a specific workspace including branches and members.

Permissions: Requires authenticated user who is workspace admin or member

🧪 Test Get Workspace Detail

Create Branch

POST /workspace/branches/create/

Description: Create a new branch within a workspace. Only workspace admin can create branches.

Permissions: Workspace admin only

Request Body:

{ "workspace_id": "123e4567-e89b-12d3-a456-426614174000", "name": "Main Branch", "address": "123 Business St", "manager_id": "manager-user-id" }

🧪 Test Create Branch

List Branches

GET /workspace/branches/?workspace_id=<workspace_id>

Description: List all branches in a workspace. Optimized response with essential info only.

Permissions: Requires authenticated user

Query Parameters: workspace_id (required) - Filter branches by workspace

🧪 Test List Branches

Create Space

POST /workspace/spaces/create/

Description: Create a new space within a branch. Space represents a bookable unit (desk, room, etc).

Permissions: Workspace admin or branch manager

Request Body:

{ "branch_id": "branch-id-here", "name": "Private Office", "space_type": "private_office", "capacity": 4, "hourly_rate": 50.00, "daily_rate": 350.00, "monthly_rate": 5000.00, "amenities": ["WiFi", "Parking", "Coffee"] }

🧪 Test Create Space

List Spaces

GET /workspace/spaces/?branch_id=<branch_id>

Description: List all spaces in a branch. Lightweight response optimized for list views.

Permissions: Requires authenticated user

Query Parameters: branch_id (required) - Filter spaces by branch

🧪 Test List Spaces

Admin Registration

POST /workspace/admin/register/

Description: Register a new workspace admin with business email validation. Admin emails must be from a business domain (not Gmail, Yahoo, etc.).

Permissions: Public - Anyone can register

Request Body:

{ "full_name": "John Admin", "email": "john@company.com", "password": "SecurePass123!", "confirm_password": "SecurePass123!" }

🧪 Test Admin Registration

Admin Login

POST /workspace/admin/login/

Description: Login as admin user and receive JWT tokens for API access.

Permissions: Public - Anyone can login

Request Body:

{ "email": "john@company.com", "password": "SecurePass123!" }

🧪 Test Admin Login

Admin Onboarding

POST /workspace/admin/onboarding/

Description: Complete admin onboarding by creating initial workspace. Can only be called once per admin during onboarding process.

Permissions: Requires JWT authentication

Request Body:

{ "workspace_name": "My Company", "workspace_description": "Main workspace for our company", "company_email": "info@company.com", "company_phone": "+1234567890", "company_address": "123 Business St", "company_city": "San Francisco", "company_country": "USA" }

🧪 Test Admin Onboarding

Check Onboarding Status

GET /workspace/admin/onboarding-status/

Description: Check the admin's onboarding progress and see completed steps.

Permissions: Requires JWT authentication

Headers:

Authorization: Bearer <access_token>

🧪 Test Check Onboarding Status

Admin Profile

GET /workspace/admin/profile/

Description: Get authenticated admin's profile including workspace and membership counts.

Permissions: Requires JWT authentication

Headers:

Authorization: Bearer <access_token>

🧪 Test Get Admin Profile

Invite Member to Workspace

POST /workspace/workspaces/<workspace_id>/members/invite/

Description: Invite an existing user to join workspace as manager or staff. User must already have an account.

Permissions: Workspace admin only

Request Body:

{ "email": "staff@example.com", "role": "manager" }

Valid Roles: manager, staff, user

🧪 Test Invite Member

List Workspace Members

GET /workspace/workspaces/<workspace_id>/members/

Description: List all members of a workspace including the admin.

Permissions: Workspace members only

Headers:

Authorization: Bearer <access_token>

🧪 Test List Members

Update Member Role

PUT /workspace/workspaces/<workspace_id>/members/<member_id>/

Description: Update a member's role or status in the workspace.

Permissions: Workspace admin only

Request Body:

{ "role": "staff", "is_active": true }

🧪 Test Update Member Role

Remove Member from Workspace

DELETE /workspace/workspaces/<workspace_id>/members/<member_id>/

Description: Remove a member from the workspace.

Permissions: Workspace admin only

🧪 Test Remove Member

📚 Complete Workspace Setup Workflow

Step-by-step guide to set up a complete workspace structure:

  1. Create Workspace: POST to /workspace/workspaces/create/ to create main workspace
  2. Create Branches: POST to /workspace/branches/create/ to add office locations
  3. Create Spaces: POST to /workspace/spaces/create/ to add bookable units (desks, rooms, etc.)
  4. List Workspaces: GET /workspace/workspaces/ to view all your workspaces
  5. Get Workspace Details: GET /workspace/workspaces/<id>/ to view full hierarchy
  6. List Branches: GET /workspace/branches/ with workspace_id filter
  7. List Spaces: GET /workspace/spaces/ with branch_id filter

Example cURL Commands:

# Create a workspace curl -X POST http://127.0.0.1:8000/api/workspace/workspaces/create/ \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "My Company Workspace", "description": "Main office", "address": "123 Main St, City" }' # Get workspace details (includes all branches and members) curl -X GET http://127.0.0.1:8000/api/workspace/workspaces/WORKSPACE_ID/ \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" # List branches in a workspace curl -X GET "http://127.0.0.1:8000/api/workspace/branches/?workspace_id=WORKSPACE_ID" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" # Create a space with pricing tiers curl -X POST http://127.0.0.1:8000/api/workspace/spaces/create/ \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "branch_id": "BRANCH_ID", "name": "Meeting Room A", "space_type": "meeting_room", "capacity": 8, "hourly_rate": 75.00, "daily_rate": 500.00, "monthly_rate": 8000.00, "amenities": ["Projector", "Whiteboard", "Coffee"] }'

🔐 Authentication

Most API endpoints require authentication. Include the access token in the Authorization header:

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...

Token Expiry: Access tokens expire after 30 minutes. Use the refresh token to obtain new access tokens when needed.

📋 Response Format

All API responses follow a consistent format:

  • success: Boolean indicating if the request was successful
  • message: Human-readable message describing the result
  • data/user: Response data (varies by endpoint)
  • error/errors: Error details (only present on failure)

📊 HTTP Status Codes

  • 200 OK: Successful request
  • 201 Created: Resource created successfully
  • 400 Bad Request: Invalid request data
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Access denied
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server error