---
title: Validate File Type API
slug: validate-file
url: https://apyverse.com/apyhub/service/validate-file
provider: ApyHub
categories: [Data Validation, File Security]
auth: api_key
---

# Validate File Type API

Validate uploaded files or file URLs by comparing extension, declared MIME, and detected type. Useful for intake checks and spoofed-file rejection.

## Endpoints

| Method | Path | Description | Atoms |
| --- | --- | --- | --- |
| POST | `/validate/file` | What it does Validates an uploaded file by comparing the file’s detected type against the client-pr… | 25 |
| POST | `/validate/file/url` | What it does Validates a file referenced by a URL and returns the URL that was checked, the detecte… | 25 |

## About

## What it does
File Validator checks whether an uploaded file matches its filename extension and declared MIME type. Send a binary file and get back the original `file_name`, extracted `extension`, client `mime_type`, detected `detected_type`, a boolean `is_valid`, and a human-readable `message`.

Use it when you need to confirm that a file is what it claims to be before you store, process, or forward it. The upload endpoint accepts a single `file` up to 100 MB. If you already have a direct download link, the URL endpoint takes a `file_url` and validates the downloaded file instead. In both cases, the service reports the detected file type from the binary content so you can compare it against the expected type.

File Validator is useful for intake forms, document pipelines, attachment checks, and any workflow where extension spoofing or bad MIME declarations can cause downstream failures. A mismatched PDF, image, or Office document is surfaced clearly in the response so you can reject it or route it for review.

## Usage

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