Move time entries from one project to another


I need to write a script that moves time entries from one generic to another project. The logic is as follows: time is logged on tasks with a certain identifier in the description. Once a project with that name exists, the time entries shall be transferred accordingly.

I managed to get this working as follows but the problem I’m still facing is that the times are not showing up on the project (I mean: Projects → search for the project → it shows 0 hours). The times will show up though if I go to the project details and then click on “Status”).

So what am I doing?

  1. Using the Reports API (“workspaces/{self.workspace_id}/reports/detailed”) I fetch the time entries
  2. From the results I take the data from the “timeentries” field and modify it as follows:
te["id"] = te["_id"]
te["projectId"] = cp["id"]   # ID of the target project
te["billable"] = True
te["description"] = f"{te['description']} / auto-moved from @xyz!"
te["taskId"] = None
  1. Then I do an update.
    def update_time_entry(self, entry):
        path = f"workspaces/{self.workspace_id}/time-entries/{entry['id']}"
        data = {
            "billable": entry["billable"],
            "description": entry["description"],
            "end": entry["timeInterval"]["end"],
            "id": entry["id"],
            "projectId": entry["projectId"],
            "start": entry["timeInterval"]["start"],
            "tagIds": entry["tagIds"],
            "taskId": entry["taskId"],
        return self._put(path, data)

What am I missing?