# Convert HTML into Markdown with the Parse API

Developer guide · By Optiview · Published October 30, 2026

Updated October 31, 2026.

Canonical article: https://optiview.ai/resources/html-to-markdown-api-guide/

Sources checked October 30, 2026.

Already have a page’s HTML? This guide shows your developer how to convert it into Markdown with Parse.

## Key takeaway

Give Parse the HTML your application already has. Check the readable result and processing record before using it in another tool.

HTML contains useful information alongside layout code, menus and other page elements. Markdown can make useful text, headings and links easier for an application to check, store and pass into a later workflow. The format alone does not guarantee better AI answers.

This guide uses [Optiview Parse](https://optiview.ai/products/parse/). It converts caller-supplied HTML and returns Markdown with source and extraction metadata. It does not fetch the identity URL, execute scripts, verify the source’s claims or publish the result.

## 1. Start with HTML you are allowed to process

Use complete HTML that your application is authorized to process. If you only have a public URL, start with [Retrieve](https://optiview.ai/products/retrieve/) instead. A partial fragment, a challenge page or an empty JavaScript shell can fail source review even when a browser displays a useful page.

Keep the original source identity with the HTML. Parse requires an absolute HTTPS identity URL without embedded credentials, custom ports or fragments. Relative links are resolved using that identity; the URL is not fetched and does not prove where the supplied HTML originated.

- HTML source: up to 2,000,000 UTF-8 bytes.
- Encoded JSON request: up to 2,100,000 bytes; escaping can increase its size.
- Prepared Markdown: up to 512,000 UTF-8 bytes.
- Omit service secrets, session cookies and confidential material from the HTML.

## 2. Prepare a request you can safely retry

Create a developer workspace, add credits and issue a service key with the parse scope. Keep that key on your server. Successful Parse processing costs 1 credit; rejected requests and failed jobs consume no credits. [Follow the account and key setup guide](https://optiview.ai/developers/quickstart/).

Save the full HTML in page.html. Save the following as prepare-request.mjs and run node prepare-request.mjs with Node.js22+. It creates parse-request.json without hand-escaping HTML inside a shell command:

```JavaScript
import {readFile, writeFile} from 'node:fs/promises';

const html = await readFile('page.html', 'utf8');
await writeFile('parse-request.json', JSON.stringify({
  html,
  url: 'https://example.com/support'
}));
```

Replace the identity URL with the source you are processing. Save an idempotency key with your logical work item before submission. Use that same key and identical serialized input if the outcome is uncertain.

```curl
curl --request POST https://api.optiview.ai/v1/parse \
  --header "Authorization: Bearer $OPTIVIEW_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: article-parse-example-001" \
  --data @parse-request.json
```

## 3. Check the job status before using the result

The API returns a durable job record, not bare Markdown. Direct requests execute in the original request when capacity permits. A pending response uses HTTP202 and retains a job ID. Poll that ID with the originating service application; do not create another work item just because the first request timed out.

Only status:succeeded with a result provides usable content. A terminal failed job can use HTTP200, so checking the HTTP status alone is insufficient. Read error_code on failed jobs, and use the [error and retry guide](https://optiview.ai/developers/errors/) to distinguish input corrections from temporary conditions.

```curl
curl https://api.optiview.ai/v1/jobs/JOB_ID \
  --header "Authorization: Bearer $OPTIVIEW_API_KEY"
```

Poll at intervals of at least two seconds with a bounded wait. The [JavaScript](https://optiview.ai/developers/javascript/) and [Python](https://optiview.ai/developers/python/) guides include complete examples that handle pending and terminal states.

## 4. Check that important details survived conversion

Compare the returned Markdown with the original HTML on a representative page. Check product names, quantities, prices, restrictions and links. Word count is not a quality measure: preserving a footer matters less than preserving the facts your application needs.

Store result.markdown with the source basis, observation timestamp, payload hash, parser version and source-review record. The decoded source hash identifies the HTML that was processed. It does not certify the origin or freshness of the underlying page.

API result availability ends seven days after job creation. If your application needs the output later, retain it in your own storage under your own access and retention policies. See [Jobs and results](https://optiview.ai/developers/jobs/) for the complete field reference.

## 5. Use the result safely in your application

Treat source text as untrusted data. A page can contain misleading claims or instructions directed at an agent. Do not let retrieved text authorize secret access, tool calls, publication or spending.

For a retrieval-augmented generation application, parsing is one step before your own chunking, indexing, retrieval and answer-generation layers. Test those layers separately. Neither conversion nor a source hash guarantees that a generated answer is correct or that it cites the source.

To make approved business information available through your own website, use [Publish](https://optiview.ai/products/publish/). Parse does not change your website or include its private Narrative Graph.

[Parse API reference](https://optiview.ai/developers/parse/) · [OpenAPI specification](https://optiview.ai/developers/openapi/) · [Pricing](https://optiview.ai/pricing/)
