Skip to content

Services & Queries

The ERGANI API provides several query services for retrieving employer information, branch details, employee status, and system parameters. These services use the ExecuteService endpoint.

Available Services

ServiceClassCodeDescription
Employer InfoEmployerInfoEX_BASE_01Employer details and card sector status
Branch InfoBranchInfoEX_BASE_02All employer branches with addresses
Parameter LookupParameterLookupEX_BASE_03System parameter values (nationalities, specialties, etc.)
Monthly StatusMonthlyStatusEX_BASE_04Employee status for a specific month
Workforce StatusWorkforceStatusEX_BASE_05Current workforce status with employment details
Acceptance StatusAcceptanceStatusEX_BASE_06Essential terms acceptance status from myErgani

Employer Info (EX_BASE_01)

Retrieves basic information about the authenticated employer.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\EmployerInfo;

$service = new EmployerInfo($accessToken, $environment);
$employer = $service->handle();

echo $employer->id;            // Employer ID
echo $employer->tin;           // Tax ID (AFM)
echo $employer->name;          // Legal name
echo $employer->ame;           // AME number
echo $employer->isInCardSector; // true if work cards required

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani($accessToken);
$employer = $ergani->getEmployerInfo();

Response: EmployerResponse

PropertyTypeDescription
idstring|nullEmployer ID in ERGANI
tinstring|nullTax identification number (AFM)
namestring|nullLegal name (Επωνυμία)
amestring|nullAME registration number
isInCardSectorbool|nullWhether employer is in card sector

Card Sector

If isInCardSector is true, the employer must submit work cards (check-in/check-out) for employees.


Branch Info (EX_BASE_02)

Retrieves all registered branches for the employer.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\BranchInfo;

$service = new BranchInfo($accessToken, $environment);
$branches = $service->handle();

// Iterate all branches
foreach ($branches as $aa => $branch) {
    echo "Branch {$aa}: {$branch->address}";
}

// Find branch by sequence number
$headquarters = $branches->find('0');  // or $branches['0']

// Search by address
$athensOffices = $branches->search('ΑΘΗΝΑ');

// For HTML dropdowns
$dropdown = $branches->toDropdown();  // ['0' => 'Λ. Αλεξάνδρας 1', ...]

// Check if branch exists
if ($branches->has('1')) {
    // Branch 1 exists
}

// Get first/last
$first = $branches->first();
$last = $branches->last();

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani($accessToken);
$branches = $ergani->getBranches();

Response: BranchCollection of BranchResponse

PropertyTypeDescription
aastring|nullBranch sequence number (0 = HQ)
addressstring|nullBranch address

Collection Methods

MethodReturn TypeDescription
find($aa)BranchResponse|nullFind by sequence number
has($aa)boolCheck if branch exists
search($query)BranchCollectionSearch by address (case-insensitive)
toDropdown()arrayGet [aa => address] for dropdowns
first()BranchResponse|nullGet first branch
last()BranchResponse|nullGet last branch
count()intTotal branch count

Parameter Lookup (EX_BASE_03)

Retrieves system parameter values used in form fields. Essential for populating dropdowns with valid codes.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\ParameterLookup;

$service = new ParameterLookup($accessToken, $environment);

// Get work time types
$workTimeTypes = $service->handle(ParameterLookup::WORK_TIME_TYPE);

// Find specific code
$workType = $workTimeTypes->find('ΕΡΓ');  // or $workTimeTypes['ΕΡΓ']
echo $workType->description;  // "ΕΡΓΑΣΙΑ"

// Search by description
$results = $workTimeTypes->search('ΕΡΓΑΣΙΑ');

// Check if code exists
if ($workTimeTypes->has('ΕΡΓ')) {
    // Code exists
}

// For HTML dropdowns
$dropdown = $workTimeTypes->toDropdown();  // ['ΕΡΓ' => 'ΕΡΓΑΣΙΑ', ...]

// Get all codes
$codes = $workTimeTypes->codes();  // ['ΕΡΓ', 'ΥΠΕ', ...]

// Filter with callback
$filtered = $workTimeTypes->filter(
    fn($param) => $param->extra === 'ΕΡΓΑΣΙΑ-ΕΡΓΑΣΙΑ'
);

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;
use OxygenSuite\OxygenErgani\Http\Services\ParameterLookup;

$ergani = new Ergani($accessToken);
$params = $ergani->getParameters(ParameterLookup::WORK_TIME_TYPE);

Available Parameter Types

ConstantParameterDescription
SEPESepeLabor Inspection Service codes
OAEDOaedDYPA/OAED service codes
STAKODStakodActivity codes (KAD)
KALLIKRATIS_COMMUNITYKallikratisKoinothtaCommunity codes
KALLIKRATIS_MUNICIPALITYKallikratisDhmosMunicipality codes
KALLIKRATIS_REGIONAL_UNITKallikratisPerifereiaEnothtaRegional unit codes
KALLIKRATIS_REGIONKallikratisPerifereiaRegion codes
NATIONALITYNationalityNationality codes
ID_TYPETyposTaytotitasID document types
RESIDENCE_PERMITResidencePermitResidence permit types
DOYDoyTax office codes
EDUCATION_LEVELEpipedoMorfosisEducation level codes
SUBJECT_AREASubjectAreaEducation subject areas
SUBJECT_GROUPSubjectGroupEducation subject groups
EDUCATION_AGENCYEducationAgencyEducation agency codes
LANGUAGELanguageLanguage codes
SPECIALTYStep92Employee specialty codes
OAED_PROGRAMProgramaOaedDYPA program codes
TRAFFIC_SPECIALTIESTraficEmploymentSpecialtiesTraffic employment specialties
OVERTIME_REASONOvertimeAitiologiaOvertime reason codes
TERMINATION_REASONLogosApolyshsTermination reason codes
BANKBankBank codes
RAPID_EXCEPTION_REASONRapidExceptionReasonRapid card exception reasons
SINGLE_PARENT_CASEOneParentCaseSingle parent case codes
WORK_CARD_DELAY_REASONWorkCardDelayReasonWork card delay reasons
WORK_TIME_TYPEWorkTimeTypeWork time type codes
SIXTH_DAY_KADSixthDayKADSixth day work activity codes
CHANGE_TYPETypeMetabolonEmployment change type codes
PRIMARY_INSURANCEForeisKyriasAsfalisisPrimary insurance codes
SUPPLEMENTARY_INSURANCEForeisEpikourikisAsfalisisSupplementary insurance codes

Response: ParameterCollection of ParameterResponse

PropertyTypeDescription
codestring|nullParameter code
descriptionstring|nullHuman-readable description
extrastring|nullAdditional information

Collection Methods

MethodReturn TypeDescription
find($code)ParameterResponse|nullFind by code
has($code)boolCheck if code exists
search($query)ParameterCollectionSearch descriptions (case-insensitive)
toDropdown()arrayGet [code => description] for dropdowns
codes()arrayGet all codes
filter($callback)ParameterCollectionFilter with callback
first()ParameterResponse|nullGet first parameter
last()ParameterResponse|nullGet last parameter
count()intTotal parameter count

Examples

Populate Nationality Dropdown

php
$nationalities = $service->handle(ParameterLookup::NATIONALITY);

// For HTML select
echo '<select name="nationality">';
foreach ($nationalities->toDropdown() as $code => $description) {
    echo "<option value=\"{$code}\">{$description}</option>";
}
echo '</select>';

Find Specialty Code

php
$specialties = $service->handle(ParameterLookup::SPECIALTY);

// Search for programmers
$programmers = $specialties->search('ΠΡΟΓΡΑΜΜΑΤΙΣΤ');

foreach ($programmers as $specialty) {
    echo "{$specialty->code}: {$specialty->description}\n";
}

Get Tax Office for AFM

php
$taxOffices = $service->handle(ParameterLookup::DOY);
$office = $taxOffices->find('1234');

if ($office) {
    echo "Tax Office: {$office->description}";
}

Monthly Status (EX_BASE_04)

Retrieves comprehensive monthly employment status for all employees, including work days, leave balances, overtime, and insurance data.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\MonthlyStatus;

$service = new MonthlyStatus($accessToken, $environment);
$employees = $service->handle(2025, 1);  // January 2025

foreach ($employees as $employee) {
    echo "{$employee->lastName} {$employee->firstName}\n";
    echo "AFM: {$employee->afm}, AMKA: {$employee->amka}\n";
    echo "Specialty: {$employee->specialty}\n";
    echo "Salary: {$employee->salary}\n";
    echo "Work days: {$employee->workDays}, Remote: {$employee->remoteWorkDays}\n";
    echo "Annual leave taken: {$employee->annualLeaveDays} days\n";
    echo "---\n";
}

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani($accessToken);
$employees = $ergani->getMonthlyStatus(2025, 1);  // January 2025

Parameters

ParameterTypeDescription
$yearintReport year (e.g., 2025)
$monthintReport month (1-12)

Response: Array of EmployeeStatusResponse

The response includes comprehensive employee data organized into categories:

Identification

PropertyTypeDescription
employerIdstring|nullEmployer ID
branchAastring|nullBranch sequence number
yearint|nullReport year
monthint|nullReport month
employeeTypestring|nullEmployee type (e.g., "Εξαρτημένη")
afmstring|nullTax ID
amkastring|nullSocial security number
amastring|nullIKA insurance number
lastNamestring|nullLast name
firstNamestring|nullFirst name
fatherNamestring|nullFather's name
motherNamestring|nullMother's name
birthDateDateTimeInterface|nullBirth date
sexstring|nullSex
nationalitystring|nullNationality code with description
maritalStatusstring|nullMarital status
childrenCountint|nullNumber of children
educationLevelstring|nullEducation level code with description

Employment Details

PropertyTypeDescription
characterizationstring|nullEmployee type (Υπάλληλος/Εργάτης)
employmentRelationstring|nullEmployment relation (Αορίστου/Ορισμένου)
employmentStatusstring|nullFull/Part time (Πλήρης/Μερική)
specialtystring|nullSpecialty code with description
salarystring|nullGross salary (Greek format)
weeklyHoursstring|nullWeekly work hours
hourlyWagestring|nullHourly wage
programstring|nullEmployment program
responsiblestring|nullResponsible person
hiringDateDateTimeInterface|nullHiring date

Work Days

PropertyTypeDescription
workDaysint|nullDays worked on-site
remoteWorkDaysint|nullDays worked remotely
restDaysint|nullRest/repo days
nonWorkingDaysint|nullNon-working days

Leave Days

PropertyTypeDescription
annualLeaveDaysint|nullAnnual leave days
bloodDonationLeaveDaysint|nullBlood donation leave
examLeaveDaysint|nullExam leave
unpaidLeaveDaysint|nullUnpaid leave
maternityLeaveDaysint|nullMaternity leave
maternityProtectionDaysint|nullMaternity protection days
paternityLeaveDaysint|nullPaternity leave
childCareLeaveDaysint|nullChild care leave
parentalLeaveDaysint|nullParental leave
sicknessDaysint|nullSick days
otherLeaveDaysint|nullOther leave types

See EmployeeStatusResponse for the complete list of 30+ leave type fields.

Overtime & Work Card

PropertyTypeDescription
overtimeMinutesint|nullTotal overtime minutes
overtimeDaysint|nullDays with overtime
workCardDaysint|nullDays with work card entries
sundayHolidayDaysint|nullSunday/holiday work days
sundayHolidayCardDaysint|nullSunday/holiday card days

Insurance Totals

PropertyTypeDescription
totalInsuredLeaveDaysint|nullTotal insured leave days
totalInsuredSicknessDaysint|nullTotal insured sickness days

Example: Generate Monthly Report

php
$service = new MonthlyStatus($accessToken, $environment);

// Get current month's employees
$now = new DateTime();
$employees = $service->handle(
    (int) $now->format('Y'),
    (int) $now->format('n')
);

// Calculate totals
$totalWorkDays = array_sum(array_map(fn($e) => $e->workDays ?? 0, $employees));
$totalRemoteDays = array_sum(array_map(fn($e) => $e->remoteWorkDays ?? 0, $employees));
$totalLeaveDays = array_sum(array_map(fn($e) => $e->annualLeaveDays ?? 0, $employees));

echo "Total employees: " . count($employees) . "\n";
echo "Total work days: {$totalWorkDays}\n";
echo "Total remote days: {$totalRemoteDays}\n";
echo "Total leave days taken: {$totalLeaveDays}\n";

Example: Find Employees on Leave

php
$employees = $service->handle(2025, 1);

$onLeave = array_filter($employees, fn($e) =>
    ($e->annualLeaveDays ?? 0) > 0 ||
    ($e->sicknessDays ?? 0) > 0 ||
    ($e->maternityLeaveDays ?? 0) > 0
);

foreach ($onLeave as $emp) {
    echo "{$emp->lastName}: ";
    if ($emp->annualLeaveDays > 0) echo "Annual: {$emp->annualLeaveDays}d ";
    if ($emp->sicknessDays > 0) echo "Sick: {$emp->sicknessDays}d ";
    echo "\n";
}

Workforce Status (EX_BASE_05)

Retrieves current workforce status for all employees or a specific employee. Returns detailed employment information including identity, contract terms, insurance, and work organization settings.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\WorkforceStatus;

$service = new WorkforceStatus($accessToken, $environment);

// Get all employees
$employees = $service->handle();

// Get specific employee by AFM
$employees = $service->handle('123456789');

foreach ($employees as $employee) {
    echo "{$employee->lastName} {$employee->firstName}\n";
    echo "AFM: {$employee->afm}, AMKA: {$employee->amka}\n";
    echo "Specialty: {$employee->step}\n";
    echo "Salary: {$employee->grossSalary}\n";
    echo "Weekly hours: {$employee->weeklyHours}\n";
    echo "Hired: {$employee->hiringDate->format('d/m/Y')}\n";
}

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani($accessToken);

// All employees
$employees = $ergani->getWorkforceStatus();

// Specific employee
$employees = $ergani->getWorkforceStatus('123456789');

Parameters

ParameterTypeRequiredDescription
$tinstring|nullNoEmployee tax ID to filter by

Response: Array of WorkforceStatusResponse

Employee Identification

PropertyTypeDescription
afmstring|nullTax identification number
lastNamestring|nullLast name
firstNamestring|nullFirst name
fatherNamestring|nullFather's name
motherNamestring|nullMother's name
birthDateDateTimeInterface|nullBirth date
sexstring|nullSex with code
nationalitystring|nullNationality code with description
maritalStatusstring|nullMarital status with code
childrenCountint|nullNumber of children
doystring|nullTax office code with description
amkastring|nullSocial security number
amIkastring|nullIKA insurance number

Identity Document

PropertyTypeDescription
idTypestring|nullID document type
idNumberstring|nullID document number
idIssuingAuthoritystring|nullIssuing authority
idIssueDateDateTimeInterface|nullIssue date
idExpiryDateDateTimeInterface|nullExpiry date

Employment Details

PropertyTypeDescription
branchAaint|nullBranch sequence number
effectiveDateDateTimeInterface|nullEffective date of current status
hiringDateDateTimeInterface|nullHiring date
stepstring|nullSpecialty code with description
characterizationstring|nullEmployee type (Υπάλληλος/Εργάτης)
employmentRelationstring|nullEmployment relation
employmentStatusstring|nullFull/part-time status
weeklyHoursstring|nullWeekly work hours
grossSalarystring|nullGross salary
hourlyWagestring|nullHourly wage
experienceYearsint|nullYears of experience
trialPeriodstring|nullTrial period status
educationLevelstring|nullEducation level
primaryInsurancestring|nullPrimary insurance provider
supplementaryInsurancestring|nullSupplementary insurance provider

Digital Work Time Organization

PropertyTypeDescription
digitalWorkTimeOrganizationstring|nullDigital work time organization status
fullEmploymentHoursstring|nullFull employment hours
breakMinutesint|nullBreak duration in minutes
breakWithinSchedulestring|nullWhether break is within schedule
workingCardstring|nullWork card requirement status
flexibleArrivalMinutesint|nullFlexible arrival minutes
lastModifiedDateDateTimeInterface|nullLast modification date

Acceptance Status (EX_BASE_06)

Checks the acceptance status of essential terms declarations submitted through myErgani. Use this to verify whether an employee has accepted or rejected the terms of a submitted declaration.

Usage

php
use OxygenSuite\OxygenErgani\Http\Services\AcceptanceStatus;

$service = new AcceptanceStatus($accessToken, $environment);

$status = $service->handle(
    afm: '123456789',
    protocol: '67890',
    date: '15/01/2025',
);

if ($status === null) {
    echo "No matching declaration found.\n";
} else {
    echo "Declaration status: {$status->mainStatus}\n";     // 1=Submitted, 2=Revoked
    echo "Answer status: {$status->answerStatus}\n";         // 0=Pending, 1=Submitted
    echo "Acceptance: {$status->answerAccept}\n";            // 0=Rejected, 1=Accepted, 2=Auto-accepted
    echo "Answer protocol: {$status->answerProtocol}\n";
    echo "Answer date: {$status->answerDate?->format('d/m/Y')}\n";
}

Via Ergani Facade

php
use OxygenSuite\OxygenErgani\Ergani;

$ergani = new Ergani($accessToken);

// With string date
$status = $ergani->getAcceptanceStatus('123456789', '67890', '15/01/2025');

// With DateTime object
$status = $ergani->getAcceptanceStatus('123456789', '67890', new DateTime('2025-01-15'));

Parameters

ParameterTypeRequiredDescription
$tinstringYesEmployee tax identification number
$protocolstringYesDeclaration protocol number
$dateDateTime|stringYesDeclaration submission date (DD/MM/YYYY)

Response: AcceptanceStatusResponse or null

Returns null when no matching declaration is found.

PropertyTypeDescription
mainStatusint|nullDeclaration status: 1=Submitted, 2=Revoked
answerStatusint|nullAnswer submission status: 0=Pending, 1=Submitted
answerAcceptint|nullAcceptance result: 0=Rejected, 1=Accepted, 2=Auto-accepted, 3=Rejected by deadline
answerProtocolstring|nullAcceptance protocol number
answerDateDateTimeInterface|nullAcceptance submission date

Helper Methods

MethodReturn TypeDescription
isSubmitted()boolDeclaration is submitted (mainStatus = 1)
isRevoked()boolDeclaration is revoked (mainStatus = 2)
isAnswerPending()boolAnswer is pending (answerStatus = 0)
isAnswerSubmitted()boolAnswer has been submitted (answerStatus = 1)
isAccepted()boolTerms were accepted (answerAccept = 1)
isRejected()boolTerms were rejected (answerAccept = 0)
isAutoAccepted()boolTerms were auto-accepted by deadline (answerAccept = 2)

Example: Check Pending Acceptances

php
$ergani = new Ergani($accessToken);

$status = $ergani->getAcceptanceStatus('123456789', '67890', '15/01/2025');

if ($status === null) {
    echo "Declaration not found.\n";
} elseif ($status->isAnswerPending()) {
    echo "Employee has not yet responded.\n";
} elseif ($status->isAccepted()) {
    echo "Terms accepted on {$status->answerDate->format('d/m/Y')}.\n";
} elseif ($status->isAutoAccepted()) {
    echo "Terms auto-accepted (deadline passed).\n";
} elseif ($status->isRejected()) {
    echo "Terms rejected by employee.\n";
}

Using Services with Token Manager

When using a token manager, you don't need to pass the access token manually:

php
use OxygenSuite\OxygenErgani\Storage\Token;
use OxygenSuite\OxygenErgani\Storage\FileToken;
use OxygenSuite\OxygenErgani\Enums\Environment;
use OxygenSuite\OxygenErgani\Http\Services\EmployerInfo;
use OxygenSuite\OxygenErgani\Http\Services\BranchInfo;
use OxygenSuite\OxygenErgani\Http\Services\ParameterLookup;

// Set up token manager once
Token::setCurrentTokenManager(
    new FileToken('username', 'password'),
    Environment::PRODUCTION
);

// Services will automatically use the token manager
$employer = (new EmployerInfo())->handle();
$branches = (new BranchInfo())->handle();
$params = (new ParameterLookup())->handle(ParameterLookup::NATIONALITY);

Error Handling

All services throw ErganiException or its subclasses on failure:

php
use OxygenSuite\OxygenErgani\Exceptions\ErganiException;
use OxygenSuite\OxygenErgani\Exceptions\AuthenticationException;
use OxygenSuite\OxygenErgani\Http\Services\EmployerInfo;

try {
    $employer = (new EmployerInfo($accessToken))->handle();
} catch (AuthenticationException $e) {
    // Invalid or expired token
    echo "Authentication failed: " . $e->getMessage();
} catch (ErganiException $e) {
    // Other API errors
    echo "Error: " . $e->getMessage();
}

Best Practices

  1. Cache Parameters: Parameter lookup results don't change frequently. Use the built-in PSR-16 caching on the Ergani facade to reduce API calls (see Ergani Facade - Caching).

  2. Validate Codes: Always validate user-provided codes against parameter lookups before submission.

  3. Use Collections: Leverage collection methods (search, filter, toDropdown) for efficient data handling.

  4. Check Card Sector: Use EmployerInfo to determine if work card submissions are required.

  5. Monthly Reports: Use MonthlyStatus for reconciliation and employee roster management.


See Also

Released under the MIT License.