Add media to the description through API

Hi guys,
I am looking for a convenient way to upload a media (small icon) to the description using my Spring Boot Atlassian Connect add-on.
When I upload it manually I see in the ticket description object something like :

          "type": "mediaSingle",
          "attrs": {
            "layout": "wrap-left"
          "content": [
              "type": "media",
              "attrs": {
                "id": "e7e4ccf8-e40f-4fab-b2b5-556099aa47ce",
                "type": "file",
                "collection": "",
                "width": 47,
                "height": 39

But I did not find an API to upload such media files, I tried to do it through the Add Attachment API But it does not give me any media ID that I can use.
Please advise which API I can use to update the description with images, or even better when I create the Issue.

Found this workaround How can I add an image in a comment? for V3