Creating and retrieving YouTrack reports.

Hi! I am using the YouTrack API to generate reports using the "reports/" suffix in the URL and sending the following as the POST request body:

            aggregationPolicy: {
                field: {
                    presentation: Spent time,
                    id: fieldId,
                    $type: CustomFilterField,  },  $type: ReportAggregationPolicy,  },  presentation: DEFAULT,  query: null,  name: reportName,  $type: IssuePerProjectReport,  };

This is to obtain the number of hours spent for a project (this would give it for all projects). However, when I try to send a GET request for the report (using the ID in the response of body of the POST request),  I often run in HTTP 409: Conflict.
The GET request uses the following format: "/reports/{reportID}/export/csv".

Do you know what could be the reason for this? I was also looking into recalculating the report created and from what I have noticed, the GET request should recalculated itself (I verified that the isOutdated field of the report status goes  from being true -> false after the GET request is sent). Is this correct?

Comment actions Permalink


Please excuse me for the delayed answer.

What type of report do you use? I have tried to reproduce the issue with HTTP 409 for the time report, but failed.

As for the recalculation of the report: you can use the POST request like this: Endpoint :$top=-1&fields=calculationInProgress,error(id),errorMessage,isOutdated,lastCalculated,progress,wikifiedErrorMessage


{"calculationInProgress":true, "$type":"ReportStatus"}
Comment actions Permalink

Sorry for my delayed response as well. Thank you for informing me about the endpoint for the recalculation since I was using a GET request which sometimes worked and sometimes does not. The POST request you sent will work for my purpose. I managed to resolve the 409 issue by switching to a GET request and specifying the fields instead of exporting to csv.

Also, recreating the issue is difficult because I think it only happens when the report is outdated. Basically, every time I was sending the request and it was outdated and calculation was in progress, it was giving a 409 (only when I exported to CSV so I switched to using a regular GET request instead). 

The problem is solved now but just to let you know, the type of report I was using was originally an IssuePerProjectReport and aggregating that on Spent time. Later I switched to Time Report with the following request:


"$type": "TimeReport",

"attachedFields": [],

"name": "report name",

"projects": [],

"query": null,

"range": {"$type": "NamedTimeRange", "range": {"id": "LAST_MONTH"}},

"type": "time",

"grouping": {



    "$type": "FieldBasedGrouping",

    "field": {



        "instant": false,

        "name": "project",

        "sortable": true,

        "aggregateable": false,

        "$type": "PredefinedFilterField"



Comment actions Permalink

Thank you for your answer! Glad to hear that everything is working now.

As for the 409 issue: the error code 409 means that a sent request conflicts with the current state of the resource. So it is expected that it was shown when the report was being recalculated.


Please sign in to leave a comment.