Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Detect MIME Type

file.detect_mime

ProductionBounded custom (Class B)Deterministicverifiablefastv1.0.0
File inputNo network

Overview

You give us a managed file reference and we detect its MIME type from content magic bytes, cross-check the filename extension and any declared content type you supply, and flag mismatches (for example a PNG named .txt). We read only a bounded prefix — we never fully parse or render the file. Do not use this when you need deep structural validation of a complex document.

Filenames lie — content-based detection is safer for routing and validation.

Reliability

The same bytes give the same answer on this deployment, though a Tika upgrade can refine a type or a confidence score, so treat the value as version-sensitive rather than frozen forever. A file reference resolves only inside your own tenant; if it has expired or was never yours, you get a validation error saying it is not accessible, and retrying will not change that — upload the file again and pass the new reference. A readLimitBytes outside 1 to 5,242,880 or a mode outside content_first, extension_first, and strict fails the same way, so fix the field and call again. A clean result says what the bytes look like; it never certifies that a file is free of malware.

Context footprint

Returns mimeType, confidence, mismatch flags, optional warnings, and inspection metadata. A successful call costs 5 execution credits.

When to use it

Before you process or route an uploaded file based on its type.

When you need deep structural validation or malware scanning.

Scope

Note
Detects MIME type from a bounded content prefix with optional extension cross-check.

Non-goals

  • Does not fully parse or render files
  • Does not trust the filename extension alone in content_first mode
  • Does not validate archive structure or malware

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysisparsing

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call5 credits

File handling

Accepts file_refProduces file_refMax input2 MBMax file size5 MB

File limits

Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.

LimitValueLimited by
Maximum size per input file5 MiBSkill and platform maximum

How we handle your data

Protected temp storage
What this means

This skill may temporarily store files or intermediate data only to complete execution. Temporary data is protected and automatically deleted.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Temporary execution only storage
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response may contain submitted or transformed content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
fileRefstringYesManaged file reference resolved inside the current tenant.
filenamestringNoOriginal filename used for extension hinting; omit it to skip the extension cross-check.
declaredContentTypestringNoContent type the client claims; omit it to skip that comparison.
readLimitBytesintegerNoMaximum prefix bytes to inspect; omit it for 1048576.
modestringNoHow content and extension are combined; omit it for content_first.

Output schema

FieldTypeRequiredDescription
okbooleanYesAlways true on success.
mimeTypestringYesResolved MIME type for the inspected prefix.
extensionMimeTypestringNoMIME type implied by filename; omitted when filename was not supplied.
declaredContentTypestringNoEcho of declaredContentType when supplied.
confidencenumberYesDetection confidence from 0 through 1.
mismatchbooleanYesTrue when resolved type disagrees with extension or declared type.
warningsarrayNoBounded array of 0 through 16 plain-text advisories, where each item is one non-fatal warning string.
metadataobjectNoClosed detection metadata naming bytes inspected, mode, and engine.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"file.detect_mime","input":{"fileRef":"squillify://files/f-1","filename":"report.pdf"}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("file.detect_mime", {"fileRef":"squillify://files/f-1","filename":"logo.txt"});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not fully parse or render files
  • Does not trust the filename extension alone in content_first mode
  • Does not validate archive structure or malware
  • Deep PDF, Office, or media structural validation
  • Malware scanning or archive safety checks

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "file.detect_mime",
  "input": {
    "fileRef": "squillify://files/f-1",
    "filename": "logo.txt"
  }
}

Examples

PNG bytes with a .txt filename — mismatch flagged

Inputjson
{
  "fileRef": "squillify://files/f-1",
  "filename": "logo.txt"
}
Expected outputjson
{
  "confidence": 0.95,
  "ok": true,
  "mimeType": "image/png",
  "mismatch": true,
  "metadata": {
    "detectionMode": "content_first",
    "bytesInspected": 8,
    "engine": "tika-core"
  },
  "extensionMimeType": "text/plain"
}

JSON detected from content without a filename hint

Inputjson
{
  "fileRef": "squillify://files/f-json"
}
Expected outputjson
{
  "mimeType": "application/json",
  "ok": true,
  "mismatch": false,
  "confidence": 0.7,
  "metadata": {
    "detectionMode": "content_first",
    "bytesInspected": 7,
    "engine": "tika-core"
  }
}
  • Route uploads before downstream processing
  • Flag spoofed extensions before extraction
  • Pick the right parser skill from content, not filename alone

Avoid for

  • Deep PDF, Office, or media structural validation
  • Malware scanning or archive safety checks

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

mimedetectionfile