{"id":5039,"date":"2026-03-31T11:23:55","date_gmt":"2026-03-31T11:23:55","guid":{"rendered":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/?page_id=5039"},"modified":"2026-04-01T04:50:53","modified_gmt":"2026-04-01T04:50:53","slug":"api-to-remove-files","status":"publish","type":"page","link":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/actions\/api-to-remove-files\/","title":{"rendered":"Remove files"},"content":{"rendered":"<div class=\"method-copy\">\n<div class=\"method-copy-padding\">\n<h2>Remove File<\/h2>\n<p>This API request creates a remote action, so targeted devices delete listed file paths from their local storage. This is generally used to clean up files that were previously distributed to devices (files that went through the <a href=\"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/content-management\/api-to-generate-pre-signed-upload-url\/\" target=\"_blank\" rel=\"noopener noreferrer\">Generate Presigned Upload URL<\/a>, Upload to Amazon S3, <a href=\"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/content-management\/api-to-verify-file-upload\/\" target=\"_blank\" rel=\"noopener noreferrer\">Verify File Upload<\/a>, and <a href=\"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/actions\/file-deployment-via-api\/\" target=\"_blank\" rel=\"noopener noreferrer\">Deploy File<\/a> lifecycle).<br \/>\n<strong>Note:<\/strong> This API is only supported on macOS and Android platforms.<\/p>\n<div class=\"table-responsive\">\n<table id=\"table_91028374\" class=\"table table-bordered\" width=\"100%\">\n<thead>\n<tr>\n<th width=\"15%\"><strong>Argument<\/strong><\/th>\n<th width=\"12%\"><strong>Type<\/strong><\/th>\n<th width=\"30%\"><strong>Description<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>file_paths<\/td>\n<td>Array<\/td>\n<td>Destination path or path\/filename to be removed<\/td>\n<\/tr>\n<tr>\n<td>users<\/td>\n<td>Array<\/td>\n<td>IDs of the users<\/td>\n<\/tr>\n<tr>\n<td>usergroups<\/td>\n<td>Array<\/td>\n<td>IDs of the user groups<\/td>\n<\/tr>\n<tr>\n<td>devices<\/td>\n<td>Array<\/td>\n<td>IDs of the devices<\/td>\n<\/tr>\n<tr>\n<td>devicegroups<\/td>\n<td>Array<\/td>\n<td>IDs of the device groups<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>(Note: At least one of users, usergroups, devices, or devicegroups must be non-empty).<\/em>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"method-example\">\n<div class=\"curl-text\">curl<\/div>\n<div class=\"code-curl code-div active-code\">\n<div class=\"method-example-part\">\n<p>HTTP Request:<\/p>\n<pre class=\"lang:default decode:true\">POST https:\/\/<portal>.hexnodemdm.com\/api\/v1\/actions\/remove-file\/\r\n\r\nheaders:-\r\nAuthorization: <api key>\r\nContent-Type: application\/json\r\nSample Post Data:-\r\n{  \r\n\"file_paths\": [\"\/user\/local\/docs\/report.pdf\"],  \r\n\"users\": [2, 3],  \r\n\"usergroups\": [4],  \r\n\"devices\": [5, 6],  \r\n\"devicegroups\": [12]  \r\n}\r\n<\/pre>\n<p>Shell Command:<\/p>\n<pre class=\"lang:default decode:true\"> curl -H \"Authorization: <api key>\" -H \"Content-Type: application\/json\" -d '{\"file_paths\":[\"\/user\/local\/docs\/report.pdf\"],\"users\":[2,3],\"usergroups\":[4],\"devices\":[5,6],\"devicegroups\":[12]}' https:\/\/<portal>.hexnodemdm.com\/api\/v1\/actions\/remove-file\/\r\n<\/pre>\n<\/div>\n<\/div>\n<div class=\"code-curl code-div active-code\">\n<div class=\"method-example-part\">\n<p>HTTP Response:<\/p>\n<pre class=\"lang:default decode:true\">{ \r\n  \"message\": \"Action Created\" \r\n}\r\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Remove File This API request creates a remote action, so targeted devices delete listed file paths from their local storage. This is generally used to clean up files that were previously distributed to devices (files that went through the Generate Presigned Upload URL, Upload to Amazon S3, Verify File Upload, and Deploy File lifecycle). Note: [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"parent":3698,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-5039","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/5039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/comments?post=5039"}],"version-history":[{"count":4,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/5039\/revisions"}],"predecessor-version":[{"id":5057,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/5039\/revisions\/5057"}],"up":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/3698"}],"wp:attachment":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/media?parent=5039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}