MIME Type Lookup API
Find the MIME type and Content-Type header for a file extension or filename, the extensions for a MIME type, or search the table. Optionally detect a file's real type from its first bytes (magic numbers).
POST /api/v1/tools/mime-type-lookupMCP mime_type_lookupWeb & SEOFind the MIME type for any file extension or the extensions for a MIME type, with charset and compression notes. Detect a file's real type from its bytes.
Input
Send these as a JSON object. Unknown fields are rejected.
- query
- An extension ("webp", ".PNG"), a filename ("report.pdf"), a MIME type ("application/json") or words to search. Empty is allowed when only fileBase64 is given. (string, up to 500 characters, default "")
- fileBase64
- Optional: the first bytes of a file (up to 4 KB), Base64-encoded, to detect its real type from magic numbers. When query is a filename, the result also says whether the extension matches the content. (string, up to 8192 characters)
curl https://pithlab.com/api/v1/tools/mime-type-lookup \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"query":"photo.webp"}'Example response
{
"ok": true,
"result": {
"kind": "extension",
"exact": [
{
"extension": "webp",
"mime": "image/webp",
"contentType": "image/webp",
"text": false,
"compressible": false
}
],
"matches": [],
"truncated": false
}
}