Authentication
Homatic uses Laravel Sanctum — Bearer tokens for API access.
Base URLs
| API | URL |
|---|---|
| Tenant | https://{subdomain}.homatic.io/api/v1 |
| Central | https://api.homatic.io/api/central/v1 |
| Portal | https://api.homatic.io/api |
Tenant login
POST /api/v1/auth/login
Host: acme.homatic.io
Content-Type: application/json
{
"email": "admin@example.com",
"password": "secret"
}
Response 200:
{
"data": {
"user": { "id": 1, "name": "Admin", "email": "admin@example.com" },
"token": "1|abcdef..."
},
"message": "Logged in."
}
Central login (Super Admin)
POST /api/central/v1/auth/login
Content-Type: application/json
{
"email": "superadmin@homatic.com",
"password": "secret"
}
Portal login
POST /api/portal/login
Content-Type: application/json
{
"email": "viewer@example.com",
"password": "secret",
"subdomain": "acme"
}
Required headers
Authorization: Bearer {token}
Accept: application/json
Content-Type: application/json
For requests on a central host without subdomain:
X-Tenant-Subdomain: acme
Current user
GET /api/v1/auth/me
Authorization: Bearer {token}
Logout
POST /api/v1/auth/logout
Authorization: Bearer {token}
cURL example
curl -X POST https://acme.homatic.io/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@example.com","password":"secret"}'
curl https://acme.homatic.io/api/v1/devices \
-H "Authorization: Bearer 1|abcdef..." \
-H "Accept: application/json"
Common errors
| Code | Meaning |
|---|---|
| 401 | Invalid or expired token |
| 403 | Insufficient role permissions |
| 422 | Validation failed |