How to add a comment to an issue?

I'm trying to add comment to an issue under another user with the Python library

import json

from youtrack.connection import Connection as YouTrack


issue_id = "ABC-12"

data = {
"text": "Add comment from **API**.",
"usesMarkdown": True,
"author": "support",

response = yt._req(


It works without the line "author": "support", but I need to add a comment under the other user (every time it will be different user).

How can I do this?


For posterity, we were able to solve this problem - the field "author" expects an User object, which is identified by an ID like "1-23":

data = {
"text": "Add comment from **API**.",
"usesMarkdown": True,
"author": { "id": "1-23" },

Unfortunately, internal YouTrack workflows do not have access to User IDs for some reason, and can only access user logins.

Therefore, to find an ID by login, one needs first to query /users API, which doesn't support filtering by login, ask it to return logins and ids for all users ($top=-1), and filter the resulting set.

Quite annoying and inefficient, but not impossible.


I have been able to gain access to a list of user but the entire list for all users has eluded me. I haven't been able to incorporate the "$top=-1" into my url properly. Would someone please advise. I am currently using this query:

https://youtrack. . . /api/users?fields=id,login,fullName

I only get a fraction of the users listed.


We simply use /api/users?$top=-1, but we have less than 42 users at the moment, so I can't really say whether it's actually working or not.


The query you are using only returns the user id but no identifying information, so there is only a list of user id's:

[{"id": "1-1","$type": "User"},
{"id": "1-32","$type": "User"},

If you need additional information, the query needs to include a request for additional fields. That will give you the information necessary to cross reference the user id with other identifying information. Here is an example of that:


[{"login": "admin","fullName": "admin","id": "1-1","$type": "User"},

This seems to pull a list closer to "all users", though I haven't been to completely confirm this. I increased the query to $top=500, which is more than the number of users I know we are using. At that point it seemed to be more complete.


Alright, fine - we are actually using /api/users?fields=id,login&$top=-1 - I didn't include fields parameter, because it's irrelevant in this context. If you are able to reproduce your issue, maybe you should provide a reproducer to YouTrack developers so that they can analyse and fix the problem...


Hello. Should you find an issue that is needed to be reported please submit a support request at


Please sign in to leave a comment.