{"uid":"cap_3_2NPmVga9081tijYrYGX","slug":"writerslogic-magic-bytes-file-type-verifier-4570e849","name":"WritersLogic Magic Bytes File Type Verifier","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/magic-bytes?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_JuUu5VX-raNWsyvYazNgK","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Catch disguised HTML phishing file","prompt":"I just downloaded a file called 'invoice.pdf' with MIME type application/pdf from an email attachment — before I open it, can you check these first 32KB of bytes (base64) to make sure it's actually a PDF and not an HTML phishing page?"},{"title":"Validate OOXML before import pipeline","prompt":"My agent is about to ingest a spreadsheet named 'data_export.xlsx' claimed as application/vnd.openxmlformats-officedocument.spreadsheetml.sheet — please check these base64 head bytes to confirm the magic bytes and OOXML structure are consistent before we parse it."},{"title":"Detect mislabeled executable in archive","prompt":"We received a file named 'update.zip' with content-type application/zip — verify these head bytes and tail bytes (both base64) against the claimed type and let me know if it looks like an ELF or PE executable instead, total file size is 2097152 bytes."}],"resultDescription":"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","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T00:32:18.249Z","isFirstParty":false,"canonicalSlug":"writerslogic-magic-bytes-file-type-verifier-4570e849"}