apyhub
DEVELOPER TOOLS · FILE MANIPULATION

MIME Type Lookup from File Name API

What it does

MIME Type Lookup maps a filename or file extension to its MIME type, and can also work in reverse from a MIME type back to a filename-style value. Send a filename in the request body, and set mode to forward or reverse when you need the opposite lookup.

Use it when you need to classify uploaded files, populate download headers, or validate file handling logic against the content type expected by your application. The service is useful anywhere file metadata is derived from a name, extension, or MIME string, especially in upload flows, storage systems, and integration code that needs a deterministic mapping.

The request schema is small and explicit: the body requires filename, and mode is optional. The response is a structured JSON object, so you can inspect the lookup result in whatever shape the API returns without guessing at file parsing rules.

If your system needs a quick MIME mapping step before processing, MIME Type Lookup keeps that logic in one place and avoids hard-coding extension tables in application code.

POST
Map a filename/extension to its MIME type (and back).
http://localhost:8080/creightonnick0/mime-type-lookup
QUICKSTARTGUIDE

Quickstart

Look up the MIME type for a filename by sending the required filename in a JSON body.

curl -X POST "http://localhost:8080/creightonnick0/mime-type-lookup" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"filename":"photo.webp"}'

What you'll get back

Returns a JSON object with a structured response. The output schema does not declare any top-level fields, so the exact response shape is not specified here.

{
  "mode": "forward",
  "input": "photo.webp",
  "extension": ".webp",
  "mime_type": "image/webp",
  "known": true,
  "is_text": false,
  "charset": null,
  "encoding": null,
  "canonical_extension": ".webp"
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
forward (default) | reverse
A filename, extension, or (in reverse mode) a MIME type

About this endpoint

What it does

Maps a filename or extension to its MIME type, or performs the reverse lookup when requested. The request body accepts the input value as filename and an optional mode to choose forward or reverse mapping.

Request Body

ParameterTypeMandatoryDescription
modeStringNoforward (default) or reverse.
filenameStringYesA filename, extension, or, in reverse mode, a MIME type.

Response

FieldTypeDescription
modeStringThe lookup mode used to process the request.
inputStringThe value provided in the request, such as a filename, file extension, or MIME type.
extensionStringThe file extension extracted from the input or associated with the lookup result.
mime_typeStringThe MIME type corresponding to the provided file extension or filename.
knownBooleanIndicates whether the extension or MIME type is recognized by the API.
is_textBooleanIndicates whether the resolved MIME type represents a text-based format.
charsetStringNull
encodingStringNull
canonical_extensionStringThe standard or preferred file extension for the resolved MIME type.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.