apyhub
DATA VALIDATION · DEVELOPER TOOLS

Detect File type API

What it does

File Type Detection checks the true MIME type of a file by inspecting its magic bytes, rather than trusting the filename or extension. Send a binary file in the file field and get back the detected filename, extension, mime_type, and a short description of the file type.

Use it when uploaded files may have misleading names, missing extensions, or incorrect client-side metadata. It helps you validate user uploads before storage, route files into the right processing pipeline, or reject unsupported formats early in your workflow.

The response is simple and predictable: you get the original filename when available, the inferred extension when one can be determined, the MIME type, and a human-readable description. That makes it easy to compare what a client claims a file is versus what it actually contains.

File Type Detection is a good fit for upload forms, document ingestion systems, security checks, and any backend that needs to classify files reliably without opening them in a full parser.

POST
Detect the true MIME type of a file by inspecting its magic bytes
http://localhost:8080/dosvak/detect-file-type
QUICKSTARTGUIDE

Quickstart

Upload a file to detect its type from the file contents.

curl -X POST "http://localhost:8080/dosvak/detect-file-type" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file"

What you'll get back

Returns a JSON object with filename, extension, mime_type, and description fields.

{
  "filename": "document.pdf",
  "extension": "pdf",
  "mime_type": "application/pdf",
  "description": "PDF document"
}
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.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Detects the true file type of an uploaded file by inspecting its binary contents and returns metadata describing the file. The response includes the filename, extension, MIME type, and a human-readable description.

Request Body

ParameterTypeMandatoryDescription
fileStringYesBinary file content to inspect.

Response

Returns a JSON object with filename, extension, mime_type, and description string fields. extension is nullable, while the other fields are non-null strings.

ParameterTypeMandatoryDescription
filenameStringNoThe detected filename.
extensionStringNoThe detected file extension, or null when unavailable.
mime_typeStringNoThe detected MIME type.
descriptionStringNoA human-readable description of the detected file type.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ 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.