MIME Lookup

MIME Lookup API

Development

Quickly find MIME types and content types for any file extension. Essential tool for developers, webmasters, and system administrators.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

120 requests per minute

Endpoints

2 endpoints available

Overview

Looks up the MIME type and the Content-Type header value for a file extension, file name or path, using the mime-types database. Nothing is read from a file; only the extension in the text you send is used.

Behavior

  • Accepts an extension with or without the dot (png, .png) or a name or path (report.final.pdf).
  • Matching is case-insensitive.
  • An unknown extension is not an error: you get found: false and null values.
  • contentType adds a charset for text types, for example text/html; charset=utf-8.

Endpoints

GET
https://opentools.ca/api/v1/tools/mime-lookup
Look up a MIME type

Query Parameters

ParameterTypeRequiredDescription
filename
string
Required
File extension, file name or path, 1 to 500 characters.

Response Example

{
  "success": true,
  "filename": "index.html",
  "found": true,
  "mimeType": "text/html",
  "contentType": "text/html; charset=utf-8"
}

Error Codes

400
Bad Request - Missing or too long filename
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error
POST
https://opentools.ca/api/v1/tools/mime-lookup
Look up a MIME type (JSON body)

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
filename
string
Required
File extension, file name or path, 1 to 500 characters.

Response Example

{
  "success": true,
  "filename": "archive.xyz123",
  "found": false,
  "mimeType": null,
  "contentType": null
}

Error Codes

400
Bad Request - Missing or too long filename
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl "https://opentools.ca/api/v1/tools/mime-lookup?filename=index.html"   -H "Authorization: Bearer YOUR_API_KEY"

curl -X POST https://opentools.ca/api/v1/tools/mime-lookup   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"filename": "photo.webp"}'

Ready to get started?

Create an API key to start using the MIME Lookup API.

Rather use it in your browser? Open the MIME Lookup