Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Feature Request: Upload attachment to test result in mini API


Hi guys,

As was the case with my last post, I have another enhancement request for the mini API to use with our test automation framework.

We would like to be able to leverage the ability that exists in the standard interface to add file attachments to test results. We realize this is not as straightforward a feature to port over to the mini API as others for the simple fact that there is no active user with an authenticated connection to their local filesystem involved. We’re open to any suggestions you guys may have to make things simple within the confines of the current system and without sacrificing security. For instance, having us make the desired attachment accessible via an FTP or HTTP location on the TestRail server’s network and providing a URL to the API or something along those lines works for us.

I’m just spitballing… If you guys have other ideas that would be easier or a better fit in your opinion, I’m sure we could make it work on our end.




Hi Costa,

Thanks for your request and feedback. We’ve received the request to support attachments via the API before and it’s already on our feature request list. We want to look into this eventually as we understand that this would be an useful enhancement to the API. This is not scheduled for a specific release so I don’t have a timeframe for this at the moment unfortunately.

In the meantime you could simply include links to the files in the result or case description fields. TestRail’s Markdown formatting allows you to include links to a separate HTTP server or directory for example so you could upload any files separately and include a link to this file in the description.

When we add attachment support to the API we will likely use the standard HTTP mechanisms to upload and download the files.

I hope this helps.



Is there any status on this? I would like to see this request implemented too <(^_^)>



Hello Adron,

That’s not yet supported but it’s still on our list of things to look into. The API is constantly being improved and attachment support will be added eventually as well.

I hope this helps and please let me know in case you have any further questions or feedback.



I vote for this feature too!
any status update here? uploading attachments via the mini api would be great!


Hello David,

Thanks for your posting. The next version of TestRail will come with a new API and while attachments won’t be supported with the initial version it is planned to add this to the new API and we would like to look into this for one of the versions after the next one (3.0).



+1 vote for this feature


Thanks for your feedback, Blestka!



any update regarding this feature request ?


Hello Raji,

Thanks for your posting. The new and improved API has now been available for a while:

Attachment support is not yet part of the API but will most likely be added as part of the next larger API update.



I also vote for that feature!
We using TestRail for System testing and UAT, for UAT users it’s very handy to raise issue within TestRail and not need to go to JIRA, but it would be great to have functionality to also add screenshots in the same time as it would save additional time to reconcile and devs/test to understand what the defect was about.


I added your vote to this request, thanks for your feedback on this!



Yet another vote for this feature from me. It would allow us to integrate our automated testing more completely into our existing process.


Added to the list as well, thanks!



+1 from us too.

We will likely add a workaround soon to push a base64 encoded file to a different directory on the web server, which would return a link in the appropriate markdown syntax (we will be adding screenshots to our test results where appropriate).


Added to the list, thanks, Glenn.

Uploading the image elsewhere and then simply including a link/embedding the image is also our recommended workaround for this currently.



Just on this - I have nearly finished adding support to upload images on the API side, but I’m wondering if there is a model for adding entries to the attachments table?

i.e. in the miniapi, there is the following code:



$id = $this->milestone_model->insert(

If there was a similar model I could access to be able to add attachment entries it would make my life much easier - then I can use the proper attachment viewmodel url:

Then I would not have to add another virtual host to serve the contents of another folder for these images I am adding and opening ourselves up to potential security issues.

Note that I do not wish to associate this with a Test Case or a Test Result (I want the image displayed inline and can do this via markdown), not sure if that’s a problem.


Hello Glenn,

Thanks for the update. Modifying the API code is not supported and please do not change anything in the miniapi.php files or write directly to the database. This can lead to inconsistencies in the database and we cannot support such a modified database unfortunately. We recommend uploading screenshots or attachments to an external location and referencing/embedding those screenshots/attachments with links as a workaround in the meantime.



Hi Tobias,

Since when has modifying the mini api been unsupported? We have been told previously by gurock that modifications to the miniapi files (for read only queries or using the helper functions) were absolutely fine.

I was asking whether you had a model available to the miniapi that would be able to be used as a supported interface to add attachments.


Hello Glenn,

Thanks for your reply. We can support read-only modifications but do not recommend this (as this makes it difficult to update to newer API versions) but using the models to make database changes wouldn’t be supported. The main reason for this is that the model functions may change across TestRail versions (and they do) and it wouldn’t really be safe to use them. We have different mini API versions depending on the TestRail version and this is mostly due to model and database changes:

The new/current v2 API wouldn’t be affected by this as this API is directly included with TestRail and always up to date.