# Upload a file to MDM for usage in other APIs such as app distribution, content management, and profile configuration **Deprecated** Uploads a binary file and returns file metadata including a unique file_id for subsequent API calls. **This API endpoint is deprecated** This API is deprecated as of On-Premises build 11.2.2509.XX. Use /emsapi/files for new implementations and migrate existing usage to this endpoint before it is completely removed. [View new endpoint >](https://www.manageengine.com/mobile-device-management/uploadfileems.html) ## Endpoints **POST** `/api/v1/mdm/files` --- ## Request URL ``` https://{serverurl}/api/v1/mdm/files ``` ## Scope ``` MDMOnDemand.MDMDeviceMgmt.CREATE ``` ## Header ``` Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52 ``` ## Request Body **multipart/form-data** - string --- ## Sample Request ### Curl ```curl curl --request POST \ --url https://appdomain/api/v1/mdm/files \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'content-type: multipart/form-data' ``` ### Java ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.io.IOException; import java.net.http.HttpTimeoutException; public class Main { public static void main(String[] args) { HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://appdomain/api/v1/mdm/files")) .header("content-type", "multipart/form-data") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", HttpRequest.BodyPublishers.noBody()) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ### Python ```python import http.client conn = http.client.HTTPSConnection("appdomain") headers = { 'content-type': "multipart/form-data", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("POST", "/api/v1/mdm/files", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript headersMap = Map(); headersMap.put("Accept", "application/json"); data=Map(); data.put("value","value"); response = invokeUrl [ url: "https://appDomain/api/v1/mdm/files" type: POST headers: headersMap files: data connection: connection_name ] info response; ``` ### PowerShell ```powershell $headers=@{} $headers.Add("content-type", "multipart/form-data") $headers.Add("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") $response = Invoke-WebRequest -Uri 'https://appdomain/api/v1/mdm/files' -Method POST -Headers $headers ``` --- ## Response Parameters ### HTTP code 200 **Response Body - application/json** - JSON object #### Attributes - **content_type** (string) MIME type of the uploaded file. Common values: application/vnd.android.package-archive (apk), application/x-itunes-ipa (ipa), application/zip (appxbundle, xap, appx, msix), application/x-ms-installer (msi) - **file_name** (string) Name of the uploaded file including its extension - **file_id** (long) Unique identifier assigned to the uploaded file. Use this ID to check upload status via [Get File Upload Status](https://www.manageengine.com/mobile-device-management/files-get-file-upload-status.html) - **expiry_time** (long) Unix timestamp (in milliseconds) until when the uploaded file is valid. The file will be automatically deleted after this time - **content_length** (string) Length of the uploaded file in bytes --- ## Possible HTTP Status Codes - **200** — HTTP code --- ## Sample Response: HTTP 200 ### Android APK file successfully uploaded ```json { "content_type": "application/vnd.android.package-archive", "file_name": "zylker-app.apk", "file_id": 9007199254741076, "expiry_time": 15987913528, "content_length": 2048576 } ``` ### Image file successfully uploaded ```json { "content_type": "image/png", "file_name": "check.png", "file_id": 9007199254741076, "expiry_time": 15987913528, "content_length": 1479 } ``` --- **Duration:** 1 minute **Threshold:** 30 **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.