# WritersLogic Magic Bytes File Type Verifier

> WritersLogic Magic Bytes File Type Verifier is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-19).

Validates that a file's actual binary signature (magic bytes) matches its claimed MIME type or file extension before an agent opens, parses, or forwards it

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/magic-bytes?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-magic-bytes-file-type-verifier-4570e849
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_3_2NPmVga9081tijYrYGX

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 writerslogic-magic-bytes-file-type-verifier-4570e849 -d '<json body>'
```

Example prompt: Before I open this download, check if it's really a PDF — here are the first 32KB of bytes (base64-encoded): [base64string], the file is named 'report.pdf' and has MIME type 'application/pdf'; also check the last 4KB [tail_base64] and total size is 1048576 bytes.

## When to prefer this

Use this endpoint when an AI agent is about to open, parse, or forward a file download and needs a fast, low-cost sanity check that the file's binary signature matches its claimed type — especially to catch HTML disguised as PDFs, mislabeled executables, or truncated archives. Prefer this over malware scanners when you need a lightweight structural check rather than deep content analysis. This is ideal in automated pipelines where untrusted files arrive with claimed MIME types or extensions that could be spoofed.

## Known failure modes

- Base64 input exceeds the 32 KiB head or 4 KiB tail limits — request rejected
- Neither claimedMime nor claimedName provided — no claim to compare against
- Ambiguous result when file type is not among the supported signatures (PNG, JPEG, GIF, WebP, ZIP/OOXML, GZIP, PDF, MP4, ELF, PE, RAR, BMP, ICO, HTML)
- False negative possible if attacker-crafted bytes pass signature check but file is otherwise malformed
- Cannot detect malware or validate internal image pixel data — only structural markers are checked

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

Returns whether the file's binary magic bytes and structural markers are consistent with the claimed MIME type and/or file extension, identifies the detected actual file type, flags cases where an HTML login or error page is disguised as another format, and reports whether truncation is detected based on end-of-file markers and optional tail bytes or total size

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "head": {
   "type": "string",
   "maxLength": 43692,
   "description": "Standard padded base64 of the first bytes of the file (up to 32768 bytes decoded)."
  },
  "tail": {
   "type": "string",
   "maxLength": 5464,
   "description": "Optional base64 of the last bytes (up to 4096 decoded), used for end-of-file markers when head is not the whole file."
  },
  "complete": {
   "type": "boolean",
   "description": "True when head is the entire file; end-of-file markers are then checked on it."
  },
  "totalSize": {
   "type": "integer",
   "maximum": 1000000000000,
   "minimum": 0,
   "description": "Optional total file size in bytes, for size-field comparisons (RIFF, MP4 boxes, ZIP directory)."
  },
  "claimedMime": {
   "type": "string",
   "maxLength": 255,
   "description": "Claimed Content-Type, parameters ignored."
  },
  "claimedName": {
   "type": "string",
   "maxLength": 255,
   "description": "File name or path; the last extension is the claim."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-magic-bytes-file-type-verifier-4570e849/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
