> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/save-daily-attendance.md). Agents can also search and read this documentation through its [MCP server](https://kb.logicerp.com/~gitbook/mcp).

# Save Daily Attendance

Saves the **attendance of a day** for one or more employees in Logic ERP's attendance register: present for a full or half day, or on leave (casual, paid, sick, optional, or leave without pay). You send a list of employees, each with an **attendance status** and the date; Logic ERP saves one attendance entry per employee per day, or replaces the one already there. Use it when your own system decides the day's status. To send gate punches (in and out times), use [Mark Attendance at Gate](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/mark-attendance-at-gate.md) instead.

### **Endpoint**

| Name          | Detail                                        |
| ------------- | --------------------------------------------- |
| Address       | `https://your-server/api/SaveDailyAttendance` |
| Method        | `POST`                                        |
| Authorization | Basic Auth                                    |

The response envelope, branches, queueing and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md).

### **Request fields**

Field names are not case-sensitive. Note the spellings: `Branch_Code` has an underscore, `BranchShortName` does not.

| Field             | Type   | Required | Default    | Meaning                                                                                                                                                                                          |
| ----------------- | ------ | -------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Branch_Code`     | number | No       | `0`        | A branch, by Logic ERP's branch number. A number that is not a branch in Logic ERP refuses the whole request with `Branch not found`. It is not saved with the attendance (see the rules below). |
| `BranchShortName` | text   | No       | empty      | A branch by its short name, used only when `Branch_Code` is `0` or less. An unknown short name refuses the whole request.                                                                        |
| `DisplayError`    | text   | No       | empty      | `"1"` adds technical detail to every error message. Leave it out.                                                                                                                                |
| `ListEmployees`   | list   | Yes      | empty list | The employees and their attendance – see below. An empty list is answered with `Success` and saves nothing.                                                                                      |

**Request fields – `ListEmployees`**

| Field                      | Type | Required | Default | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------- | ---- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EmployeeUserCode`         | text | Yes      | –       | The employee, by the employee code shown in Logic ERP's employee master (up to 20 characters). Capitals do not matter and spaces at the end are ignored; a space at the start makes the code not found.                                                                                                                                                                                                                                                    |
| `AttendanceType`           | text | Yes      | empty   | The attendance status of the day – one of the codes in the next table, in **capitals** and with no spaces (`fd` or `FD` is refused).                                                                                                                                                                                                                                                                                                                       |
| `DateIn`                   | date | Yes      | –       | The attendance date, `yyyy-MM-dd`. Required for leave days too.                                                                                                                                                                                                                                                                                                                                                                                            |
| `DateOut`                  | date | Yes      | –       | Must be a valid date, `yyyy-MM-dd`, or the employee is refused. It is used only together with `TimeOut`, to work out the hours worked of a present day. Send the same date as `DateIn`, or the next day when the work ends after midnight.                                                                                                                                                                                                                 |
| `TimeIn`, `TimeOut`        | text | No       | –       | For a present day (`FD`, `FO`, `HD`, `HC`, `HS`): the time the employee came in and went out, for example `09:00` and `18:00`. The hours worked are the minutes from `DateIn` + `TimeIn` to `DateOut` + `TimeOut`. A value that is not a time, or a `TimeOut` before the `TimeIn`, is refused. When either is empty, no time worked is counted (the hours saved then follow the rules below). Ignored for leave days. The times themselves are not stored. |
| `TimeInForOT`, `MarkLeave` | –    | No       | –       | Ignored. A leave is given by `AttendanceType`, not by `MarkLeave`.                                                                                                                                                                                                                                                                                                                                                                                         |

**Attendance statuses (`AttendanceType`)**

| Code | Meaning                                         |
| ---- | ----------------------------------------------- |
| `FD` | Present – full day                              |
| `FO` | Present – full day with overtime                |
| `HD` | Present – half day (the other half unpaid)      |
| `HC` | Present – half day, the other half casual leave |
| `HS` | Present – half day, the other half sick leave   |
| `CL` | Casual leave                                    |
| `PL` | Paid leave                                      |
| `SL` | Sick leave                                      |
| `OL` | Optional leave                                  |
| `LP` | Leave without pay                               |

### **Rules Logic ERP applies**

* **How the employee is found.** `EmployeeUserCode` is matched against the employee code in the employee master, across **all branches**, whatever the employee's status. The employee must also have a grade in Logic ERP; otherwise the request is refused (see the messages).
* **One entry per employee per day.** The entry is saved for the date in `DateIn`. If the employee already has an entry for that day – from an earlier request or entered in Logic ERP – it is **replaced**: the status and hours are overwritten and any in and out times shown for that day are cleared. Sending the same employee twice in one request keeps the last one. There is no lock-date or rights check, so any date can be sent and replaced.
* **The whole list is checked first.** Before anything is saved, every employee in the list is checked: the code, the dates, the status, the times, the payroll settings and payroll year, the working days of the month (for `PL`, `FD`, `FO`, `HD`, `HC` and `HS`) and the grade. If any employee fails, nothing is saved and the answer is `Status: false` with the reason for the first one that failed. Only then are the employees saved, one at a time in list order (see the known issue about a partly saved request).
* **Leave balance.** Before saving casual leave (`CL`, `HC`), sick leave (`SL`, `HS`) or optional leave (`OL`), Logic ERP works out how much of that leave the employee has left: the yearly allowance of the employee's grade plus the opening leave balance, less the leave already taken in the payroll year. When none is left, the status is changed instead of refused: `CL`, `SL` and `OL` are saved as `LP`, and `HC` and `HS` as `HD`. Casual leave (`CL`) on a **holiday** of the employee (their own holidays, or those of their branch) is saved as `PL` without a balance check. The answer does not tell you that a status was changed. Leave already taken is counted in the payroll year that contains `DateIn`; when no payroll year in Logic ERP contains `DateIn`, the request is refused with `Payroll year not defined for date …`.
* **Hours stored.** Logic ERP keeps hours in **minutes** (480 means 8 hours). The "hours per day" below is the employee's required hours per day from the employee master; when that is blank, it is the length of the shift – the shift rostered for the employee that day, else the employee's own shift, else the first shift set up in Logic ERP.
  * `CL`, `PL`, `SL`, `OL`: hours worked = hours per day.
  * `LP`: 0.
  * `FD`, `FO`, `HD`: the minutes from `TimeIn` to `TimeOut` (0 when either is empty).
  * `HC`, `HS`: the minutes from `TimeIn` to `TimeOut` (0 when either is empty), plus half the hours per day when the entry is new or its status changes (see the known issue below).
  * On a holiday, `FD`, `FO`, `HD`, `HC` and `HS` get the full hours per day when the employee's grade allows overtime, and otherwise the minutes from `TimeIn` to `TimeOut`.
  * Overtime: when the employee's grade allows overtime and the minutes worked are more than the hours per day by more than the minimum extra time for overtime in your payroll settings, the hours per day are saved as hours worked, the rest as overtime, and the day is saved as `FO` whatever present status you sent – for example, for an employee whose grade allows overtime, with a minimum extra time below 60 minutes, `FD` from 09:00 to 18:00 on an 8-hour day comes back as `FO` with 480 minutes worked and 60 minutes overtime. Otherwise overtime is 0 and all the minutes count as hours worked – also, whatever the grade, when your payroll settings work out overtime from the shift's in-time, which this endpoint does not use. Late minutes are always 0.
* **Payroll settings.** The payroll month settings for the calendar year of `DateIn` must exist in Logic ERP; otherwise the request stops with `Please Set Configuration`. A payroll year containing `DateIn` must exist too. For `PL`, `FD`, `FO`, `HD`, `HC` and `HS`, the month of `DateIn` must have working days in those settings; otherwise the request is refused (`… Working days are not set for the month …`). `CL`, `SL` and `OL` are checked for working days only while saving (see the known issue about a partly saved request).
* **Branch.** `Branch_Code` and `BranchShortName` only choose the branch the request runs under; an unknown branch refuses the whole request before anything is saved. The attendance is not linked to that branch and employees of other branches are accepted.
* **Time zone.** Dates are used as sent; Logic ERP does not convert time zones.
* **Switching off.** This endpoint cannot be switched off for a branch in your API site's settings.
* Your Logic ERP licence must include this endpoint.

> **Known issue – a request can still be partly saved.** The whole list is checked before anything is saved, but a failure during the save itself – for example `CL`, `SL` or `OL` for a month without working days, which is refused only then, or a database error – stops the request at that employee: the employees before it stay saved although the answer is `Status: false`. Fix the reported employee and send the whole list again: a day that was already saved is replaced, not duplicated (but see the next note for half days).

> **Known issue – sending a half day again drops its extra half day of hours.** When `HC` or `HS` is sent for a day that already has the same status, the half day is not counted again: the hours worked of that day are set to the minutes from `TimeIn` to `TimeOut` only (0 when no times are sent). Send a half day only once; to correct it, send a different status first or correct it in Logic ERP.

> **Known issue – the rate per hour is saved as 0.** The day is saved with a rate per hour of 0. For employees paid **by the hour**, no attendance earnings are recorded for the day, and an earnings line recorded earlier for that day is removed. Do not use this endpoint for hourly-paid employees.

> **Known issue – leave is refused for employees exempt from leave conditions.** For an employee who is set in the employee master not to have leave conditions applied, casual, sick and optional leave are saved as `LP` and half days `HC` / `HS` as `HD`, as if no leave were left. Enter leave for these employees in Logic ERP.

### **Example request**

```json
{
  "Branch_Code": 2,
  "BranchShortName": "",
  "ListEmployees": [
    {
      "EmployeeUserCode": "EMP0142",
      "AttendanceType": "FD",
      "DateIn": "2026-11-10",
      "DateOut": "2026-11-10"
    },
    {
      "EmployeeUserCode": "EMP0157",
      "AttendanceType": "CL",
      "DateIn": "2026-11-10",
      "DateOut": "2026-11-10"
    }
  ]
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. This really saves in the sandbox: the example records a full day present (`FD`) for the sandbox's test employee `EMP1`. Set `DateIn` and `DateOut` to today's date; a second send for the same day replaces the first.

## Save Daily Attendance

> Saves the attendance of a day for one or more employees in Logic ERP's attendance register: present for a full or half day, or on leave (casual, paid, sick, optional, or leave without pay). You send a list of employees, each with an attendance status and the date; Logic ERP saves one attendance entry per employee per day, or replaces the one already there. Use it when your own system decides the day's status. To send gate punches (in and out times), use Mark Attendance at Gate instead.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Payroll - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/SaveDailyAttendance":{"post":{"tags":["Payroll - Push"],"operationId":"SaveDailyAttendance","summary":"Save Daily Attendance","description":"Saves the attendance of a day for one or more employees in Logic ERP's attendance register: present for a full or half day, or on leave (casual, paid, sick, optional, or leave without pay). You send a list of employees, each with an attendance status and the date; Logic ERP saves one attendance entry per employee per day, or replaces the one already there. Use it when your own system decides the day's status. To send gate punches (in and out times), use Mark Attendance at Gate instead.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"Branch_Code":{"type":"integer","description":"A branch, by Logic ERP's branch number. A number that is not a branch in Logic ERP refuses the whole request with `Branch not found`. It is not saved with the attendance (see the rules below)."},"ListEmployees":{"type":"array","items":{"type":"object","properties":{"EmployeeUserCode":{"type":"string","description":"The employee, by the employee code shown in Logic ERP's employee master (up to 20 characters). Capitals do not matter and spaces at the end are ignored; a space at the start makes the code not found."},"AttendanceType":{"type":"string","description":"The attendance status of the day – one of the codes in the next table, in capitals and with no spaces (`fd` or ` FD` is refused).","enum":["FD","FO","HD","HC","HS","CL","PL","SL","OL","LP"]},"DateIn":{"type":"string","description":"The attendance date, `yyyy-MM-dd`. Required for leave days too."},"DateOut":{"type":"string","description":"Must be a valid date, `yyyy-MM-dd`, or the employee is refused. It is used only together with `TimeOut`, to work out the hours worked of a present day. Send the same date as `DateIn`, or the next day when the work ends after midnight."}},"required":["EmployeeUserCode","AttendanceType","DateIn","DateOut"]},"description":"The employees and their attendance – see below. An empty list is answered with `Success` and saves nothing."}},"required":["ListEmployees"]}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when every employee in the list was saved."},"Message":{"type":"string","description":"`Success`, or the reason the request stopped."},"LastSavedCode":{"type":"integer","description":"Always `0`."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support. Empty when the request was refused before processing started (an unknown `Branch_Code` or `BranchShortName`, or no licence)."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Type         | Meaning                                                                                                                                                                    |
| --------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | true / false | `true` when every employee in the list was saved.                                                                                                                          |
| `Message`       | text         | `Success`, or the reason the request stopped.                                                                                                                              |
| `LastSavedCode` | number       | Always `0`.                                                                                                                                                                |
| `request_ID`    | text         | The ID of this request – quote it to support. Empty when the request was refused before processing started (an unknown `Branch_Code` or `BranchShortName`, or no licence). |

### **Example response**

```json
{
  "Status": true,
  "Message": "Success",
  "LastSavedCode": 0,
  "request_ID": "2c7a9e14-5b38-4f0d-a6e1-93d58b0f7c22"
}
```

### **Messages you may see**

The employee code shown in a message is the one you sent, in place of ….

| Message                                                                                   | Meaning                                                                                                                                                                                                                           | What to do                                                                                          |
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `Success` (with `Status: true`)                                                           | Every employee in the list was saved.                                                                                                                                                                                             | Nothing.                                                                                            |
| `Invalid EmployeeUserCode : …`                                                            | No employee has that code, or the code is empty. Nothing was saved.                                                                                                                                                               | Send the code exactly as in Logic ERP's employee master.                                            |
| `Invalid DateIn for EmployeeUserCode : …`                                                 | `DateIn` is missing or not a date.                                                                                                                                                                                                | Send `yyyy-MM-dd`, also for leave days.                                                             |
| `Invalid DateOut for EmployeeUserCode : …`                                                | `DateOut` is missing or not a date.                                                                                                                                                                                               | Send the same date as `DateIn`.                                                                     |
| `Invalid AttendanceStatus for EmployeeUserCode : …`                                       | `AttendanceType` is missing or not one of the listed codes in capitals.                                                                                                                                                           | Send one of the listed codes.                                                                       |
| `Invalid TimeIn for EmployeeUserCode : …`, `Invalid TimeOut for EmployeeUserCode : …`     | A present day was sent with a `TimeIn` or `TimeOut` that is not a time. Nothing was saved.                                                                                                                                        | Send times such as `09:00`, or leave both empty.                                                    |
| `TimeOut is before TimeIn for EmployeeUserCode : …`                                       | `DateOut` + `TimeOut` is earlier than `DateIn` + `TimeIn`. Nothing was saved.                                                                                                                                                     | Correct the times; for work that ends after midnight, send the next day in `DateOut`.               |
| `Payroll year not defined for date …`                                                     | No payroll year in Logic ERP contains `DateIn` (the date is shown as `dd/MM/yyyy`). Nothing was saved.                                                                                                                            | Ask your Logic ERP team to set up the payroll year.                                                 |
| `Attendance not saved for EmployeeUserCode : …. Working days are not set for the month …` | The payroll month settings give no working days for the month of `DateIn` (shown as `MM/yyyy`). For `PL` and present days nothing was saved; when it comes for `CL`, `SL` or `OL`, the employees before it in the list are saved. | Ask your Logic ERP team to set the working days of that month.                                      |
| `Attendance not saved for EmployeeUserCode : …. The employee's grade is not defined`      | The employee has no grade in Logic ERP. Nothing was saved.                                                                                                                                                                        | Ask your Logic ERP team to set the employee's grade.                                                |
| `Attendance not saved for EmployeeUserCode : …`                                           | Logic ERP did not save that employee's day for another reason. The employees before it in the list are saved.                                                                                                                     | Check the employee in Logic ERP; if unclear, send the `request_ID` to support.                      |
| `Please Set Configuration`                                                                | The payroll month settings for the year of `DateIn` do not exist in Logic ERP.                                                                                                                                                    | Ask your Logic ERP team to set up payroll for that year.                                            |
| `Branch_Short_Name : … not exists.`                                                       | No branch has the `BranchShortName` you sent. Nothing was saved.                                                                                                                                                                  | Send the short name exactly as in Logic ERP, or send `Branch_Code`.                                 |
| `Branch not found`                                                                        | No branch has the `Branch_Code` you sent. Nothing was saved.                                                                                                                                                                      | Send a branch number that exists in Logic ERP, or `0`.                                              |
| `LOGIC API PUSH - DAILY ATTENDANCE` (the message may continue with licence detail)        | The endpoint is not covered by your licence.                                                                                                                                                                                      | Ask your Logic ERP support team.                                                                    |
| A technical error                                                                         | `ListEmployees` was sent as `null`, or saving failed. Employees before the failing one may be saved.                                                                                                                              | Correct the request and send the whole list again; if it repeats, send the `request_ID` to support. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/save-daily-attendance.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
