API Reference
Welcome to the Salonnz API documentation. This comprehensive guide covers all RESTful API endpoints for integrating with the Salonnz platform.
Base URL
Development: http://localhost:8000/api
Production: https://api.salonnz.com/api
Authentication
Salonnz uses JWT (JSON Web Tokens) for API authentication.
Obtaining a Token
POST /api/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"status": true,
"token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"user": {
"id": 1,
"name": "John Doe",
"email": "user@example.com"
}
}
Using the Token
Include the token in the Authorization header:
GET /api/booking/get-services
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...
Multi-Tenant Routing
Salonnz is a multi-tenant platform. Specify the tenant using one of these methods:
1. URL Parameter
GET /api/booking/get-services?slug=harry-spa
2. Custom Header
GET /api/booking/get-services
X-Client-Slug: harry-spa
3. Authentication Token
The tenant is automatically determined from the authenticated user's token.
Request Format
All requests must use application/json content type unless uploading files.
POST /api/endpoint
Content-Type: application/json
{
"key": "value"
}
File Uploads
Use multipart/form-data for file uploads:
POST /api/business-settings/update
Content-Type: multipart/form-data
name=Business Name
logo=@/path/to/logo.png
Response Format
All API responses follow this structure:
Success Response
{
"status": true,
"message": "Operation successful",
"data": {
// Response data
}
}
Error Response
{
"status": false,
"message": "Error description",
"errors": {
"field_name": [
"Validation error message"
]
}
}
HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 201 | Created - Resource created successfully |
| 400 | Bad Request - Invalid request parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn't exist |
| 422 | Unprocessable Entity - Validation failed |
| 500 | Server Error - Internal server error |
Rate Limiting
API requests are rate-limited to ensure fair usage:
- Anonymous: 60 requests per minute
- Authenticated: 120 requests per minute
- Admin: 300 requests per minute
Rate limit headers are included in responses:
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 115
X-RateLimit-Reset: 1638360000
Pagination
List endpoints support pagination using these parameters:
GET /api/appointments?page=2&per_page=20
Response:
{
"status": true,
"data": [...],
"meta": {
"current_page": 2,
"per_page": 20,
"total": 156,
"last_page": 8
},
"links": {
"first": "http://api.salonnz.com/api/appointments?page=1",
"last": "http://api.salonnz.com/api/appointments?page=8",
"prev": "http://api.salonnz.com/api/appointments?page=1",
"next": "http://api.salonnz.com/api/appointments?page=3"
}
}
Filtering & Sorting
Many endpoints support filtering and sorting:
GET /api/services?category=haircut&sort=price&order=asc
Webhooks
Salonnz can send webhook notifications for important events. See the Webhooks section for details.
API Endpoints Overview
Booking
- GET
/booking/get-services- Get available services - GET
/booking/get-slot- Get available time slots - POST
/booking/save-booking- Create a booking
Full Booking API Documentation →
Customers
- POST
/customer/register- Register new customer - POST
/customer/login- Customer login - GET
/customer/profile- Get customer profile
Full Customer API Documentation →
Payments
- POST
/payment/create-order- Create payment intent - POST
/payment/update-status- Update payment status - POST
/payment/create-session- Create setup intent
Full Payment API Documentation →
Services
- GET
/services/list- Get all services - POST
/services/create- Create new service (Admin) - PUT
/services/update/{id}- Update service (Admin)
Full Services API Documentation →
Testing with Postman
Import the included Postman collection for easy API testing:
Import: /path/to/Salonnz-api-collection.json
The collection includes:
- Pre-configured environments (Development, Production)
- All endpoint examples
- Automated token management
- Sample request bodies
Code Examples
JavaScript/Fetch
const response = await fetch('http://localhost:8000/api/booking/get-services', {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Client-Slug': 'harry-spa',
'Content-Type': 'application/json'
}
});
const data = await response.json();
PHP/cURL
$ch = curl_init('http://localhost:8000/api/booking/get-services');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_TOKEN',
'X-Client-Slug: harry-spa',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
Python/Requests
import requests
headers = {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Client-Slug': 'harry-spa'
}
response = requests.get(
'http://localhost:8000/api/booking/get-services',
headers=headers
)
data = response.json()
Need Help?
- Error Codes - Detailed error code reference
- Webhooks - Event notifications
- Authentication - Advanced auth topics
Next: Explore specific endpoint documentation using the sidebar navigation.