# Image Format Detector via Magic Bytes

> Image Format Detector via Magic Bytes is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Detects true image format from a URL using magic bytes analysis, returning format, content-type accuracy, file size, and dimensions — regardless of file extension or declared content-type.

## Facts

- Endpoint: GET https://api.x402node.dev/image/detect
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-997d87dc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0oJC8uagKPwo-Vfl6LwFt

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 api-x402node-dev-997d87dc
```

Example prompt: Can you check what the real image format is for this URL — https://cdn.example.com/upload/photo.jpg — I don't trust that the extension or content-type is accurate and I need to know the actual format, whether it matches, the dimensions, and the file size.

## When to prefer this

Use this endpoint when you need to validate untrusted image inputs where the file extension or Content-Type header may be spoofed or incorrect — e.g. user-uploaded images, scraped media, or third-party CDN assets. Prefer this over client-side MIME sniffing or extension-based checks when accuracy and security matter.

## Known failure modes

- URL is unreachable or returns non-image content — returns error or null format
- Image file is too large or download times out — returns timeout or size error
- URL serves a format with ambiguous or unknown magic bytes — format may be returned as unknown
- Malformed or missing URL parameter — returns 400-level validation error
- Image host blocks the request or returns 403/404 — returns fetch error

## How this service works

Detect image format from a URL using magic bytes (works even when extension or content-type lies). Returns format, content-type match flag, file size, dimensions. Use url param Built for AI agents validating untrusted image inputs. Accepts payment on Base or Solana — either network works.

## Output

Returns the true detected image format (e.g. PNG, JPEG, WEBP), a flag indicating whether the declared content-type matches the actual format, the file size in bytes, and the image dimensions (width x height). Derived from magic bytes, not extension or headers.

## 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"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "url"
     ],
     "properties": {
      "url": {
       "type": "string",
       "description": "Target URL (required)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-x402node-dev-997d87dc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
