WebInk Developer API
Official WebInk API documentation and developer resources. Convert web pages to Markdown with our REST API and integrate WebInk into your applications.
Which surface to call
The API converts one public URL. GET /api/markdown?url=… returns JSON when the client sends Accept: application/json, and the Markdown body alone when Accept is text/markdown or is not a JSON Accept header. POST /api/markdown accepts the same URL plus an optional template string or a small set of transform options: heading style, horizontal rule, bullet marker, code block style, emphasis delimiter, fence, and strong delimiter. Sending both a template and those options applies the template first and then replaces that text with a fresh conversion of the HTML, so the wrapper is discarded. Callers who need a custom fence and front matter should convert first and wrap the body themselves.
That fetch does not include the visitor’s cookies. A login wall, a localhost docs host, or a private-network address is not an API target. Open the tab and use the extension. The same public-page job, with a preview before you script it, is the URL to Markdown tool. The Webpage to Markdown guide is the map of the three choices: a public URL, pasted HTML, or the open tab.
The HTML to Markdown feature describes the extension after the article is in hand: Markdown style, templates, copy, and a ZIP of images for that one note. The online file tools for a PDF, a Word file, CSV, or JSON do not call this API. Do not point a client at /api/markdown for a file the browser can convert locally. Responses that succeed advertise a public cache of two hours, with stale-while-revalidate of one day, and they vary on Accept. A tight content hash should pin one converter and one day rather than assume the next response is byte-identical.
LLM-Friendly Content Transformation
Transform web content into LLM-friendly formats, enabling seamless interactions with websites, documentation, and knowledge bases.
Website Interaction
Easily convert web pages into a format that LLMs can understand and process, facilitating more accurate and context-aware interactions with website content.
Documentation Processing
Transform complex documentation into structured Markdown, making it simpler for LLMs to analyze and provide insights or answers based on the documentation.
Knowledge Base Integration
Convert knowledge base articles into LLM-compatible formats, enhancing the ability of AI models to leverage existing knowledge repositories.
API Usage
Convert Web Page to Markdown
Use our API to convert any web page to Markdown format
curl https://webink.app/api/markdown?url=https://example.comWebInk API Documentation
Introduction
The WebInk API provides a powerful solution for converting web content to Markdown format with customizable output. Whether you're building a content aggregation application or creating a personal knowledge base, the WebInk API offers robust support for your needs.
API Overview
- The API supports both GET and POST request methods.
- It uses content negotiation to determine the format of the returned data.
- You can specify the desired response type by setting the
Acceptheader.
Supported Accept Types
application/json: Returns the complete MarkdownContenttext/markdown: Returns only the Markdown text
If the Accept header is missing, or does not include application/json, the response is the Markdown body alone.
MarkdownContent Structure
export interface MarkdownContent {
url: string
title: string
content: string
markdown: string
length?: number
excerpt?: string
byline?: string
dir?: string
siteName?: string
lang?: string
publishedTime?: string
}
API Endpoints
GET /api/markdown
Use this endpoint for simple requests without additional options.
Retrieve Complete MarkdownContent:
curl -H "Accept: application/json" "https://webink.app/api/markdown?url=https://example.com"
Retrieve Markdown Only:
curl -H "Accept: text/markdown" "https://webink.app/api/markdown?url=https://example.com"
POST /api/markdown
Use this endpoint when you need to specify templates or transformation options.
Request Headers
Accept: application/jsonorAccept: text/markdownContent-Type: application/json
Request Body Parameters
url: Required, the URL of the webpage to converttemplate: Optional, a template string for customizing the output formattransformOptions: Optional, for customizing Markdown conversion options. If a request sends bothtemplateandtransformOptions, the template is applied and then replaced by a fresh conversion, so the wrapper is discarded.
Example: Retrieve Content Using a Template
curl -X POST https://webink.app/api/markdown \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"template": "{{title}} - {{url}}"
}'
Example: Request with Transformation Options
curl -X POST https://webink.app/api/markdown \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"transformOptions": {
"headingStyle": "atx",
"bulletListMarker": "-"
}
}'
Supported transformOptions
headingStyle: Heading style, either 'setext' or 'atx'hr: Markdown representation of horizontal rulesbulletListMarker: Unordered list marker, either '-', '*', or '+'codeBlockStyle: Code block style, either 'indented' or 'fenced'emDelimiter: Emphasis delimiter, either '_' or '*'fence: Code block fence charactersstrongDelimiter: Strong emphasis delimiter, either '**' or '__'
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests:
- 200 OK: Successful request
- 400 Bad Request: Invalid request body
- 404 Not Found: Content cannot be retrieved
- 405 Method Not Allowed: Unsupported HTTP method
Additional Information
- The markdown route runs on the Node.js runtime.
- Successful responses send
Cache-Control: public, max-age=7200, stale-while-revalidate=86400andVary: Accept. Fresh cache is two hours. A stale response may be reused for one day.
Conclusion
The WebInk API offers a flexible and powerful way to convert web content to Markdown. By supporting both GET and POST methods, along with customizable templates and transformation options, it caters to a wide range of use cases and integration scenarios.