# File Type Detector

> File Type Detector is a paid API for AI agents from bess-x402.onrender.com, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-29).

Detects a file's real format from its magic bytes (base64 or hex), returning MIME type, extension, and a mismatch warning if the filename doesn't match.

## Facts

- Endpoint: GET https://bess-x402.onrender.com/v1/util/file-type?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/file-type-detector-e683e189
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_fKr_DC9qP07-U3nnKWr2r

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability file-type-detector-e683e189
```

Example prompt: Can you check whether these base64 bytes actually correspond to a PDF file — here's the encoded header data: 'JVBERi0xLjQK...' and the uploaded filename is 'report.pdf'?

## When to prefer this

Choose this endpoint when you need to validate file uploads server-side by inspecting actual file content rather than trusting user-supplied filenames or MIME headers. It is especially useful for security-sensitive upload flows where disguised executables or mismatched file types pose a risk, and when you need a lightweight, per-call check without standing up your own magic-number detection library.

## Known failure modes

- Too few bytes provided to identify the format — magic number detection requires at least a handful of bytes from the file header
- Unknown or unsupported file format — returns a null or unknown type if the magic bytes don't match any known signature
- Invalid base64 or hex encoding — malformed input will cause a parsing error
- Missing required 'data' query parameter returns an error
- Very short or truncated byte sequences may lead to ambiguous or incorrect detection

## How this service works

Detect a file's real format from its first bytes (magic numbers), given as base64 or hex: MIME type, extension and a warning when it does not match the file name. Use to validate uploads.

## Output

Returns the detected MIME type (e.g. 'application/pdf'), the standard file extension (e.g. 'pdf'), and an optional warning if the detected type does not match the provided filename — enabling reliable validation of file uploads regardless of their stated extension.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "data"
     ],
     "properties": {
      "data": {
       "type": "string",
       "description": "First bytes of the file (base64 or hex)"
      },
      "encoding": {
       "type": "string",
       "description": "base64 or hex"
      },
      "filename": {
       "type": "string",
       "description": "Original file name (optional)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/file-type-detector-e683e189/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from bess-x402.onrender.com](https://www.zero.xyz/host/bess-x402.onrender.com/llms.txt)
