# ContextPack — Discontinued (`cris_araujo/contextpack-html-to-context`) Actor

DISCONTINUED: project closed on 2026-10-21. Do not start paid runs. Latest build is disabled. Monetization cancellation takes effect on 2026-11-04; removal is pending Apify notice requirements.

- **URL**: https://apify.com/cris_araujo/contextpack-html-to-context.md
- **Developed by:** [Cristian Araujo](https://apify.com/cris_araujo) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 prepared documents

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## ContextPack — HTML to Markdown and source-linked chunks

Prepare authorized HTML for a support agent, knowledge base or product-guide workflow. Get Markdown, bounded chunks, heading paths, SHA-256 hashes and source ranges in one dataset row per document. No model API key or remote crawling.

### HTML to Markdown API for RAG and support agents

Already have HTML you are allowed to process? Convert support pages, product guides or knowledge-base exports into Markdown and source-linked chunks without operating a server. This Actor does not fetch URLs or run a model. If Markdown alone is enough, a free converter may meet your needs; the paid utility here is bounded extraction, chunk metadata, budget-aware execution and Dataset delivery in one Apify workflow.

### Start with one document

1. Select **Try for free / Use Actor** to open Apify Console. Your account balance and Apify's credit rules apply; this is a monetized Actor.
2. Paste one document into `documents`. Keep memory at 256 MiB, timeout 30 seconds and maximum run cost USD0.05. That budget permits two successful documents, not a twenty-document batch.
3. Start once. One delivered document costs USD0.02005 including the start event.
4. Read the run status and `RUN_SUMMARY`, then open **Output / Storage → Dataset → Export → JSON**. The output is a JSON array with one row per delivered document. JSON preserves nested chunk metadata.
5. If a timeout leaves the result uncertain, check the existing run before retrying. Do not automatically resubmit a paid job.

Developer identity verification was confirmed by Apify on 17 October 2026. The live Pricing tab is authoritative. No uptime or support response-time agreement is offered.

### What is included

- Markdown preserving headings, basic lists, links, code and simple tables.
- Chunks of 400–4,000 UTF-16 code units (default 1,200), with source metadata.
- Exact-duplicate chunk markers without deleting content.
- Explicit warnings for scoped extraction, split blocks and complex table spans.

Supply `documents` (1–20), each with `id`, `html`, and optional `source_url`. The source URL is only caller-supplied metadata. The Actor never requests it. Use only content you are entitled to process. Do not include credentials or personal data.

```json
{"documents":[{"id":"guide","html":"<h1>Guide</h1><p>Authorized content.</p>","source_url":"https://example.com/guide"}],"options":{"max_chunk_chars":1200,"remove_navigation":true,"include_links":true}}
```

### Limits

128 KiB of UTF-8 HTML per document, 1 MiB total; 20 documents; 256 MiB memory; process watchdog 30 seconds. HTML depth 120, node count 15,000, table size 256 rows × 32 columns; 512 chunks and 1 MiB generated output per document. An invalid top-level input ends the run. Per-document extraction errors are recorded in `RUN_SUMMARY` and are not billable.

### Pricing and predictable budgets

**USD0.02 per successfully delivered HTML document**, plus **USD0.00005 per Actor run** at the required 256MiB. Event names: `document-prepared` and automatic `apify-actor-start`. Platform usage is included. There is no extra default-Dataset-item charge. An invalid input or empty result does not create a document event, but the small start event can still apply.

Examples: one delivered document = USD0.02005; two = USD0.04005; twenty = USD0.40005. The minimum allowed run budget is USD0.03, which is budget capacity, not a minimum charge. The initial default budget of USD0.05 permits two successful documents; use USD0.41 if you intend to process twenty. The Actor stops when the next document cannot fit the remaining budget. Inspect `RUN_SUMMARY.budget_limited` for partial fulfillment; do not automatically retry uncertain paid jobs.

The same document price applies across available tiers. Apify Free users can use their finite platform credits under Apify's rules; these runs do not earn developer revenue. No trial, coupon or owner run is a verified external sale. No model, proxy, crawling or third-party API expense is incurred by this Actor.

### Integration

Use this public Actor through Apify's HTTP API, official SDK or MCP search/call tools. Actor ID: `9c6k8uQ2TUVAMv0kX`, name `cris_araujo/contextpack-html-to-context`. The synchronous dataset API returns the rows. `RUN_SUMMARY` reports per-document errors, partial fulfillment, resumed items, actual platform event prices and event debits. It never labels a run as a verified sale. Download the default Dataset as JSON for the nested chunk metadata; CSV is available through Apify but is less convenient for nested arrays.

Authentication, balance checks, event charging and delivery run on Apify. Source/output content is held in the calling run's Apify storages under its platform retention and permissions. This package does not send content to another provider.

### Reliability and limitations

No browser, PDF, OCR, model inference, fact verification, copyright verification or prompt-injection filtering. Treat all input/output as untrusted data. The source HTML range points to a containing element, not an exact inverse map. CSS/JavaScript rendering is not supported. Complex layouts need review.

On restart, existing delivered document IDs and source hashes are skipped. This reduces duplicate delivery; it is not a guarantee of exactly-once charging across platform crashes. Reconcile exceptional runs with platform event and dataset records. Do not automatically resubmit a paid job after an uncertain timeout.

### Programmatic quick start

Use your own Apify token in your local environment; never paste it into a chat or URL. Example using the official HTTP API and a single authorized document:

```bash
curl --fail-with-body -X POST \
 'https://api.apify.com/v2/acts/9c6k8uQ2TUVAMv0kX/run-sync-get-dataset-items?memory=256&timeout=30&maxTotalChargeUsd=0.05' \
 -H "Authorization: Bearer $APIFY_TOKEN" \
 -H 'Content-Type: application/json' \
 --data '{"documents":[{"id":"guide","source_url":"https://example.com/guide","html":"<main><h1>Guide</h1><p>Authorized content.</p></main>"}]}' \
 -o contextpack-result.json
```

The JSON array contains delivered rows. Each has `markdown`, `source_sha256`, `chunks` (with `text`, `heading_path`, `markdown_range`, `source_html_range`, hashes), warnings and stats. Use the run's Output/Storage tabs or API run output to read `RUN_SUMMARY`; an HTTP timeout does not prove that the run stopped.

### Why use this instead of a free converter?

Use a free converter if Markdown alone is enough. This small service combines bounded extraction, chunking, provenance fields, budget-aware delivery and an Apify API/Dataset workflow without running your own server. It does not claim exclusive extraction technology or improved model accuracy.

### Example delivered output

Excerpt from our own synthetic cloud QA, not a customer result or sale. An original input `<main><h1>Atlas desk lamp 1</h1><p>Power: 8 W. Warranty: 2 years.</p></main>` produced:

```json
{"id":"owner-qa-20261017-1","status":"ok","markdown":"# Atlas desk lamp 1\n\nPower: 8 W. Warranty: 2 years.","source_sha256":"e7ea717801af42c9d5e7e632e0586d8280fa720ff1d8325887a3466bde080c10","stats":{"input_bytes":76,"markdown_chars":51,"chunks":2,"duplicate_chunks":0}}
```

The full row also contains two chunks with heading paths, UTF-16 Markdown ranges, containing-element HTML ranges, chunk hashes and a `CONTENT_SCOPE` warning. Output does not prove the source is true, licensed or safe to follow.

# Actor input Schema

## `documents` (type: `array`):

1–20 documents, each with html; id and source_url are optional. 128 KiB HTML each, 1 MiB total. Source URLs are never fetched. Successful documents are charged even if later documents fail.

## `options` (type: `object`):

max_chunk_chars (400–4000), remove_navigation (boolean), include_links (boolean).

## Actor input object example

```json
{
  "documents": [
    {
      "id": "guide",
      "html": "<h1>Guide</h1><p>Authorized example content.</p>",
      "source_url": "https://example.com/guide"
    }
  ],
  "options": {
    "max_chunk_chars": 1200,
    "remove_navigation": true,
    "include_links": true
  }
}
```

# Actor output Schema

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

One Dataset row per successfully delivered document, with Markdown, chunks, ranges, hashes and warnings.

## `summary` (type: `string`):

Delivery counts, errors and budget information. Event debits do not establish cash revenue.

# 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 = {
    "documents": [
        {
            "id": "guide",
            "html": "<h1>Guide</h1><p>Authorized example content.</p>",
            "source_url": "https://example.com/guide"
        }
    ],
    "options": {
        "max_chunk_chars": 1200,
        "remove_navigation": true,
        "include_links": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("cris_araujo/contextpack-html-to-context").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 = {
    "documents": [{
            "id": "guide",
            "html": "<h1>Guide</h1><p>Authorized example content.</p>",
            "source_url": "https://example.com/guide",
        }],
    "options": {
        "max_chunk_chars": 1200,
        "remove_navigation": True,
        "include_links": True,
    },
}

# Run the Actor and wait for it to finish
run = client.actor("cris_araujo/contextpack-html-to-context").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 '{
  "documents": [
    {
      "id": "guide",
      "html": "<h1>Guide</h1><p>Authorized example content.</p>",
      "source_url": "https://example.com/guide"
    }
  ],
  "options": {
    "max_chunk_chars": 1200,
    "remove_navigation": true,
    "include_links": true
  }
}' |
apify call cris_araujo/contextpack-html-to-context --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cris_araujo/contextpack-html-to-context"
        }
    }
}
```

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/9c6k8uQ2TUVAMv0kX/builds/OSBaHOO80EDCOT9r7/openapi.json
