---
title: Validate File Type API
slug: validate-file-type
url: https://apyhub.com/apyhub/service/validate-file-type
provider: ApyHub
categories: [Data Validation, Developer Tools, File Security]
tags: [file-validation, mime-type, upload-security, file-detection, document-validation]
auth: api_key
---

# Validate File Type API

Validate uploaded files or file URLs against their extension and MIME type. Get the detected type, validity flag, and a clear mismatch message.

## Endpoints

| Method | Path | Description | Atoms |
| --- | --- | --- | --- |
| POST | `/validate/file` | What it does Validates an uploaded file by comparing the detected file type against the file extens… | 25 |
| POST | `/validate/file/url` | What it does Validates a file accessible from a URL by inspecting the downloaded file and comparing… | 25 |

## About

## What it does
File Type Validator checks whether an uploaded file matches its filename extension and declared MIME type. Send a file or a file URL, and get back the original filename or URL, the extracted extension, the declared MIME type when provided, the detected MIME type from the file content, a boolean validity flag, and a human-readable message.

Use the direct upload endpoint when you receive multipart files from users or partners. The file input accepts a binary file up to 100 MB. The response tells you the file name, lowercased extension, declared MIME type, detected type, and whether the file is valid according to both checks. When you need to validate remote assets, the URL endpoint accepts a direct file URL with a recognisable extension and returns the validated URL, detected type, validity flag, and message.

This is useful for upload filters, document intake, attachment checks, and backend file safety rules. You can reject mismatched uploads, flag suspicious content types, or log validation results before passing files into conversion, storage, or processing workflows.

## Usage

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/validate-file-type
