Skip to main content
This example walks through a complete write workflow with the Beebole GraphQL API: logging time on behalf of a team member and moving it through the approval flow. You authenticate with your API key, create a time record with addTimeRecord, adjust it, clone a full week with cloneTimeRecords, and submit the period with submitTimesheet. Every duration in Beebole is expressed in milliseconds.
These are write operations — they create and change data. For read-only reporting, see Export a month of time records.

Step 1 — Log a time entry

addTimeRecord creates one logged entry for a person on a given day. The required arguments are startTime (a Unix timestamp in milliseconds), duration (milliseconds), and personId. Pass taskId, absenceId, or projectIds to link the entry. Here the call logs 2 hours against a task.
Durations are in milliseconds. To log 2 hours, pass 7200000 (2 × 60 × 60 × 1000), not 120 and not 2.
The same operation as a GraphQL document:
The mutation returns the created record, including its id:
Store the returned id: the edit mutations in the next step need it.

Step 2 — Adjust the entry

Each editable field has its own mutation. To correct the logged duration, call editTimeRecordDuration with the record id and the new millisecond value. This changes the entry from 2 hours to 3 hours (10800000 ms):
Related per-field mutations follow the same shape: editTimeRecordDay, editTimeRecordStartTime, editTimeRecordEndTime, editTimeRecordProjects, editTimeRecordTask, editTimeRecordAbsence, editTimeRecordComment, editTimeRecordNonBillable, and editTimeRecordWfh. Each takes the record id plus the one value to change and returns the updated record.

Step 3 — Clone a full week

When a person’s week repeats a regular pattern, cloneTimeRecords copies their entries from a source period to a target period in one call. Set replaceExisting: true to clear the target period before cloning.
The mutation returns the list of newly created records:

Step 4 — Submit the timesheet

Once the period is complete, submitTimesheet sends it into the approval workflow. It takes the personId and the startTime / endTime of the period, and returns a submit event whose id you pass to approveTimesheet or rejectTimesheet later. It refuses the period with NoApprovalWorkflow when no approval workflow applies to the person, timesheetPeriodLocked when the period ends on or before the lock date, and TimesheetAlreadySubmitted when it is already waiting for approval.
The status field is the event’s action code, s for this submission. Other approval events carry a (approved), r (rejected), or f (auto-submit failed), and a period that nobody has submitted reads d (draft) in getApprovalState. When no stage of the person’s workflow has an approver, Beebole approves the period at once and the event comes back with a. Later, approveTimesheet works out the current stage on its own, while rejectTimesheet also takes the stage to reject and a comment.
Deletions made through the API cannot be undone. cloneTimeRecords with replaceExisting: true first deletes the existing records in the target period — make sure the target window is correct before sending it.

API Introduction

Authenticate with your API key and send your first request.

Mutations

Every write operation, with full argument signatures.

Queries

Read back the records you create with these mutations.