Companies
The Company entity represents the organization that owns the ERP installation. Moon ERP operates as a single-company system -- there is one company record, and all data belongs to it. The company profile stores branding, contact information, fiscal configuration, and regional settings.
Purpose
- Store the company's identity (name, logo, tax number, commercial register)
- Configure regional defaults (currency, locale, timezone)
- Set the fiscal year start month
- Provide bilingual name and address fields (English and Arabic)
Entity Attributes
| Field | Type | Description |
|---|---|---|
id | integer | Primary key |
name | string | Company name (English) |
name_ar | string | Company name (Arabic) |
short_name | string? | Abbreviated name |
prefix | string | Unique tenant prefix (e.g., demo1) |
email | string | Contact email |
phone | string | Contact phone |
fax | string? | Fax number |
website | string? | Website URL |
address | string | Address (English) |
address_ar | string | Address (Arabic) |
city | string? | City |
country_code | string? | ISO country code (e.g., KW, EG) |
postal_code | string? | Postal code |
tax_number | string | Tax identification number |
commercial_register | string | Commercial registration number |
currency | string | Default currency (KWD or EGP) |
locale | string | Default locale (ar or en) |
timezone | string | Timezone (e.g., Asia/Kuwait) |
fiscal_year_start_month | integer | Month number (1-12) the fiscal year starts |
logo | string? | Path to uploaded logo file |
is_active | boolean | Whether the company is active |
settings | json? | Additional settings as JSON |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
Relationships
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/core/company | Get the current company profile |
PUT | /api/core/company | Update the company profile |
INFO
There is no POST or DELETE for companies. The company record is created during installation. Only the authenticated user's own company is accessible.
Request/Response Examples
GET /api/core/company
Retrieve the authenticated user's company profile.
bash
curl -X GET https://moon-erp.test/api/core/company \
-H "Accept: application/json" \
-H "Accept-Language: ar" \
-H "Authorization: Bearer {token}"dart
final response = await http.get(
Uri.parse('https://moon-erp.test/api/core/company'),
headers: {
'Accept': 'application/json',
'Accept-Language': 'ar',
'Authorization': 'Bearer $token',
},
);Response 200 OK
json
{
"data": {
"id": 1,
"name": "شركة القمر للتجارة",
"name_en": "Moon Trading Company",
"name_ar": "شركة القمر للتجارة",
"short_name": "Moon",
"prefix": "moon1",
"email": "info@moon-trading.com",
"phone": "+965-22334455",
"fax": "+965-22334456",
"website": "https://moon-trading.com",
"address": "شارع الخليج، مدينة الكويت",
"city": "Kuwait City",
"country_code": "KW",
"postal_code": "15000",
"tax_number": "TAX-KW-001",
"commercial_register": "CR-2024-12345",
"currency": "KWD",
"locale": "ar",
"timezone": "Asia/Kuwait",
"fiscal_year_start_month": 1,
"logo": null,
"is_active": true,
"created_at": "2026-01-01T00:00:00.000000Z",
"updated_at": "2026-02-10T08:30:00.000000Z"
}
}PUT /api/core/company
Update company profile fields. All fields are optional -- include only the fields you want to change.
bash
curl -X PUT https://moon-erp.test/api/core/company \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"name": "Moon Trading Co. Updated",
"name_ar": "شركة القمر للتجارة المحدثة",
"fiscal_year_start_month": 4,
"currency": "KWD"
}'dart
final response = await http.put(
Uri.parse('https://moon-erp.test/api/core/company'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer $token',
},
body: jsonEncode({
'name': 'Moon Trading Co. Updated',
'name_ar': 'شركة القمر للتجارة المحدثة',
'fiscal_year_start_month': 4,
'currency': 'KWD',
}),
);Response 200 OK
json
{
"data": {
"id": 1,
"name": "Moon Trading Co. Updated",
"name_en": "Moon Trading Co. Updated",
"name_ar": "شركة القمر للتجارة المحدثة",
"short_name": "Moon",
"prefix": "moon1",
"email": "info@moon-trading.com",
"phone": "+965-22334455",
"fax": "+965-22334456",
"website": "https://moon-trading.com",
"address": "Gulf Road, Kuwait City",
"city": "Kuwait City",
"country_code": "KW",
"postal_code": "15000",
"tax_number": "TAX-KW-001",
"commercial_register": "CR-2024-12345",
"currency": "KWD",
"locale": "ar",
"timezone": "Asia/Kuwait",
"fiscal_year_start_month": 4,
"logo": null,
"is_active": true,
"created_at": "2026-01-01T00:00:00.000000Z",
"updated_at": "2026-02-16T10:00:00.000000Z"
}
}Business Rules
- Single company -- there is exactly one company record per installation. It cannot be created or deleted via the API.
- Authenticated access only -- the company returned is always derived from
auth()->user()->company_id. - All fields optional on update -- the
PUTrequest usessometimesvalidation. Only provided fields are updated. - Currency restricted -- the
currencyfield only acceptsKWDorEGP. - Locale restricted -- the
localefield only acceptsaroren. - Fiscal year start -- must be an integer from 1 (January) to 12 (December).
- Prefix is immutable -- the
prefixfield cannot be changed via the update endpoint.