Timesheets


Overview

URL https://api.xero.com/payroll.xro/1.0/Timesheets
Methods Supported POST, GET
Description Allows you to retrieve, add and update Payroll Timesheets in a Xero organisation
Allows you to retrieve, add and update Payroll Timesheet Lines in a Xero organisation.

Elements for Timesheets

The following are required to create a new timesheet
EmployeeID The Xero identifier for an employee
StartDate Period start date
EndDate Period end date
The following are optional when creating a timesheet
TimesheetLines See TimesheetLines
Status See Timesheet Status Codes
Elements returned on a GET request only
TimesheetID The Xero identifier for a Payroll Timesheet
Hours Timesheet total hours

Elements for TimesheetLines

EarningsTypeID The Xero identifier for an Earnings Type
TrackingItemID The Xero identifier for a Tracking Category <TrackingOptionID>. The <TrackingOptionID> must belong to the TrackingCategory selected as <TimesheetCategories> under Payroll Settings.
NumberOfUnits Number of units of a Timesheet line

GET Timesheets

Optional parameters for GET Timesheets

Record filter You can specify an individual record by appending the value to the endpoint, i.e.
GET https://…/Timesheets/{identifier}
TimesheetID The Xero identifier for a payroll timesheet
e.g. 297c2dc5-cc47-4afd-0000-74990b8761e9
You can get all timesheets by calling the endpoint.
GET https://…/timesheets
Modified After The ModifiedAfter filter is actually an HTTP header: ‘If-Modified-Since‘.
A UTC timestamp (yyyy-mm-ddThh:mm:ss) . Only employees created or modified since this timestamp will be returned e.g. 2009-11-12T00:00:00
page By default the number of records returned per call is 100. You can add GET https://…/Timesheets?page=2 to get the next set of records.
Where Filter by an any element (see Filters)
order Order by any element returned (see Order By)

Example response for GET Timesheets/{identifier}

  <Timesheet>
    <TimesheetID>e7eab9ff-b987-4e8a-bc73-8363d4e8d3e5</TimesheetID>
    <EmployeeID>577dd1ca-5a6b-4e98-bc2d-086ca49637d7</EmployeeID>
    <StartDate>2013-01-18T00:00:00</StartDate>
    <EndDate>2013-01-24T00:00:00</EndDate>
    <Status>Draft</Status>
    <Hours>0.0000</Hours>
    <TimesheetLines>
      <TimesheetLine>
        <EarningsRateID>a24dd671-afd3-49bf-a60e-88acd7faa9e9</EarningsRateID>
        <TrackingItemID>4c7fa2cd-1cf8-4e91-8d55-c1ac1e6d7e8c</TrackingItemID>
        <NumberOfUnits>
          <NumberOfUnit>8.0000</NumberOfUnit>
          <NumberOfUnit>8.0000</NumberOfUnit>
          <NumberOfUnit>8.0000</NumberOfUnit>
          <NumberOfUnit>8.0000</NumberOfUnit>
          <NumberOfUnit>8.0000</NumberOfUnit>
          <NumberOfUnit>0.0000</NumberOfUnit>
          <NumberOfUnit>0.0000</NumberOfUnit>
        </NumberOfUnits>
      </TimesheetLine>
    </TimesheetLines>
  </Timesheet>

Example response for GET Timesheets

  <Timesheets>
    <Timesheet>
      <TimesheetID>76bfc5dd-7a9f-438a-b956-e2c204ef732e</TimesheetID>
      <EmployeeID>773d4e68-5b38-4181-bcca-8a8fc5c8e756</EmployeeID>
      <StartDate>2013-01-14T00:00:00Z</StartDate>
      <EndDate>2013-01-20T00:00:00Z</EndDate>
      <Status>Draft</Status>
      <Hours>90.0000</Hours>
      <TimesheetLines>
        <TimesheetLine>
          <EarningsRateID>a24dd671-afd3-49bf-a60e-88acd7faa9e4</EarningsRateID>
          <TrackingItemID>b6e5130e-64c7-4e4d-9236-8f1cd12c2375</TrackingItemID>
          <NumberOfUnits>
            <NumberOfUnit>1.0000</NumberOfUnit>
            <NumberOfUnit>2.0000</NumberOfUnit>
            <NumberOfUnit>3.0000</NumberOfUnit>
            <NumberOfUnit>4.0000</NumberOfUnit>
            <NumberOfUnit>5.0000</NumberOfUnit>
            <NumberOfUnit>0.0000</NumberOfUnit>
            <NumberOfUnit>0.0000</NumberOfUnit>
          </NumberOfUnits>
        </TimesheetLine>
        <TimesheetLine>
          <EarningsRateID>a24dd671-afd3-49bf-a60e-88acd7faa9e4</EarningsRateID>
          <TrackingItemID>3afe26a8-51a3-4cae-85ce-420ef3b77ad8</TrackingItemID>
          <NumberOfUnits>
            <NumberOfUnit>1.0000</NumberOfUnit>
            <NumberOfUnit>2.0000</NumberOfUnit>
            <NumberOfUnit>3.0000</NumberOfUnit>
            <NumberOfUnit>4.0000</NumberOfUnit>
            <NumberOfUnit>5.0000</NumberOfUnit>
            <NumberOfUnit>0.0000</NumberOfUnit>
            <NumberOfUnit>0.0000</NumberOfUnit>
          </NumberOfUnits>
        </TimesheetLine>
      </TimesheetLines>
    </Timesheet>
  </Timesheets>

POST Timesheets

Use this method to add, update one or more payroll timesheets in payroll.

Example of minimum elements required to add a new Timesheet

  <Timesheet>
    <EmployeeID>773d4e68-5b38-4181-bcca-8a8fc5c8e756</EmployeeID>
    <StartDate>2013-01-14T00:00:00</StartDate>
    <EndDate>2013-01-20T00:00:00</EndDate>
    <Status>Draft</Status>
  </Timesheet>

Example of adding a timesheet with lines


<Timesheet>
    <EmployeeID>5e493b2e-c3ed-4172-95b2-593438101f76</EmployeeID>
    <StartDate>2013-04-03T00:00:00</StartDate>
    <EndDate>2013-04-10T00:00:00</EndDate>
    <Status>Draft</Status>
    <TimesheetLines>
        <TimesheetLine>
            <EarningsRateID>0daff504-2d42-4243-bdac-24f2bae0ce7c</EarningsRateID>
            <NumberOfUnits>
                <NumberOfUnit>8</NumberOfUnit>
                <NumberOfUnit>8</NumberOfUnit>
                <NumberOfUnit>8</NumberOfUnit>
                <NumberOfUnit>8</NumberOfUnit>
                <NumberOfUnit>8</NumberOfUnit>
                <NumberOfUnit>0</NumberOfUnit>
                <NumberOfUnit>0</NumberOfUnit>
            </NumberOfUnits>
        </TimesheetLine>
    </TimesheetLines>
</Timesheet>