SliceMD

POST /v1/extract

A public URL or raw HTML becomes clean Markdown and an exact token count.

SliceMD is a stateless HTTP API. Send a public webpage or raw HTML. The response is clean Markdown, article metadata, and a token count from gpt-tokenizer using the o200k_base encoding (GPT-4o and GPT-5).

Access is through RapidAPI. OpenAPI spec

  • SSRF checks before every fetch
  • HTML capped at 1,000,000 characters
  • 30 requests/minute, batch 5/minute

https://api.slicemd.com/v1/extract

The request, and what comes back.

POST JSON. Content-Type is application/json. The customer headers are X-RapidAPI-Key and X-RapidAPI-Host.

Request
POST /v1/extract
Host: YOUR_RAPIDAPI_HOST
content-type: application/json
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: YOUR_RAPIDAPI_HOST

{
  "html": "<!doctype html><html><head><title>Hello</title></head><body><article><h1>Hello</h1><p>A short article for SliceMD.</p></article></body></html>",
  "include_links": true,
  "include_images": false,
  "max_tokens": 500
}
Response
{
  "success": true,
  "url": null,
  "metadata": {
    "title": "Hello",
    "description": "A short article for SliceMD.",
    "author": null,
    "site_name": null,
    "published_date": null,
    "language": null
  },
  "markdown": "# Hello\n\nA short article for SliceMD.",
  "stats": {
    "char_count": 37,
    "word_count": 6,
    "estimated_tokens": 10,
    "processing_time_ms": 4,
    "cached": false,
    "cached_at": null
  }
}
Example of the response shape.

stats.estimated_tokens is the exact o200k_base count. stats.cached_at is when a cached copy was stored, or null on a fresh fetch.

One URL or raw HTML

Fetch, extract, count.

01

Send a URL or HTML

Post JSON to /v1/extract. Provide url or html. When html is present, SliceMD uses it and does not fetch.

02

Get Markdown and metadata

The response includes the article as clean Markdown, plus article metadata. include_links defaults to true. include_images defaults to false.

03

Read the token count

stats.estimated_tokens is the exact o200k_base count. max_tokens, when set, cuts the Markdown on a paragraph or word boundary.

What you get back

Markdown, metadata, an exact count, and batch.

Clean Markdown

A public page, or HTML you already have, comes back as article Markdown. include_links defaults to true. include_images defaults to false. Links keep only http, https, and mailto. Images, when you include them, may also keep data URIs.

Article metadata

Article metadata is returned with the Markdown, so a pipeline can label what it stored.

Exact token count

Counts use gpt-tokenizer with the o200k_base encoding, the same encoding as GPT-4o and GPT-5. stats.estimated_tokens is that exact count. The field name says estimated. The count is exact.

Batch, isolated per URL

POST /v1/extract/batch takes up to 10 URLs. Each fetch is isolated, with an 8 second timeout and its own success or error. A valid payload always returns 200. Every item includes index and input_url. A failure also includes the status the single-URL endpoint would have returned.

RAG, agents, content tools

Where the count matters.

RAG pipelines

Turn a public article, or HTML you already hold, into Markdown you can split and embed. The count uses o200k_base, so you can compare it with a GPT-4o or GPT-5 context limit you choose.

Agents

Pass a URL, or HTML the agent already holds, and read the article as Markdown. The token count is in o200k_base, the encoding those models use.

Content tools

Build a summary, a quote, or a check from a URL or from HTML. Images stay out unless you set include_images. Links stay in unless you turn them off.

Before you call it

Questions before you integrate.

What do I send to /v1/extract?

Provide url or html. A url is an absolute http or https URL, at most 2,048 characters. When html is present, SliceMD uses it and does not fetch. include_links defaults to true. include_images defaults to false. max_tokens is optional. Unknown fields are rejected with 400, so a misspelled key does not silently do nothing.

Is stats.estimated_tokens exact?

Yes. It is the exact count from gpt-tokenizer using the o200k_base encoding, the encoding used by GPT-4o and GPT-5. The name of the field says estimated. The number is the exact count. max_tokens, when set, cuts the Markdown on a paragraph or word boundary.

How does cache_ttl work?

URL fetches are cached for one hour by default. cache_ttl is seconds, from 0 to 3600. It sets both how long a fresh fetch is stored and the oldest cached copy this request will accept. 0 skips the cache. URLs with a query string are not cached. cache_ttl is ignored for raw HTML. stats.cached_at is when the cached copy was stored, or null on a fresh fetch.

What does /v1/extract/batch return?

Send up to 10 URLs, with the same options as a single extract. When the payload is valid, the HTTP status is always 200. Each URL has an 8 second timeout and its own success or error object. Every item includes index and input_url. A failure also includes the status the single-URL endpoint would have returned. Batch calls are limited to 5 per minute.

What limits apply?

30 requests per minute. Batch calls are also limited to 5 per minute, because each one can fetch up to 10 URLs. A 429 response includes a Retry-After header, in seconds. HTML is capped at 1,000,000 characters. URLs are capped at 2,048 characters.

Does SliceMD execute JavaScript?

No. SliceMD fetches the public URL over HTTP and converts the HTML response, or converts the raw HTML you post. It does not run a browser, and it does not execute page scripts. If the article is only inserted by JavaScript, send the HTML you already have.

How do customers authenticate, and which fetches are refused?

Customers call through RapidAPI and send X-RapidAPI-Key and X-RapidAPI-Host. This page does not collect a key. A rejected credential returns 401. Before a fetch, SliceMD rejects non-HTTP(S) URLs, URLs with embedded credentials, local and internal hosts, and non-public addresses. Redirects are checked again. HTML you post is not fetched, and it is still size-capped.

Start with the reference.

Request fields, error codes, and the batch shape are in the docs. The OpenAPI document is the machine-readable contract.

Access is through RapidAPI. OpenAPI spec