Domistra API Documentation
Property Management System REST API
Overview
Base URL
/api
The Domistra API is a RESTful API that allows you to manage properties, tenants, invoices, and utilities.
Response Format
All responses follow this format:
{
"success": true,
"data": { /* response data */ }
}
// Error response
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}
HTTP Status Codes
Authentication
JWT Token
Authentication uses JWT tokens stored in HttpOnly cookies. The token is automatically sent with each request.
CSRF Protection
All state-changing requests (POST, PUT, DELETE) require the X-CSRF-Token header.
Auth
Request Body
{
"username": "string",
"password": "string"
}
Response
{
"success": true,
"data": {
"csrf_token": "string",
"user": { "id": 1, "username": "admin", "full_name": "Admin User" }
}
}
Clears the authentication cookie.
Response
{
"success": true,
"data": {
"user": { "id": 1, "username": "admin", "full_name": "Admin" },
"csrf_token": "fresh_token"
}
}
Request Body
{
"current_password": "string",
"new_password": "string"
}
Password Requirements: 8+ characters, uppercase, lowercase, digit
Tenants
Query Parameters
| Name | Type | Description |
|---|---|---|
| is_active | boolean | Filter by active status |
Returns tenant with utility percentages.
Request Body
| Name | Type | Description |
|---|---|---|
| name * | string | Tenant name |
| address * | string | Address |
| city * | string | City |
| county * | string | County |
| string | Email address | |
| phone | string | Phone number |
| rent_amount_eur | number | Monthly rent (EUR) |
Same fields as create, all optional.
Soft delete - sets is_active to false.
Request Body
{
"percentages": {
"electricity": 25.5,
"gas": 30,
"water": 20
}
}
Invoices (Issued)
Query Parameters
| Name | Type | Description |
|---|---|---|
| tenant_id | number | Filter by tenant |
| type | string | rent, utility, generic |
| paid | boolean | Filter by paid status |
Returns the next available invoice number based on prefix and sequence.
Request Body
{
"tenant_id": 1,
"invoice_date": "2025-01-15",
"due_date": "2025-01-31",
"period_month": 1,
"period_year": 2025,
"exchange_rate": 4.97,
"additional_items": [
{ "description": "Parking", "unit_price": 50 }
]
}
Request Body
{
"tenant_id": 1,
"calculation_id": 5
}
Request Body
{
"client_name": "ABC Company",
"invoice_date": "2025-01-15",
"due_date": "2025-01-31",
"items": [
{
"description": "Service",
"quantity": 1,
"unit_price": 500,
"vat_rate": 19
}
]
}
Returns PDF file download.
Request Body
{
"paid_date": "2025-01-20" // optional, defaults to today
}
Only unpaid invoices can be deleted.
Received Invoices
Query Parameters
| Name | Type | Description |
|---|---|---|
| provider_id | number | Filter by provider |
| type | string | Utility type |
| paid | boolean | Filter by paid status |
Get invoices overlapping with a specific month.
Request Body
{
"provider_id": 1,
"invoice_number": "F-12345",
"invoice_date": "2025-01-10",
"due_date": "2025-01-25",
"amount": 450.50,
"utility_type": "electricity",
"period_start": "2024-12-01",
"period_end": "2024-12-31"
}
{ "paid_date": "2025-01-20" }
Meter Readings
Query Parameters
| Name | Type | Description |
|---|---|---|
| meter_id | number | Filter by meter |
Get all meter readings for a specific month.
Request Body
{
"meter_id": 1,
"reading_date": "2025-01-15",
"reading_value": 12500,
"period_month": 1,
"period_year": 2025
}
Consumption is calculated automatically from previous reading.
Request Body
{
"readings": [
{ "meter_id": 1, "reading_date": "2025-01-15", "reading_value": 12500, "period_month": 1, "period_year": 2025 },
{ "meter_id": 2, "reading_date": "2025-01-15", "reading_value": 8750, "period_month": 1, "period_year": 2025 }
]
}
Utility Calculations
Returns all utility calculations with invoice count.
Preview utility shares without saving. Includes meter difference data.
Request Body
{
"period_year": 2025,
"period_month": 1,
"overrides": {
"1": { "electricity": 25, "gas": 30 },
"2": { "electricity": 75, "gas": 70 }
}
}
Overrides are keyed by tenant_id with utility percentages.
Locks the calculation. Cannot be modified after finalization.
Meters
Returns all active meters with tenant names.
{
"name": "Meter 1",
"tenant_id": 1,
"is_general": false
}
Utility Providers
Query Parameters
| Name | Type | Description |
|---|---|---|
| type | string | electricity, gas, water, salubrity, internet, other |
| active | boolean | Filter by active status |
{
"name": "ENEL",
"type": "electricity",
"account_number": "123456789"
}
Company
Returns company details including balance.
{
"name": "My Company SRL",
"cui_cif": "RO12345678",
"address": "Str. Example 123",
"city": "Bucharest",
"county": "Sector 1",
"iban": "RO49AAAA1B31007593840000"
}
Profile
Returns user profile with company data.
{
"user": {
"full_name": "John Doe",
"email": "john@example.com"
},
"company": {
"invoice_prefix": "INV"
}
}
Dashboard
Returns key metrics: total revenue, pending invoices, active tenants, etc.
Query: ?months=12
Query: ?months=12
List of all overdue invoices.
Query: ?start_date=2025-01-01&end_date=2025-12-31
Exchange Rates
Fetches current rate from BNR (National Bank of Romania).
Date format: YYYY-MM-DD. Falls back to previous day if not available.
Activity Logs
Query Parameters
| Name | Type | Description |
|---|---|---|
| limit | number | Default: 50 |
| offset | number | Pagination offset |
| entity_type | string | Filter by entity |
| action_type | string | create, update, delete, payment |
Query: ?limit=10
Notifications
Query Parameters
| Name | Type | Description |
|---|---|---|
| include_read | boolean | Include read notifications |
| limit | number | Default: 20 |
Returns count of unread notifications.
Creates notifications for due/overdue invoices.
Marks all notifications as read.
Invoice Templates
Returns all invoice templates.
Sets the template as the default for new invoices.
Google Drive Backup
Returns URL to redirect user for Google authorization.
Returns whether Google Drive is connected and account info.
Creates database backup and uploads to Google Drive.
Downloads and restores database from backup.
Search
Query Parameters
| Name | Type | Description |
|---|---|---|
| q * | string | Search query (min 2 chars) |
Response
{
"success": true,
"data": {
"tenants": [...],
"invoices": [...],
"providers": [...],
"total_count": 15
}
}