Create and download time reports via API

Hi community,
we are currently integrating awork into a billing workflow for property management / professional services and would like to use time reports as the basis for customer-facing timesheets / Leistungsnachweise.

At the moment, we can create and use custom time reports manually in awork, and users can export them as PDF from the UI.
However, as far as we can see in the public API, there is currently no documented way to generate or download a time report as PDF via API.

What we are trying to achieve

We want to automate the following process:

  1. Employees track time in awork on projects/tasks

  2. We use a custom time report as the basis for a monthly timesheet

  3. On a fixed date each month (for example the 3rd), we want to:

    • generate the time report for the previous month

    • export/download it as PDF

    • save it to our document storage / DMS

    • optionally attach it to the awork project

    • use it as supporting document for invoicing

Current situation

We found and reviewed the following endpoints:

  • GET /api/v1/timereports

  • GET /api/v1/timeentries

  • GET /api/v1/timeentries/simplified

  • GET /api/v1/projects/:projectId/timeentries

  • GET /api/v1/files/:fileId/pdf

From what we understand:

  • timereports lets us access report definitions / filters

  • timeentries lets us fetch the raw time data

  • files/:fileId/pdf converts or returns an existing file as PDF, but does not generate a PDF from a time report

So right now it seems that the only robust option is to:

  • fetch the time entry data via API

  • rebuild the report externally

  • generate the PDF ourselves

That works in principle, but it means we cannot reuse the exact custom report layout users already maintain in awork.

Hi @Justus1 , nice to hear, that you are building an integration :raising_hands:t3: Your research is correct, we unfortunately don’t have an option right now to generate the time report PDF via API. I am aware of that topic and like the idea but it’s currently not on any roadmap.

We currently generate the PDF in the frontend by fetching all times for the filter, generating an html print view out of that and then use the native browser print function (not the best experience, some css styling get’s treated differently).

So in this case you would need to generate the report yourself. I would recommend fetching the timeentries with the filter string stored in the time report (don’t forget paging), generating html out of that, and then converting the html into PDF with Gotenberg or a similar tool.

Hope that helps.

Best wishes

Ian

Hi @ian ,

thank you for the prompt response. We will proceed with the solution you proposed.

Best

Justus