# Document & Email Archive Unpacker (EML, MSG, PDF Tables) (`shikitoka/doc-archive-unpacker`) Actor

Deterministic unpacker for .eml, Outlook .msg, multi-page PDF tables, .xlsx, .docx, and .zip bundles into clean schema-locked JSON for n8n, Make, and MCP agents.

- **URL**: https://apify.com/shikitoka/doc-archive-unpacker.md
- **Developed by:** [Nanda Leo Ardana](https://apify.com/shikitoka) (community)
- **Categories:** Automation, AI, Developer tools
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 file unpackeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Document & Email Archive Unpacker (`doc-archive-unpacker`)

Deterministic, zero-LLM unpacker for **`.eml`**, **Outlook `.msg`**, **multi-page PDF tables**, **`.xlsx`**, **`.docx`**, and **`.zip`** bundles — built for **n8n Cloud, Make, Zapier, and MCP AI agents**.

### Why Use This Instead of Generic Extractors

- **Handles formats that break n8n Cloud:** Outlook `.msg`, nested MIME `.eml` attachments, `.zip` bundles, and multi-page PDF tables in one schema-locked JSON output.
- **Zero proxy & zero LLM token cost:** Pure deterministic parsing (`extract-msg`, `pdfplumber`, `openpyxl`, `python-docx`, stdlib `email`).
- **Dual-Mode (Batch + MCP Standby):** Run batches via API / n8n HTTP node, or connect AI agents to `/mcp` (`unpack_document_url`, `unpack_document_base64`).
- **Security-hardened:** Blocks SSRF/private IPs on URL fetches, enforces zip-bomb byte/entry limits, and sanitizes attachment filenames.

### Batch Input Example

```json
{
  "files": [
    {
      "filename": "invoice_bundle.eml",
      "url": "https://example.com/public/invoice_bundle.eml"
    }
  ]
}
```

### Pricing (Pay-Per-Event)

- **`file-unpacked`** (`$0.02`): Charged once per root document successfully unpacked.
- **`attachment-extracted`** (`$0.002`): Charged per nested attachment unpacked or structured table extracted.
- Failed downloads or invalid payloads (`status: "error"`) are **never charged**.

### Connect via MCP (Claude, Cursor, Windsurf)

```json
{
  "mcpServers": {
    "doc-archive-unpacker": {
      "type": "http",
      "url": "https://shikitoka--doc-archive-unpacker.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

### n8n / Make HTTP Integration

In n8n, add an **HTTP Request** node:

- **Method:** `POST`
- **URL:** `https://api.apify.com/v2/acts/shikitoka~doc-archive-unpacker/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN`
- **JSON Body:**

```json
{
  "files": [
    {
      "filename": "{{ $json.fileName }}",
      "base64Content": "{{ $binary.data.data }}"
    }
  ]
}
```

# Actor input Schema

## `files` (type: `array`):

List of file objects: {"url": "https://...", "filename": "doc.pdf"} or {"base64Content": "...", "filename": "email.eml"}.

## `urls` (type: `array`):

Optional list of direct public HTTP(S) URLs to .eml, .msg, .pdf, .xlsx, .docx, or .zip files.

## Actor input object example

```json
{
  "files": [
    {
      "filename": "sample_invoice.eml",
      "base64Content": "U3ViamVjdDogU2FtcGxlIEludm9pY2UgIzEwNDIKRnJvbTogYmlsbGluZ0BleGFtcGxlLmNvbQpUbzogYXBAZXhhbXBsZS5jb20KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PSI9PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0iCgotLT09PT09PT09PT09PT09PTMxMjM2Mzc2NzQwNjU1MjEwMDE9PQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9InV0Zi04IgpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CgpQbGVhc2UgZmluZCBhdHRhY2hlZCB0aGUgT2N0b2JlciBsaW5lIGl0ZW1zIENTVi4KCi0tPT09PT09PT09PT09PT09MzEyMzYzNzY3NDA2NTUyMTAwMT09CkNvbnRlbnQtVHlwZTogdGV4dC9jc3YKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJpbnZvaWNlXzEwNDIuY3N2IgpNSU1FLVZlcnNpb246IDEuMAoKYVhSbGJTeHhkSGtzZFc1cGRGOTFjMlFLUTJ4dmRXUWdRMjl0Y0hWMFpTd3lMREV5TGpVd0NsTjFjSEJ2Y25Rc01TdzFNQzR3TUFvPQoKLS09PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0tLQo="
    }
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "files": [
        {
            "filename": "sample_invoice.eml",
            "base64Content": "U3ViamVjdDogU2FtcGxlIEludm9pY2UgIzEwNDIKRnJvbTogYmlsbGluZ0BleGFtcGxlLmNvbQpUbzogYXBAZXhhbXBsZS5jb20KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PSI9PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0iCgotLT09PT09PT09PT09PT09PTMxMjM2Mzc2NzQwNjU1MjEwMDE9PQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9InV0Zi04IgpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CgpQbGVhc2UgZmluZCBhdHRhY2hlZCB0aGUgT2N0b2JlciBsaW5lIGl0ZW1zIENTVi4KCi0tPT09PT09PT09PT09PT09MzEyMzYzNzY3NDA2NTUyMTAwMT09CkNvbnRlbnQtVHlwZTogdGV4dC9jc3YKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJpbnZvaWNlXzEwNDIuY3N2IgpNSU1FLVZlcnNpb246IDEuMAoKYVhSbGJTeHhkSGtzZFc1cGRGOTFjMlFLUTJ4dmRXUWdRMjl0Y0hWMFpTd3lMREV5TGpVd0NsTjFjSEJ2Y25Rc01TdzFNQzR3TUFvPQoKLS09PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0tLQo="
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("shikitoka/doc-archive-unpacker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "files": [{
            "filename": "sample_invoice.eml",
            "base64Content": "U3ViamVjdDogU2FtcGxlIEludm9pY2UgIzEwNDIKRnJvbTogYmlsbGluZ0BleGFtcGxlLmNvbQpUbzogYXBAZXhhbXBsZS5jb20KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PSI9PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0iCgotLT09PT09PT09PT09PT09PTMxMjM2Mzc2NzQwNjU1MjEwMDE9PQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9InV0Zi04IgpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CgpQbGVhc2UgZmluZCBhdHRhY2hlZCB0aGUgT2N0b2JlciBsaW5lIGl0ZW1zIENTVi4KCi0tPT09PT09PT09PT09PT09MzEyMzYzNzY3NDA2NTUyMTAwMT09CkNvbnRlbnQtVHlwZTogdGV4dC9jc3YKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJpbnZvaWNlXzEwNDIuY3N2IgpNSU1FLVZlcnNpb246IDEuMAoKYVhSbGJTeHhkSGtzZFc1cGRGOTFjMlFLUTJ4dmRXUWdRMjl0Y0hWMFpTd3lMREV5TGpVd0NsTjFjSEJ2Y25Rc01TdzFNQzR3TUFvPQoKLS09PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0tLQo=",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("shikitoka/doc-archive-unpacker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "files": [
    {
      "filename": "sample_invoice.eml",
      "base64Content": "U3ViamVjdDogU2FtcGxlIEludm9pY2UgIzEwNDIKRnJvbTogYmlsbGluZ0BleGFtcGxlLmNvbQpUbzogYXBAZXhhbXBsZS5jb20KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiBtdWx0aXBhcnQvbWl4ZWQ7IGJvdW5kYXJ5PSI9PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0iCgotLT09PT09PT09PT09PT09PTMxMjM2Mzc2NzQwNjU1MjEwMDE9PQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9InV0Zi04IgpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0CgpQbGVhc2UgZmluZCBhdHRhY2hlZCB0aGUgT2N0b2JlciBsaW5lIGl0ZW1zIENTVi4KCi0tPT09PT09PT09PT09PT09MzEyMzYzNzY3NDA2NTUyMTAwMT09CkNvbnRlbnQtVHlwZTogdGV4dC9jc3YKQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0CkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJpbnZvaWNlXzEwNDIuY3N2IgpNSU1FLVZlcnNpb246IDEuMAoKYVhSbGJTeHhkSGtzZFc1cGRGOTFjMlFLUTJ4dmRXUWdRMjl0Y0hWMFpTd3lMREV5TGpVd0NsTjFjSEJ2Y25Rc01TdzFNQzR3TUFvPQoKLS09PT09PT09PT09PT09PT0zMTIzNjM3Njc0MDY1NTIxMDAxPT0tLQo="
    }
  ]
}' |
apify call shikitoka/doc-archive-unpacker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,shikitoka/doc-archive-unpacker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8A7VGuahRVGiZ97Zg/builds/V0B4UtRoxZ25bUauZ/openapi.json
