REST API
File Signature API Documentation
Retrieve magic bytes, MIME types, byte offsets, risk levels, and generated validation code from the same data that powers the HTML reference pages. A machine-readable OpenAPI document is available at /openapi.json.
Endpoint
https://filesignature.org/api/v1
Example request
curl https://filesignature.org/api/v1/pdf
Quick Start
1. Request an extension
Use a lowercase extension such as pdf or docx.
2. Read the primary signature
The response includes the primary hex bytes, offset, MIME types, related formats, and code snippets.
3. Identify bytes when needed
Call /identify with hex header bytes when you do not know the extension.
Endpoints
/identify
Identify matching file formats from pasted header bytes. Use this when you have a buffer but not a trustworthy filename extension.
Parameters
hex(string, required) - Header bytes as hex, for example25 50 44 46 2D,0x255044462D, or25-50-44-46-2D.
Response
{
"success": true,
"data": {
"query": { "hex": "25 50 44 46 2D", "bytes": 5 },
"matches": [
{
"ext": "pdf",
"name": "Adobe Portable Document Format",
"mime": ["application/pdf"],
"risk_level": "Safe",
"signature": { "hex": "25 50 44 46 2D", "offset": 0 },
"url": "https://filesignature.org/pdf"
}
]
}
}
Try the browser tool at /lookup, or request /api/v1/identify?hex=25%2050%2044%2046%202D.
/{extension}
Retrieve signature data for a specific file extension.
Parameters
extension(string, required) - The file extension, for examplepdforpng.
Response
{
"success": true,
"data": {
"ext": "pdf",
"name": "Adobe Portable Document Format",
"mime": "application/pdf",
"hex": "25 50 44 46 2D",
"offset": 0,
"usage": {
"python": "...",
"node": "..."
}
}
}
/suggest
Return autocomplete suggestions for extension prefixes.
Parameters
q(string, required) - Search query with at least 2 characters.
Response
{
"suggestions": [
"tar",
"targa"
]
}
Errors
API errors return success: false with a short message describing what to fix next.
{
"success": false,
"error": "Extension not found"
}
Try It
Start with common extensions, then move into the full directory when you need something less common.