Automation Guide
Introduction
This guide provides a comprehensive overview of how to automate your efsta Cloud Portal operations using our REST API. The API follows a hierarchical structure where Organizations contain Companies, which contain Locations, which contain Registers.
System Hierarchy
🏢 Organization (O)
├── 🏪 Company (C)
├── 📍 Location (L)
└── 🖥️ Register (E)
Key Concepts
- API Key Authentication: All requests require a valid API key
- Permission-Based Access: Operations require specific permissions
- Hierarchical Structure: Parent-child relationships between entities
Authentication & Setup
1. Get Your API Key
Before starting, ensure you have a valid API key for authentication. If you do not yet have an API key, you can request one from an organization via the portal.
2. Test Authentication
GET /User/Active
Headers:
api_key: your-api-key-here
3. Create Organization
Start by creating the top-level organization structure. Since this only happens once per country, it can also be done via the portal.
POST /Organization
Content-Type: application/json
api_key: your-api-key-here
{
"ownerCompanyId": 1,
"name": "My Retail Chain",
"address": "123 Business Street",
"city": "Berlin",
"zip": "10115",
"countryCode": "DE",
"invoiceEmailAddress": "billing@mycompany.com"
}
🔐 Required Permission: ManageCompany on the owner company
Onboarding Process
Step 1: Create Company
Creates a company under your organization.
POST /Company
Content-Type: application/json
api_key: your-api-key-here
{
"ownerCompanyId": {organizationId},
"name": "Store Location Berlin",
"address": "456 Store Avenue",
"city": "Berlin",
"zip": "10115",
"countryCode": "DE",
"taxId": "DE123456789",
"taxIdType": "VAT",
"invoiceEmailAddress": "berlin@mycompany.com"
}
🔐 Required Permission: ManageCompany on the organization
Step 2: Create Location
Creates a location under your company.
POST /Location
Content-Type: application/json
api_key: your-api-key-here
{
"ownerCompanyId": {companyId},
"name": "Main Store Berlin",
"address": "456 Store Avenue",
"city": "Berlin",
"zip": "10115",
"countryCode": "DE"
}
🔐 Required Permission: ManageCompany on the company
Step 3: Add Company Contacts
Set up contact persons for the company.
POST /Company/Contact
Content-Type: application/json
api_key: your-api-key-here
{
"companyId": {companyId},
"realName": "John Doe",
"emailAddress": "john.doe@mycompany.com",
"phoneNumber": "+49 30 12345678",
"contactType": "TechnicalContact"
}
Contact Types: InvoiceContact, TechnicalContact, CommercialContact, ElsterContact
Step 4: Invite Users
Invite users to access the company with specific roles.
POST /User/Invite
Content-Type: application/json
api_key: your-api-key-here
{
"companyId": {companyId},
"emailAddress": "manager@mycompany.com",
"role": "ADMIN"
}
Permissions are inherited downwards in the hierarchy.
Available Roles:
- ADMIN: Full system access (ReadCompany, ManageCompany, ManageRegister, ManageUsers, ManageBill, Purchase, ExportData, ReadRegister)
- EDITOR: Management without purchasing (ReadCompany, ManageCompany, ManageRegister, ManageUsers, ManageBill, ExportData, ReadRegister)
- DATAFISCAL: Basic company management and export fiscal data (ReadCompany, ManageCompany, ReadRegister, ExportData)
- DATAVIEWER: Read-only with export fiscal data (ReadCompany, ReadRegister, ExportData)
- FISCAL: Basic company management (ReadCompany, ManageCompany, ReadRegister)
- VIEWER: Read-only access (ReadCompany, ReadRegister)
Step 5: Purchase Products (Optional)
If you need to purchase products for your setup.
POST /Purchase
Content-Type: application/json
api_key: your-api-key-here
{
"companyId": {companyId},
"invoiceCompanyId": {companyId},
"recipientEmailAddress": "admin@mycompany.com",
"recipientEmailRealName": "Admin User",
"customerReference": "AUTO-SETUP-2024",
"items": [
{
"id": {productId},
"amount": 1,
"amountAssignment": "Register"
}
]
}
For more information about the items, please contact efsta support.
Management Operations
Viewing Data
🌳 Get Company Tree Structure
GET /Company/{companyId}/Tree?getOrganizations=true&getCompanies=true&getLocations=true&getRegisters=true
api_key: your-api-key-here
🔍 Search for Entities
PUT /Company/Search
Content-Type: application/json
api_key: your-api-key-here
{
"searchText": "Berlin",
"limit": 50,
"offset": 0,
"orderByField": "name",
"orderDescending": false
}
🔔 Get Company Notifications
GET /Company/{companyId}/Notifications?languageCode=en-US
api_key: your-api-key-here