DevToolsmith

APK MIME Type

application/vnd.android.package-archive is the MIME type for Android app packages (.apk). Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/vnd.android.package-archive
Extensions
.apk
Content-Type header
application/vnd.android.package-archive
Registered
No, a common convention
Compress with gzip
No, it is already compressed
Category
Programs and binaries

About Android package files

Android only offers to install a downloaded APK when it arrives with this type; with application/octet-stream or application/zip, some browsers save it under the wrong extension. Underneath it is a ZIP file containing AndroidManifest.xml and classes.dex.

File signature

APK files start with 50 4B 03 04 ("PK", a ZIP archive). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .apk with the right Content-Type

Response header
Content-Type: application/vnd.android.package-archive
nginx (a line in the types { } block of mime.types)
application/vnd.android.package-archive apk;
Apache (.htaccess or server config)
AddType application/vnd.android.package-archive .apk
Caddy
@apk path *.apk
header @apk Content-Type "application/vnd.android.package-archive"
Check what a server sends
curl -sI https://example.com/file.apk | grep -i '^content-type'
# Content-Type: application/vnd.android.package-archive

Set the type in code

Node.js (Express)
res.set('Content-Type', 'application/vnd.android.package-archive');
// Or make the browser download it:
res.attachment('file.apk');
Python
import mimetypes

mimetypes.add_type('application/vnd.android.package-archive', '.apk')  # if your system doesn't know it
mimetypes.guess_type('file.apk')[0]  # 'application/vnd.android.package-archive'
Go
mime.AddExtensionType(".apk", "application/vnd.android.package-archive")
w.Header().Set("Content-Type", "application/vnd.android.package-archive")

Accept .apk uploads

HTML
<input type="file" accept=".apk,application/vnd.android.package-archive">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .zip (application/zip): ZIP archive
  • .jar (application/java-archive): Java archive
  • .exe (application/vnd.microsoft.portable-executable): Windows executable

More programs and binaries

.bin . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .apk files?

application/vnd.android.package-archive. The full header is "Content-Type: application/vnd.android.package-archive".

Why does my server send the wrong Content-Type for .apk?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .apk is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is APK?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. APK files start with 50 4B 03 04 ("PK", a ZIP archive). The MIME type lookup on this site reads them for you when you drop a file on it.