> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Control iD as a data source

> Bring the data of your Control iD access control devices and REP time clocks to Nekt: access logs, users, groups, access rules, time punches (AFD), employees and more.

Control iD makes access control devices (facial readers, card readers and turnstiles such as iDFace, iDAccess, iDFlex and iDBlock) and REP time clocks (iDClass, iDX). Each device keeps its own records and has a built-in web interface. This connector reads one device directly through that interface: who entered where and when, the registered users and their groups and rules, and the AFD file with the time punches.

> [!NOTE]
>
> The connector only reads data. It never opens doors, changes users or touches any setting of the device.

## Before you start: make the device reachable

The device sits on your company's network, so Nekt needs a way to reach it over the internet:

1. **Turn on HTTPS on the device.** Access control devices answer plain HTTP by default: in the device's web interface, open the network settings and turn on SSL (HTTPS). REP time clocks (iDClass, iDX) already use HTTPS only.
2. **Publish the device's HTTPS port.** On your router or firewall, forward a public port to the device's HTTPS port (443 by default). Ask your IT team or internet provider if you are not sure how.
3. **Allow Nekt's IP addresses** on that port: `34.24.209.97`, `34.74.81.117` and `34.138.230.39`. Blocking every other address keeps the device protected. These are the addresses of Nekt Express. If your Nekt workspace runs on your own cloud account (GCP or AWS), ask Nekt support for the addresses to allow.

The address you give Nekt is the public one, such as `https://203.0.113.10:8443` or `https://portaria.yourcompany.com`. An internal address (like `192.168.x.x` or `10.x.x.x`) only works when your Nekt workspace runs on your own cloud account and that cloud has a network route (VPN) to the device; Nekt Express cannot reach it.

> [!WARNING]
>
> The connector needs the login of an administrator of the device's web interface, and the device does not offer read-only users. Keep the port open only to Nekt's addresses and change the factory password (`admin`/`admin`) before publishing the device.

## Configuring Control iD as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Control iD option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

The following configurations are available:

* **Device Line**: The product line of the device. Choose **Access control** for iDAccess, iDFace, iDFace Max, iDFlex, iDBlock, iDBox, iDFit and iDUHF, or **REP time clock** for iDClass and iDX. The tables offered depend on this choice.
* **Device URL**: The public HTTPS address of the device, with its port, e.g. `https://203.0.113.10:8443`.
* **Device User** and **Device Password**: The login of an administrator of the device's web interface.
* **Start Date** (advanced, optional): Earliest event read on the first sync of the incremental tables (access logs, alarms, door events and AFD records). Leave it empty to read everything the device still holds.
* **Verify SSL Certificate** (advanced): Control iD devices use a self-signed certificate by default, so leave this off unless a certificate from a trusted authority is installed on the device.

**One source reads one device.** If you have several devices, create one source per device and give their tables a common prefix to find them together in the Catalog.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.

* **Layer**: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: a folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new records. We recommend it for **Access Logs**, **Alarm Logs**, **Door and Turnstile Events**, **Change Logs** and **AFD Records**.
  * Full table: every time the extraction happens, we'll get the current state of the data. Users, groups, rules, schedules, employees and the other registration tables are always full table.

> [!WARNING]
>
> The device keeps a limited number of log entries and deletes the oldest when it is full. Keep the log tables **incremental** and avoid a Full sync of this source: a full sync rewrites those tables with only what the device still holds, and older entries already in your Catalog would be lost.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers.md), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times). Sync at least once a day, so log entries are read before the device rotates them out.

Optionally, you can configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

> [!WARNING]
>
> For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.

## Device models and firmware

Not every model has every table. For example, **Change Logs** exist only on iDFace devices, and **Punch Types** only when the device has time-clock mode. A table the device does not have is skipped in each run, marked as failed with a message naming it, and the other tables keep syncing. Deselect it to stop the message.

### Dates and times

Each table keeps the device's own time, and Nekt does not convert it to another time zone:

| Table | Columns | What they hold |
| :- | :- | :- |
| Access control tables (access logs, alarms, events, change logs, users, holidays, device info) | `time`, `timestamp`, `begin_time`... | The raw number the device records (seconds counted from the device's clock). |
| Same tables | `time_local`, `timestamp_local`, `last_access_local`... | That number as the date and time shown on the device, without a time zone. The Catalog shows it as if it were UTC: read it as your local time. |
| AFD Records, Portaria 671 layout | `event_datetime` | The exact moment of the record. The AFD carries the time zone, so the Catalog shows it in UTC (a punch at 08:01 in Brasília appears as 11:01). |
| AFD Records, both layouts | `event_datetime_local` | The date and time written in the AFD, as shown on the device, without a time zone. Use it to compare with the access control tables. |
| AFD Records, legacy layout | `event_datetime` | The device's local time without a time zone (same as `event_datetime_local`). |

AFD Records identify employees by CPF (or PIS on older clocks) with 11 digits in `employee_document`, the same format as the Employees table, so the two can be joined.

### When the device is reset or replaced

The connector remembers the last record it read and the device's serial number. If the device is replaced by another one at the same address, or its records start over after a reset, the run log says so and the connector reads the device again from the start. Records already in your tables stay: AFD records are kept apart by the `device_serial` column (which device) and the `device_generation` column (0 for a device's first numbering, plus 1 each time the same device starts over).

Some data is never synced on purpose: password hashes, PINs, card and QR code registrations, biometric templates and, on REP time clocks, employee passwords and badge numbers.

# Streams and Fields

## Available streams

The table below lists every stream, its **slug** (the exact identifier to pass when creating the source via API) and a short description.

### Access control devices (Device Line: Access control)

| Stream | Slug | Description |
| - | - | - |
| Access Logs | `access_logs` | Every identification at the device: who, when, at which portal, and whether access was granted or denied. |
| Alarm Logs | `alarm_logs` | Alarm activations and deactivations, with their cause (door forced, door open, panic, tampering...). |
| Door and Turnstile Events | `access_events` | Door and secbox openings and closings, and turnstile turns. |
| Change Logs | `change_logs` | Inserts, updates and deletions of users, cards and templates on the device (iDFace only). |
| AFD Records | `afd_records` | The device's AFD file of authorized accesses (time punches), when used as a time clock. |
| Users | `users` | Users registered on the device, with their validity and last access. |
| Groups (Departments) | `groups` | Access groups, shown as departments on the device. |
| User Groups | `user_groups` | Which users belong to which groups. |
| Areas | `areas` | Areas whose access is controlled. |
| Portals | `portals` | Passages (doors, turnstile directions) between two areas. |
| Access Rules | `access_rules` | Rules that allow or block access. |
| User / Group / Portal / Area Access Rules | `user_access_rules`, `group_access_rules`, `portal_access_rules`, `area_access_rules` | Which rules apply to each user, group, portal and area. |
| Schedules (Time Zones) | `time_zones` | Schedules used as the time criterion of access rules. |
| Time Spans | `time_spans` | The time intervals and weekdays of each schedule. |
| Access Rule Schedules | `access_rule_time_zones` | Which schedules apply to each rule. |
| Holidays | `holidays` | Holidays registered on the device. |
| Devices | `devices` | The device and the other devices it communicates with. |
| Punch Types | `log_types` | Punch types (entry, exit, break...) of the time-clock mode. |
| Device Info | `device_info` | One row with the device's model, serial number, firmware, license and memory. |

### REP time clocks (Device Line: REP time clock)

| Stream | Slug | Description |
| - | - | - |
| AFD Records | `afd_records` | Every record of the clock's AFD file: time punches, employee and employer changes, clock adjustments and events. |
| Employees | `employees` | Employees registered on the clock, identified by CPF (or PIS on clocks older than Portaria 671). |
| Company | `company` | The employer registered on the clock. |
| Device Info | `device_info` | One row with the clock's serial number, firmware, paper and memory counters and last NSR. |

## Fields by stream

### Common to both lines

> [accordion] AFD Records
>
> Table: `afd_records` · Primary key: `device_serial`, `device_generation`, `nsr` · Sync: Incremental (`nsr`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `device_serial` | String | Serial number of the device that wrote the AFD (part of the primary key, so the records of a replaced device are kept apart). |
> | `device_generation` | Integer | Restart count of the device's AFD numbering: 0 for a device's first numbering, plus 1 each time the same device starts its numbering over (part of the primary key, so earlier records are kept). |
> | `nsr` | Integer | Sequential record number (NSR) of the record in the device's AFD, used as the incremental replication key. |
> | `record_type` | Integer | AFD record type: 2 employer change, 3 time punch, 4 clock adjustment, 5 employee inclusion/change/exclusion, 6 sensitive event (Portaria 671), 7 time punch of a REP-P (Portaria 671). |
> | `record_type_name` | String | Name of the AFD record type. |
> | `layout` | String | AFD layout of the record: 671 (Portaria 671/2021, dates with time zone, CPF) or legacy (Portaria 1510/2009, local dates, PIS). |
> | `event_datetime` | Datetime | Date and time of the record: the punch time for punches, the recording time for changes and events, the time before the adjustment for clock adjustments. Layout 671 carries the time zone, so the destination stores the right instant (shown in UTC); legacy records have no time zone and hold the device's local time. |
> | `event_datetime_local` | Datetime | event\_datetime as the local date and time written in the AFD, without the time zone (same wall-clock time the device shows). |
> | `event_timezone_offset` | String | UTC offset of event\_datetime as written in the AFD (for example -0300); empty in the legacy layout. |
> | `employee_document` | String | CPF (layout 671) or PIS (legacy layout) of the employee with 11 digits, for punches and employee changes (matches employees.document). |
> | `employee_document_raw` | String | The employee CPF or PIS exactly as written in the AFD (12 digits, zero-padded). |
> | `employee_document_type` | String | Type of employee\_document: cpf or pis. |
> | `employee_name` | String | Name of the employee (employee changes). |
> | `operation` | String | Operation of an employee change: I inclusion, A change, E exclusion. |
> | `operation_name` | String | Operation of an employee change as text. |
> | `responsible_cpf` | String | CPF of the person responsible for the change or clock adjustment (layout 671). |
> | `adjusted_datetime` | Datetime | Date and time after a clock adjustment. |
> | `recorded_datetime` | Datetime | Date and time the punch was recorded (REP-P punches, layout 671). |
> | `sensitive_event_code` | String | Code of a sensitive REP event (01 opened for maintenance, 02 power restored, 03/04 external memory in/out, 05 instant report, 06 printing error, 07/08 service available/unavailable). |
> | `sensitive_event_name` | String | Description of the sensitive REP event. |
> | `collector_code` | String | Where a REP-P punch was collected: 01 mobile app, 02 browser, 03 desktop app, 04 electronic device, 05 other. |
> | `collector_name` | String | Description of the collector code. |
> | `is_offline` | Boolean | Whether a REP-P punch was collected offline. |
> | `record_hash` | String | SHA-256 hash of a REP-P punch (chained to the previous punch). |
> | `employer_document_type` | String | Type of the employer document in employer changes: cnpj or cpf. |
> | `employer_document` | String | CNPJ or CPF of the employer (employer changes). |
> | `employer_cno_caepf` | String | CNO or CAEPF of the employer, when present (layout 671 employer changes). |
> | `employer_cei` | String | CEI of the employer (legacy employer changes). |
> | `employer_name` | String | Company name of the employer (employer changes). |
> | `service_location` | String | Place where the work is done (employer changes). |
> | `crc` | String | CRC-16 check code of the record, as written in the AFD. |
> | `raw_line` | String | The record exactly as written in the AFD. |

### Access control devices

> [accordion] Access Logs
>
> Table: `access_logs` · Primary key: `id`, `time` · Sync: Incremental (`id`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Identifier of the access log entry on the device, used as the incremental replication key. |
> | `time` | Integer | Time of the event as recorded by the device (Unix timestamp counted from the device's local clock). |
> | `time_local` | Datetime | Time of the event as the device's local date and time (no time zone; the device records its local clock). |
> | `event` | Integer | Event code: 1 invalid device, 2 invalid identification parameters, 3 not identified, 4 identification pending, 5 identification timed out, 6 access denied, 7 access granted, 8 access pending, 9 user is not an administrator, 10 unidentified access via API, 11 exit button, 12 web interface, 13 entry given up, 14 no answer, 15 intercom, 16 OSDP, 17 denied by interlock, 18 released from the opposite side. |
> | `event_name` | String | Description of the event code. |
> | `device_id` | Integer | Identifier of the device where the access event happened. |
> | `identifier_id` | Integer | Identifier of the identification module that registered the event. |
> | `user_id` | Integer | Identifier of the user involved in the event (see users). |
> | `portal_id` | Integer | Identifier of the portal (door or turnstile passage) involved in the event (see portals). |
> | `identification_rule_id` | Integer | Identifier of the identification rule involved in the event. |
> | `qrcode_value` | String | Alphanumeric value of the QR code used to identify. |
> | `uhf_tag` | String | Value read from the UHF tag used to identify (iDAccess line only). |
> | `card_value` | Integer | Number of the card used to identify, as the device encodes it. |
> | `confidence` | Integer | Confidence of the face recognition, from 0 (lowest) to 1800 (highest). |
> | `mask` | Integer | 1 when the person was wearing a mask, 0 otherwise. |
> | `log_type_id` | Integer | Type of time-clock punch chosen on the device in time-clock mode (see log\_types). |
> | `component_id` | Integer | Identifier of the component (reader or external module) that originated the event. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Access Rule Schedules
>
> Table: `access_rule_time_zones` · Primary key: `access_rule_id`, `time_zone_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `access_rule_id` | Integer | Access rule (see access\_rules). |
> | `time_zone_id` | Integer | Schedule that sets when the access rule applies (see time\_zones). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Access Rules
>
> Table: `access_rules` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the access rule. |
> | `name` | String | Name of the access rule. |
> | `type` | Integer | Type of rule: 0 blocks access, 1 allows access. |
> | `type_name` | String | Type of rule as text: block or allow. |
> | `priority` | Integer | Reserved field of the device. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Alarm Logs
>
> Table: `alarm_logs` · Primary key: `id`, `time` · Sync: Incremental (`id`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Identifier of the alarm log entry on the device, used as the incremental replication key. |
> | `time` | Integer | Time of the alarm event as recorded by the device (Unix timestamp counted from the device's local clock). |
> | `time_local` | Datetime | Time of the alarm event as the device's local date and time (no time zone). |
> | `event` | Integer | Alarm event: 1 alarm activated, 2 alarm deactivated. |
> | `event_name` | String | Description of the alarm event. |
> | `cause` | Integer | Cause of the alarm: 1-5 alarm zones 1-5, 6 door open, 7 door forced, 8 panic finger, 9 device tampering, 10 panic card; 11 and above depend on the device line (panic password, panic PIN, monitored zone...). |
> | `user_id` | Integer | Identifier of the user involved in the alarm (see users). |
> | `access_log_id` | Integer | Identifier of the access log entry involved in the alarm (see access\_logs). |
> | `door_id` | Integer | Identifier of the door involved in the alarm (iDAccess line only). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Area Access Rules
>
> Table: `area_access_rules` · Primary key: `area_id`, `access_rule_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `area_id` | Integer | Area the rule applies to (see areas). |
> | `access_rule_id` | Integer | Access rule applied to the area (see access\_rules). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Areas
>
> Table: `areas` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the area whose access is controlled. |
> | `name` | String | Name of the area. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Change Logs
>
> Table: `change_logs` · Primary key: `id`, `timestamp` · Sync: Incremental (`id`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Identifier of the change log entry on the device, used as the incremental replication key. |
> | `operation_type` | String | Operation performed on the record (insert, update or delete). |
> | `table_name` | String | Table that was changed: users, templates, face\_templates or cards. |
> | `table_id` | Integer | Identifier of the changed record in that table. |
> | `timestamp` | Integer | Time of the change (Unix timestamp counted from the device's local clock). |
> | `timestamp_local` | Datetime | Time of the change as the device's local date and time (no time zone). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Device Info
>
> Table: `device_info` · Primary key: `serial` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `serial` | String | Serial number of the device. |
> | `device_id` | String | Identification number of the device. |
> | `device_name` | String | Model name of the device. |
> | `version` | String | Firmware version in use. |
> | `secbox_version` | String | Firmware version of the external security module (secbox), when present. |
> | `online` | Boolean | Whether the device is running in an online mode. |
> | `time` | Integer | Device clock when the row was read (Unix timestamp counted from the device's local clock). |
> | `time_local` | Datetime | Device clock when the row was read, as its local date and time. |
> | `daylight_savings_time_active` | Boolean | Whether daylight saving time is active on the device. |
> | `uptime_seconds` | Integer | How long the device has been on, in seconds. |
> | `mac` | String | MAC address of the device. |
> | `ip` | String | IP address of the device on its own network. |
> | `device_hostname` | String | Host name of the device. |
> | `web_server_port` | Integer | Port of the device's web server. |
> | `ssl_enabled` | Boolean | Whether HTTPS is enabled on the device's web server. |
> | `self_signed_certificate` | Boolean | Whether the web server uses a self-signed certificate. |
> | `license_users` | Integer | Maximum number of users allowed by the device license. |
> | `license_devices` | Integer | Maximum number of devices this device may control under its license. |
> | `license_type` | Integer | Type of the device license. |
> | `biometrics_max_records` | Integer | Maximum number of biometric records the device can store. |
> | `disk_free_bytes` | Integer | Free non-volatile memory, in bytes. |
> | `disk_total_bytes` | Integer | Total non-volatile memory, in bytes. |
> | `ram_free_bytes` | Integer | Free RAM, in bytes. |
> | `ram_total_bytes` | Integer | Total RAM, in bytes. |
> | `collected_at` | Datetime | When Nekt read this row (UTC). |

> [accordion] Devices
>
> Table: `devices` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the device (the device itself and the ones it communicates with). |
> | `name` | String | Name of the device. |
> | `ip` | String | Address of the device on its network. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Door and Turnstile Events
>
> Table: `access_events` · Primary key: `id`, `timestamp` · Sync: Incremental (`id`)
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Identifier of the access event on the device, used as the incremental replication key. |
> | `event` | String | Category of the event: catra (turnstile), secbox or door. |
> | `type` | String | Type of the event in its category: TURN\_LEFT, TURN\_RIGHT or GIVE\_UP for turnstiles; OPEN or CLOSE for doors and secbox. |
> | `identification` | String | Identifier of the secbox or door (for door and secbox events) or UUID of the turnstile event. |
> | `device_id` | Integer | Identifier of the device that reported the event. |
> | `timestamp` | Integer | Time of the event as recorded by the device (Unix timestamp counted from the device's local clock). |
> | `timestamp_local` | Datetime | Time of the event as the device's local date and time (no time zone). |
> | `uuid` | String | Universally unique identifier of the event. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Group Access Rules
>
> Table: `group_access_rules` · Primary key: `group_id`, `access_rule_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `group_id` | Integer | Access group the rule applies to (see groups). |
> | `access_rule_id` | Integer | Access rule applied to the group (see access\_rules). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Groups (Departments)
>
> Table: `groups` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the access group (shown as department on the device). |
> | `name` | String | Name of the access group (department). |
> | `identification_mode` | Integer | Identification mode of the group's users: 0 (1:N), 1 (1:1), 2 (template on card); empty uses the device setting. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Holidays
>
> Table: `holidays` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the holiday. |
> | `name` | String | Name of the holiday. |
> | `start` | Integer | Start of the holiday (Unix timestamp counted from the device's local clock). |
> | `end` | Integer | End of the holiday (Unix timestamp counted from the device's local clock). |
> | `start_local` | Datetime | Start of the holiday as the device's local date and time. |
> | `end_local` | Datetime | End of the holiday as the device's local date and time. |
> | `hol1` | Integer | 1 when the holiday belongs to holiday group 1. |
> | `hol2` | Integer | 1 when the holiday belongs to holiday group 2. |
> | `hol3` | Integer | 1 when the holiday belongs to holiday group 3. |
> | `repeats` | Integer | 1 when the holiday repeats every year. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Portal Access Rules
>
> Table: `portal_access_rules` · Primary key: `portal_id`, `access_rule_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `portal_id` | Integer | Portal the rule applies to (see portals). |
> | `access_rule_id` | Integer | Access rule applied to the portal (see access\_rules). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Portals
>
> Table: `portals` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the portal (a one-way passage between two areas, such as a door or turnstile direction). |
> | `name` | String | Name of the portal. |
> | `area_from_id` | Integer | Area the portal leads from (see areas). |
> | `area_to_id` | Integer | Area the portal leads to (see areas). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Punch Types
>
> Table: `log_types` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the punch type (time-clock mode: entry, exit, break...). |
> | `name` | String | Name of the punch type. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Schedules (Time Zones)
>
> Table: `time_zones` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the schedule (set of time spans used as the time criterion of access rules). |
> | `name` | String | Name of the schedule. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Time Spans
>
> Table: `time_spans` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the time span. |
> | `time_zone_id` | Integer | Schedule the time span belongs to (see time\_zones). |
> | `start` | Integer | Start of the time span in seconds since midnight. |
> | `end` | Integer | End of the time span in seconds since midnight. |
> | `start_time` | String | Start of the time span as HH:MM:SS. |
> | `end_time` | String | End of the time span as HH:MM:SS. |
> | `sun` | Integer | 1 when the time span applies on Sundays. |
> | `mon` | Integer | 1 when the time span applies on Mondays. |
> | `tue` | Integer | 1 when the time span applies on Tuesdays. |
> | `wed` | Integer | 1 when the time span applies on Wednesdays. |
> | `thu` | Integer | 1 when the time span applies on Thursdays. |
> | `fri` | Integer | 1 when the time span applies on Fridays. |
> | `sat` | Integer | 1 when the time span applies on Saturdays. |
> | `hol1` | Integer | 1 when the time span applies on holidays of type 1. |
> | `hol2` | Integer | 1 when the time span applies on holidays of type 2. |
> | `hol3` | Integer | 1 when the time span applies on holidays of type 3. |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] User Access Rules
>
> Table: `user_access_rules` · Primary key: `user_id`, `access_rule_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `user_id` | Integer | User the access rule applies to (see users). |
> | `access_rule_id` | Integer | Access rule applied to the user (see access\_rules). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] User Groups
>
> Table: `user_groups` · Primary key: `user_id`, `group_id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `user_id` | Integer | User that belongs to the access group (see users). |
> | `group_id` | Integer | Access group (department) the user belongs to (see groups). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

> [accordion] Users
>
> Table: `users` · Primary key: `id` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `id` | Integer | Unique identifier of the user on the device. |
> | `registration` | String | Registration (badge or employee) number of the user. |
> | `name` | String | Name of the user. |
> | `user_type_id` | Integer | Type of user: 1 for visitors, empty for regular users. |
> | `begin_time` | Integer | Start of the user's validity (Unix timestamp counted from the device's local clock); 0 means no start limit. |
> | `end_time` | Integer | End of the user's validity (Unix timestamp counted from the device's local clock); 0 means no end limit. |
> | `begin_time_local` | Datetime | Start of the user's validity as the device's local date and time (empty when there is no limit). |
> | `end_time_local` | Datetime | End of the user's validity as the device's local date and time (empty when there is no limit). |
> | `image_timestamp` | Integer | When the user's photo was registered (Unix timestamp); 0 means no photo. |
> | `last_access` | Integer | Time of the user's last access (Unix timestamp counted from the device's local clock); 0 means never. |
> | `last_access_local` | Datetime | Time of the user's last access as the device's local date and time (empty when never). |
> | `expires` | Integer | Legacy field the device no longer uses (validity is begin\_time/end\_time). |
> | `additional_fields` | JSON (string) | Fields the device sent that this table does not have a column for (JSON object); newer firmware versions add fields here. |

### REP time clocks

> [accordion] Company
>
> Table: `company` · Primary key: `cpf_cnpj` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `cpf_cnpj` | String | CNPJ or CPF of the employer, depending on document\_type. |
> | `document_type` | String | Type of the employer document: cnpj or cpf. |
> | `name` | String | Company name of the employer. |
> | `address` | String | Address of the employer. |
> | `cei` | String | CEI of the employer (on clocks certified under Portaria 671 it may hold the CAEPF or CNO). |
> | `cpf` | String | CPF of the person responsible. |

> [accordion] Device Info
>
> Table: `device_info` · Primary key: `serial` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `serial` | String | Serial (manufacturing) number of the clock. |
> | `mac` | String | MAC address of the clock. |
> | `firmware_version` | String | Firmware version of the clock. |
> | `mrp_version` | String | Version of the clock's fiscal memory (MRP). |
> | `is_facial` | Boolean | Whether the clock has face recognition. |
> | `uptime` | Integer | How long the clock has been on, as reported by it. |
> | `user_count` | Integer | Number of registered employees. |
> | `template_count` | Integer | Number of registered fingerprints. |
> | `number_of_faces` | Integer | Number of registered faces (facial clocks). |
> | `cuts` | Integer | Number of receipts printed so far. |
> | `coil_paper` | Integer | Paper left in the roll. |
> | `total_paper` | Integer | Size of the paper roll before use. |
> | `paper_ok` | Boolean | Whether the clock is ready to print. |
> | `low_paper` | Boolean | Whether the paper is low (empty when the clock has no sensor). |
> | `memory` | Integer | Memory used. |
> | `used_mrp` | Integer | Fiscal memory (MRP) used. |
> | `last_nsr` | Integer | NSR of the last record written by the clock. |
> | `collected_at` | Datetime | When Nekt read this row (UTC). |

> [accordion] Employees
>
> Table: `employees` · Primary key: `document` · Sync: Full table
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `document` | String | CPF (clocks certified under Portaria 671) or PIS (older clocks) of the employee, with leading zeros; unique on the clock. |
> | `document_type` | String | Type of document: cpf or pis. |
> | `cpf` | String | CPF of the employee (clocks certified under Portaria 671). |
> | `pis` | String | PIS of the employee (older clocks). |
> | `name` | String | Name of the employee. |
> | `registration` | String | Registration (employee) number. |
> | `admin` | Boolean | Whether the employee is an administrator of the clock. |
> | `face` | Boolean | Whether the employee has a registered face (facial clocks). |
> | `image_timestamp` | Integer | When the employee's photo was registered (Unix timestamp; facial clocks). |
> | `additional_fields` | JSON (string) | Fields the clock sent that this table does not have a column for (JSON object). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.