# \_new

Creates a new User Clock-in

### Parameters

#### user\_id

The ID of the user creating the Clock-in

#### date

The date of the Clock-in, formatted as Y-M-D (e.g 2023-06-27)

#### clockin

The time of day the user is expected to clock into work\
This is in an epoch time format (e.g 1687856400, meaning 10:00am on 27th June 2023)

#### clockout

The time of day the user is expected to clock out of work\
This is also in an epoch time format (e.g 1687883400, meaning 17:30pm on 27th June 2023)

### Example

```
FM_api('UserClockin_new',[
  'user_id'=>'94657',
  'date'=>'2023-07-03',
  'clockin'=>'1688380200',
  'clockout'=>'1688407200'
  ]
);
```

### Results

#### On Success

```
{"ok":1,"id":30021}
```

"id" value will vary

#### On Failure

If "user\_id" is not given a value, or has a value less than 1:

```
{"error":"missing or invalid parameter: user_id"}
```

If the "date" parameter is not given a date, or it is not in the correct format:

```
{"error":"missing or invalid parameter: date"}
```

If both the "clockin" and "clockout" parameters are not given values:

```
{"error":"missing or invalid parameter: clockin or clockout"}
```

If a User Clock-in creation is attempted for a user who already has another Clockin scheduled for the same date:

```
{"error":"an entry already exists for that user on that date"}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fieldmotion.com/fieldmotion-api-docs/userclockin/_new.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
