Time
The APIs related to the Time entity allow you to track time for employees and contractors inclusive of PayItems (Paytypes). The Time API provides support for create, read and update operations. You can also link the Time entries to a project within QuickBooks by configuring the ID for the project while creating the time entries.
This page outlines -
- The Create operation for tracking time for an employee with PayType
- The Create operation for tracking time for an employee with PayType and linking it to a Project
- The Create operation for tracking time for a contractor
Integration Diagram
Operations for Time Activity
API schema for Time Activity
Scopes
- payroll.compensation.read : Allows access to read Pay types (i.e. compensation) [Compensation data can only be queried for customers using QuickBooks Payroll]
- project-management.project : Allows access to read and write projects data
- com.intuit.quickbooks.accounting: For V3 Accounting REST API access [For Read only use cases]
Endpoints
- GraphQL API: https://qb.api.intuit.com/graphql
- V3 Accounting REST API: https://quickbooks.api.intuit.com/v3/company/{realmid}/{entityname}?minorversion=70
Required headers
- Content-type: application/json
- Authorization: Bearer access_token
Note: Use tokens generated using scopes mentioned above in the authorization header for all other calls shown here.
Use Cases
Pre-check:
- Query the QuickBooks Accounting V3 Preferences API and check for
Preferences->OtherPrefs->NameValue
to identify if projects are supported for the company. Check if NameValueProjectsEnabled
is true.
Sample name value pair response for reference:
{
"Name": "TimeTrackingFeatureEnabled",
"Value": "true"
}
{
"Name": "ProjectsEnabled",
"Value": "true"
}
Use Case 1: Create Time Activity with pay type and link it to a Project
This use case is applicable for the customers who are enrolled to QuickBooks Payroll and have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Fetching
employee->Id
by calling V3 Accounting Employee Query & set it inEmployeeRef
in the TimeActivity object withNameOf
field asEmployee
. - Filter by the
employee->Id
from above step to fetch the list of employee compensation Idscompensation ->id
from Read EmployeeCompensation(Query) GraphQL Query & set it inPayrollItemRef
in the TimeActivity object. - Fetch
project -> id
from Read Project(Query) GraphQL Query to readproject -> id
& set it inProjectRef
in the TimeActivity object. - Fetch
Customer -> id
from V3 Accounting Customer Query API (optional) & set it inCustomerRef
in the TimeActivity object. - Fetch
Item->id
from V3 Accounting Query Item API & set it in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Employee",
"EmployeeRef": { "value": "1" },
"PayrollItemRef": {
"value": "626270109"
},
"CustomerRef": {
"value": "2"
},
"ProjectRef": {
"value":"416296152"
},
"ItemRef": { "value": "1" },
"Hours": 8,
"Minutes": 0,
"Description": "Construction:DailyWork"
}
Use Case 2: Create Time Activity with pay type
This use case is applicable for the customers who are enrolled to QuickBooks Payroll and do not have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Fetch
employee->id
from V3 Accounting Employee Query & set it inEmployeeRef
in the TimeActivity object withNameOf
field asEmployee
. - Fetching
compensation ->id
from Read EmployeeCompensation(Query) GraphQL API & set it inPayrollItemRef
in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Employee",
"EmployeeRef": { "value": "1" },
"PayrollItemRef": {
"value": "626270109"
},
"Hours": 8,
"Minutes": 0,
"Description": "Construction:TimeOff"
}
Use Case 3: Create Time Activity and link to projects
This use case is applicable for the customers who are not enrolled to QuickBooks Payroll and have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Fetch
employee->Id
by calling V3 Accounting Employee Query & set it inEmployeeRef
in the TimeActivity object withNameOf
field asEmployee
. - Fetch
Item->id
from V3 Accounting Query Item API & set it inItemRef
in the TimeActivity object. - Fetch
project -> Id
from Read Project(Query) GraphQL API to readproject -> id
& set it inProjectRef
in the TimeActivity object. - Fetch
Customer -> id
from V3 Accounting Customer Query API (optional) & set it inCustomerRef
in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Employee",
"EmployeeRef": { "value": "1" },
"ItemRef": { "value": "1" },
"CustomerRef": {
"value": "2"
},
"ProjectRef": {
"value":"416296152"
},
"Hours": 8,
"Minutes": 0,
"Description": "Construction:DailyWork"
}
Use Case 4: Create Time Entry for employee
This use case is applicable for the customers who are not enrolled to QuickBooks Payroll and do not have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Read
employee->Id
by calling V3 Accounting Employee Query & set it inEmployeeRef
in the TimeActivity object withNameOf
asEmployee
. - Fetch
Item->id
from V3 Accounting Query Item API & set it inItemRef
in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Employee",
"EmployeeRef": { "value": "1" },
"ItemRef": { "value": "1" },
"Hours": 8,
"Minutes": 0,
"Description": "Construction:DailyWork"
}
Use Case 5: Create Time Activity for contractor
This use case is applicable to track time for contractors and for the customers who do not have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Fetch
Vendor -> Id
from V3 Accounting Vendor Query API & set it inVendorRef
in the TimeActivity object withNameOf
asVendor
. - Fetch
Item->id
from V3 Accounting Query Item API & set it inItemRef
in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Vendor",
"VendorRef": { "value": "5" },
"ItemRef": { "value": "1" },
"Hours": 8,
"Minutes": 0,
"Description": "Construction:DailyWork"
}
Use Case 6: Create Time Activity for contractor and link it to projects
This use case is applicable to track time for contractors and for customers who have the Projects enabled in QuickBooks Online.
Use V3 Create TimeActivity API to create time activity by
- Fetch
Vendor -> Id
from V3 Accounting Vendor Query API & set it inVendorRef
in the TimeActivity object withNameOf
asVendor
. - Fetch
project -> Id
from Read Project(Query) GraphQL API to readproject -> id
& set it inProjectRef
in the TimeActivity object. - Fetch
Customer -> id
from V3 Accounting Customer Query API (optional) & set it inCustomerRef
in the TimeActivity object.
Sample request payload:
{
"TxnDate": "2024-08-01T12:00:00Z",
"NameOf": "Vendor",
"VendorRef": { "value": "5" },
"CustomerRef": {
"value": "2"
},
"ProjectRef": {
"value":"416296152"
},
"ItemRef": { "value": "1" },
"Hours": 8,
"Minutes": 0,
"Description": "Construction:DailyWork"
}
Appendix
Reference of (Contractor) - Vendor with Vendor1099
true: