Linux File Magic API (1.5.2)

Download OpenAPI specification:

License: Apache 2.0

REST API for libmagic analysis on Linux x86_64. - Protocol: Versioned URI paths (/v1). - Security: Strict relative path validation and 100MB body limit. - Tracing: X-Request-ID included in all JSON responses.

Analyze via raw octet-stream (v1)

Analyzes binary content. The server handles the request body based on its size and transfer encoding: - Chunked Transfer Encoding: Content is streamed and written to a temporary file for analysis. - Content-Length > threshold: If the Content-Length exceeds the configured large_file_threshold_mb, the content is streamed and written to a temporary file. - Content-Length <= threshold: For smaller, non-chunked requests, the content is held in memory for analysis. Threshold is configurable (default: 10MB). Max body limit is 100MB.

Authorizations:
basicAuth
query Parameters
filename
required
string (WindowsCompatibleFilename) <= 310 characters ^[^/\0]+$
Example: filename=analysis_data.bin

UTF-8 encoded filename. Note: This API intentionally accepts filenames that violate standard Windows filesystem constraints. It allows up to 310 characters (exceeding the 260-character MAX_PATH) and does not restrict Windows-reserved characters, as the underlying platform is Linux.

Request Body schema: application/octet-stream
required

Raw binary data (Max 100MB).

string <binary>

Responses

Response samples

Content type
application/json
{
  • "request_id": "550e8400-e29b-41d4-a716-446655440000",
  • "filename": "example_file.dat",
  • "result": {
    }
}

Analyze via local relative path (v1)

Authorizations:
basicAuth
query Parameters
filename
required
string (WindowsCompatibleFilename) <= 310 characters ^[^/\0]+$

UTF-8 encoded filename. Note: This API intentionally accepts filenames that violate standard Windows filesystem constraints. It allows up to 310 characters (exceeding the 260-character MAX_PATH) and does not restrict Windows-reserved characters, as the underlying platform is Linux.

path
required
string (RelativePath) ^(?!\/)(?!.*(\.\.|\.\/|\/\/))(?!\.$)[^ ].*$

Relative path (no traversal allowed).

Responses

Response samples

Content type
application/json
{
  • "request_id": "550e8400-e29b-41d4-a716-446655440000",
  • "filename": "example_file.dat",
  • "result": {
    }
}

Health check

Responses

Response samples

Content type
application/json
{
  • "message": "pong",
  • "request_id": "550e8400-e29b-41d4-a716-446655440000"
}