# Add historical timesheet entry.

Add employee shift. Expect error codes:INVALID_EMPLOYEE - when invalid employee id providedINVALID_SHIFT_START - when invalid start of work time providedINVALID_SHIFT_END - when invalid finish of work time providedSHIFT_END_BEFORE_START - when end of work time is before startSHIFT_TO_SHORT - when shift period is shorter than one minuteINVALID_BREAK_TYPE - when invalid break type id provided. You should use get-break-types method to find proper break type IDINVALID_BREAK_FOR_USER -  when break type is not available for employeeINVALID_BREAK_START - when invalid start of break time providedINVALID_BREAK_END - when invalid finish of break time providedBREAK_END_BEFORE_START - when end of break time is before startBREAK_IS_NOT_IN_SHIFT_RANGE -  when break time range goes beyond work time rangeBREAK_TO_SHORT - when break period is shorter than one minuteBREAKS_OVERLAP - when one break time range overlaps anotherINVALID_PROJECT_TYPE - when invalid project type id provided. You should use get-projects method to find proper project type IDINVALID_PROJECT_FOR_USER -  when project type is not available for employee. You should use get-projects-for-person method to find proper project type IDINVALID_PROJECT_TIME_ENTRY_START - when invalid start of project time entry providedINVALID_PROJECT_TIME_ENTRY_END - when invalid finish of project time entry providedPROJECT_TIME_ENTRY_END_BEFORE_START - when end of project time entry is before startPROJECT_TIME_ENTRY_IS_NOT_IN_SHIFT_RANGE -  when project time entry goes beyond work time rangePROJECT_TIME_ENTRY_TO_SHORT - when project time entry is shorter than one minutePROJECT_TIME_ENTRIES_OVERLAP - when one project time entry overlaps anotherSHIFT_DESCRIPTION_TOO_LONG - when description contains more than 4096 charactersSHIFT_DESCRIPTION_NOT_ALLOWED_FORMATTING - when description contains more not allowed HTML or Markdown formatting

Endpoint: POST /clockin/timesheetentries/v1/create
Version: v1
Security: basicAuth

## Security:

  - `basicAuth` (unknown)
    http basic

## Request fields (application/json):

  - `person` (string, required)
    Employee identifier. You can use e-mail or external identifier in format (externalNumber:ABC123)
    Example: john.white@mycompany.com

  - `shiftStart` (string, required)
    Date and time of shift start in ISO format

  - `shiftEnd` (string, required)
    Date and time of shift end in ISO format

  - `breaks` (array)
    List of breaks.

  - `breaks.breakType` (integer, required)
    ID break type
    Example: 1

  - `breaks.breakStart` (string, required)
    Date and time of break start in ISO format

  - `breaks.breakEnd` (string, required)
    Date and time of break end in ISO format

  - `projects` (array)
    List of projects.

  - `projects.projectType` (integer, required)
    ID project type
    Example: 1

  - `projects.projectStart` (string, required)
    Date and time of project worklog start in ISO format

  - `projects.projectEnd` (string, required)
    Date and time of project worklog end in ISO format

  - `description` (string)
    Shift description

## Response 200:

  - `200` (unknown)
    successful operation

## Response 200 fields (application/json):

  - `id` (integer, required)
    Timesheet entry ID

  - `started` (string, required)
    Date and time of timesheet entry started

  - `finished` (string)
    Date and time of timesheet entry finished. Has null value if employee does not clock out

  - `startedTimeZone` (string, required)
    Started work timzeone
    Example: Europe/Warsaw

  - `finishedTimeZone` (string)
    Finished work timezone. Has null value if employee does not clock out
    Example: Europe/Warsaw

  - `duration` (integer, required)
    Duration of timesheet entry in seconds. Has 0 value if employee does not clock out
    Example: 28800

  - `person` (object, required)
    Employee

  - `person.firstName` (string, required)
    Employee first name
    Example: John

  - `person.lastName` (string, required)
    Employee last name
    Example: Williams

  - `person.email` (string, required)
    Employee email
    Example: john.williams@domain.com

  - `person.externalId` (string)
    Employee external identifier
    Example: A12Y

  - `breaks` (array, required)
    List of breaks

  - `breaks.from` (string)
    Date and time when break was started.

  - `breaks.to` (string)
    Date and time when break was finished. Has null value if break was not finished

  - `breaks.duration` (integer)
    Duration of a break in seconds. Has null value if break was not finished.
    Example: 28800

  - `breaks.breakType` (object)
    Break type.

  - `breaks.breakType.id` (integer)
    Break id

  - `breaks.breakType.name` (string)
    Break name
    Example: Primary break

  - `projects` (array, required)
    List of projects

  - `projects.from` (string)
    Date and time when employee started working on project

  - `projects.to` (string)
    Date and time when employee finished working on project. Has null value if work on project was not finished

  - `projects.duration` (integer)
    Duration of time spent on a project in seconds. Has null value if work on project was not finished
    Example: 28800

  - `projects.project` (object)
    Project properties

  - `projects.project.id` (integer)
    Project id

  - `projects.project.name` (string)
    Project name
    Example: Primary project

  - `closed` (boolean, required)
    Is shift closed?

  - `description` (string)
    Shift description

## Response 400:

  - `400` (unknown)
    Invalid input. Reason and description are returned in json response.

## Response 400 fields (application/json):

  - `message` (string)
    Human readable error explanation.
    Example: Api error

  - `code` (string)
    Error code.
    Example: INVALID_JSON_PAYLOAD

  - `field` (string)
    Which field of payload object caused error. NULL when error is not related to particular field
    Example: field

## Response 401:

  - `401` (unknown)
    Authorization error - e.g. invalid server url, no Authorization header, wrong user / API key

## Response 401 fields (application/json):

  - `message` (string, required)
    Error details
    Example: Authentication failure

  - `code` (string, required)
    General type of error
    Example: AUTH

  - `field` (string)
    Leftover for backward compatibility
    Example: null

## Response 403:

  - `403` (unknown)
    Authorization failure. Provided ApiKey is valid but does not contain a scope required to perform requested operation

## Response 429:

  - `429` (unknown)
    Maximum number of requests was exceeded - either per second, hour or day.

## Response 429 fields (application/json):

  - `code` (string, required)
    General type of error
    Example: QUOTA_EXCEEDED

  - `field` (string, required)
    Detailed info about quota and it's current usage
    Example: Your current usage is 101/day, 10/hour, 1/sec
Your current limits 100/day, 10/hour, 1/sec.

## Response 500:

  - `500` (unknown)
    Internal server error - something went wrong!

## Response 500 fields (application/json):

  - `message` (string, required)
    Error details
    Example: An unexpected error occurred

  - `code` (string, required)
    General type of error
    Example: INTERNAL_SERVER_ERROR

## Response 504:

  - `504` (unknown)
    Gateway timeout - call to downstream service exceeded maximum configured amount of time

## Response 504 fields (application/json):

  - `message` (string, required)
    Error details
    Example: Public API call exceeded timeout

  - `code` (string, required)
    General type of error
    Example: TIMEOUT

