Shifts

Authentication: All endpoints require an Authorization: Bearer <access token> header.

Most endpoints require an X-Company-ID: <company_id> header to scope requests to a specific company. This is the recommended header for most API operations.

Some endpoints require an X-Location-ID: <location_id> header when the query doesn't accept a locationId parameter.

See Authentication for details on how to obtain and use these headers.

Query Shifts by Location

GraphQL Query

query Roster($startTime: DateTime!, $endTime: DateTime!, $locationId: ID!, $published: Boolean) {
  shifts(startTime: $startTime, endTime: $endTime, locationId: $locationId, published: $published) {
    id
    startTime
    endTime
    breaks {
      startTime
      endTime
      subtracts
    }
    published
    hours
    employee {
      id
      fullName
    }
    position {
      id
      text
    }
    location {
      id
      name
    }
  }
}

Example Variables

{
  "startTime": "2024-05-01T16:00:00.000Z",
  "endTime": "2024-05-30T17:59:59.999Z",
  "locationId": "12325",
  "published": null
}

Example Response

{
  "data": {
    "shifts": [
      {
        "id": "5652527",
        "startTime": "2024-05-22T00:00:00.000Z",
        "endTime": "2024-05-22T04:00:00.000Z",
        "breaks": [],
        "published": true,
        "hours": 4,
        "employee": {
          "id": "72908",
          "fullName": "Craig Bussell"
        },
        "position": {
          "id": "18215",
          "text": "Product Manager"
        },
        "location": {
          "id": "12325",
          "name": "Integration Sandbox"
        }
      },
      {
        "id": "5652528",
        "startTime": "2024-05-20T22:00:00.000Z",
        "endTime": "2024-05-21T05:00:00.000Z",
        "breaks": [],
        "published": true,
        "hours": 7,
        "employee": {
          "id": "72908",
          "fullName": "Craig Bussell"
        },
        "position": {
          "id": "18215",
          "text": "Product Manager"
        },
        "location": {
          "id": "12325",
          "name": "Integration Sandbox"
        }
      }
    ]
  }
}

Query Shifts by Employee

GraphQL Query

query Roster($startTime: DateTime!, $endTime: DateTime!, $published: Boolean, $employeeId: ID) {
  shifts(startTime: $startTime, endTime: $endTime, published: $published, employeeId: $employeeId) {
    id
    startTime
    endTime
    breaks {
      startTime
      endTime
      subtracts
    }
    published
    hours
    cost
    employee {
      id
      fullName
    }
    position {
      id
      text
    }
    location {
      id
      name
    }
  }
}

Example Variables

{
  "startTime": "2023-09-30T16:00:00.000Z",
  "endTime": "2023-11-31T17:59:59.999Z",
  "published": null,
  "employeeId": "73544"
}

Example Response

{
  "data": {
    "shifts": [
      {
        "id": "5633782",
        "startTime": "2023-11-12T23:00:00.000Z",
        "endTime": "2023-11-13T07:00:00.000Z",
        "breaks": [],
        "published": true,
        "hours": 8,
        "employee": {
          "id": "73544",
          "fullName": "Alana Robertson"
        },
        "position": {
          "id": "18101",
          "text": "General Manager"
        },
        "location": {
          "id": "12326",
          "name": "Brisbane Office"
        }
      },
      {
        "id": "5633783",
        "startTime": "2023-11-13T23:00:00.000Z",
        "endTime": "2023-11-14T07:00:00.000Z",
        "breaks": [],
        "published": true,
        "hours": 8,
        "employee": {
          "id": "73544",
          "fullName": "Alana Robertson"
        },
        "position": {
          "id": "18101",
          "text": "General Manager"
        },
        "location": {
          "id": "12326",
          "name": "Brisbane Office"
        }
      }
    ]
  }
}