> 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/mark-attendance-at-gate.md). Agents can also search and read this documentation through its [MCP server](https://kb.logicerp.com/~gitbook/mcp).

# Mark Attendance at Gate

Records one **gate punch** for an employee in Logic ERP: an **IN** or an **OUT** at a given date and time, as a gate machine or a time clock would. Use it to send punches from your own attendance device or app. Each request saves one punch for one employee. The punch is stored with the employee's gate punches; it becomes part of the day's attendance (present, hours worked) only when the gate punches are imported into the attendance register in Logic ERP. This call does not do that itself.

To set a day's attendance status directly (present, half day, leave), use [Save Daily Attendance](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/payroll/push/save-daily-attendance.md) instead.

### **Endpoint**

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

The response envelope, 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). This endpoint has no branch field and does not use dates to choose a financial year.

### **Request fields**

Field names are not case-sensitive. There is no list: one request is one punch.

| Field               | Type | Required | Default | Meaning                                                                                                                                                                                                                                                                                                                                                             |
| ------------------- | ---- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EmployeeCode`      | text | Yes      | empty   | 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.                                                                                                                                                             |
| `AttendanceInOrOut` | text | No       | `IN`    | `IN` for an arrival, `OUT` for a departure. Only these two values, in **capitals**, are accepted: `in` or `Out` is refused.                                                                                                                                                                                                                                         |
| `AttendanceDate`    | date | Yes      | empty   | The date of the punch, `yyyy-MM-dd`. An empty value, or one that is not a date, is refused with `Invalid AttendanceDate...` and nothing is saved.                                                                                                                                                                                                                   |
| `AttendanceTime`    | text | Yes      | empty   | The time of the punch, for example `09:12` or `18:45` (24-hour), or `06:45 PM`. Seconds are dropped: `09:12:59` is stored as 09:12. If you send a date with the time (for example `2026-11-10T09:12:00`), only the time is used. An empty value, or one that is not a time (for example `25:10`), is refused with `Invalid AttendanceTime...` and nothing is saved. |

### **Rules Logic ERP applies**

* **How the employee is found.** `EmployeeCode` is matched against the employee code in the employee master. The search covers employees of **every branch** and does not look at whether the employee is active or has left. The employee must have a **shift** linked in the employee master; the punch is saved with that shift.
* **In and out.** An `IN` and an `OUT` are separate requests. Logic ERP does not pair them or check their order: an `OUT` without an `IN` is accepted.
* **Every punch of the day is kept.** An employee can have several `IN` and `OUT` punches on the same date – for example out for lunch and back. A punch is not saved again only when the employee already has one with the same date, the same `IN` or `OUT` and the same time (hours and minutes); the answer is then still `Status: true` with the success message.
* **Date and time as sent.** The date and time are stored exactly as you send them. Logic ERP does not convert time zones, so send the local time of the place where the employee punched. The date is not checked against the financial year or any lock date, and a future date is accepted.
* **What is stored.** The employee, IN or OUT, the date, the time (hours and minutes) and the employee's shift. Nothing is returned that identifies the punch: `LastSavedCode` is always `0`.
* **Re-sends.** Sending the same punch again (same date, `IN` or `OUT`, and time) does not create a second one, so it is safe to resend after a timeout.
* **Switching off.** This endpoint cannot be switched off for a branch in your API site's settings.
* Your Logic ERP licence must include the API for marking attendance at the gate.

### **Example request**

```json
{
  "EmployeeCode": "EMP0142",
  "AttendanceInOrOut": "IN",
  "AttendanceDate": "2026-11-10",
  "AttendanceTime": "09:12"
}
```

For the departure, send the same employee and date with `"AttendanceInOrOut": "OUT"` and the time of leaving, for example `"18:40"`.

### **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 an IN punch at 09:30 for the sandbox's test employee `EMP1`. Set `AttendanceDate` to today's date. A second send with the same date and time answers `Status: true` without saving a second punch.

## Mark Attendance at Gate

> Records one gate punch for an employee in Logic ERP: an IN or an OUT at a given date and time, as a gate machine or a time clock would. Use it to send punches from your own attendance device or app. Each request saves one punch for one employee. The punch is stored with the employee's gate punches; it becomes part of the day's attendance (present, hours worked) only when the gate punches are imported into the attendance register in Logic ERP. This call does not do that itself.

```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":{"/SaveAttendanceAtGate":{"post":{"tags":["Payroll - Push"],"operationId":"SaveAttendanceAtGate","summary":"Mark Attendance at Gate","description":"Records one gate punch for an employee in Logic ERP: an IN or an OUT at a given date and time, as a gate machine or a time clock would. Use it to send punches from your own attendance device or app. Each request saves one punch for one employee. The punch is stored with the employee's gate punches; it becomes part of the day's attendance (present, hours worked) only when the gate punches are imported into the attendance register in Logic ERP. This call does not do that itself.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"EmployeeCode":{"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."},"AttendanceInOrOut":{"type":"string","description":"`IN` for an arrival, `OUT` for a departure. Only these two values, in capitals, are accepted: `in` or `Out` is refused.","enum":["IN","OUT"]},"AttendanceDate":{"type":"string","description":"The date of the punch, `yyyy-MM-dd`. An empty value, or one that is not a date, is refused with `Invalid AttendanceDate...` and nothing is saved."},"AttendanceTime":{"type":"string","description":"The time of the punch, for example `09:12` or `18:45` (24-hour), or `06:45 PM`. Seconds are dropped: `09:12:59` is stored as 09:12. If you send a date with the time (for example `2026-11-10T09:12:00`), only the time is used. An empty value, or one that is not a time (for example `25:10`), is refused with `Invalid AttendanceTime...` and nothing is saved."}},"required":["EmployeeCode","AttendanceDate","AttendanceTime"]}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when the request was accepted – also when the punch was not saved because the same punch (same date, `IN` or `OUT`, and time) already existed."},"Message":{"type":"string","description":"`Attendance Marked Successfully` when accepted; the reason when not."},"LastSavedCode":{"type":"integer","description":"Always `0`."},"request_ID":{"type":"string","description":"The ID of this request – quote it to support. Empty when the request failed before Logic ERP started to process it."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Type         | Meaning                                                                                                                                               |
| --------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | true / false | `true` when the request was accepted – also when the punch was not saved because the same punch (same date, `IN` or `OUT`, and time) already existed. |
| `Message`       | text         | `Attendance Marked Successfully` when accepted; the reason when not.                                                                                  |
| `LastSavedCode` | number       | Always `0`.                                                                                                                                           |
| `request_ID`    | text         | The ID of this request – quote it to support. Empty when the request failed before Logic ERP started to process it.                                   |

### **Example response**

```json
{
  "Status": true,
  "Message": "Attendance Marked Successfully",
  "LastSavedCode": 0,
  "request_ID": "8d2e4b71-0c3f-4a5e-9b16-7f40c2d9a315"
}
```

### **Messages you may see**

| Message                                                                                   | Meaning                                                                                                                                    | What to do                                                               |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `Attendance Marked Successfully` (with `Status: true`)                                    | The request was accepted. If the same punch (same date, `IN` or `OUT`, and time) already existed for that employee, nothing new was saved. | Nothing.                                                                 |
| `Invalid Employee Code...`                                                                | `EmployeeCode` is empty or missing.                                                                                                        | Send the employee code.                                                  |
| `Invalid AttendanceDate...`                                                               | `AttendanceDate` is empty or not a date. Nothing was saved.                                                                                | Send the date as `yyyy-MM-dd`.                                           |
| `Invalid AttendanceTime...`                                                               | `AttendanceTime` is empty or not a time (for example `25:10`). Nothing was saved.                                                          | Send the time, for example `09:12`.                                      |
| `Employee Code ( … ) not exists Employee Master..`                                        | No employee has that code (the code you sent in place of …).                                                                               | Send the code exactly as in Logic ERP's employee master.                 |
| `Invalid Attendance IN/OUT...`                                                            | `AttendanceInOrOut` is not `IN` or `OUT` in capitals (also when sent as `null`).                                                           | Send `IN` or `OUT`.                                                      |
| `No Shift Linked with Employee : …`                                                       | The employee has no shift in the employee master.                                                                                          | Ask your Logic ERP team to link a shift to the employee.                 |
| `LOGIC API PUSH - MARK ATTENDANCE AT GATE` (the message may continue with licence detail) | The endpoint is not covered by your licence.                                                                                               | Ask your Logic ERP support team.                                         |
| A technical error                                                                         | Saving failed. Nothing was saved.                                                                                                          | Send the request 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/mark-attendance-at-gate.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.
