| name | 2md |
| description | Use `2md` by Traylinx โ a data-extraction API that converts any URL, file, or website into clean, AI-ready Markdown. Supports instant URL-prepend, batch, crawl, sitemap, file conversion, and agent skill generation. |
2md โ Agent Instructions
You have access to 2md by Traylinx, a data-extraction API that converts any URL, file, or website into clean Markdown optimized for AI context windows.
HOW TO USE: Make HTTP requests using your own built-in tools (fetch, read_url_content, requests, run_command with curl, or any HTTP capability you have).
Recommended Workflow
When a user asks you to read, extract, or analyze a webpage:
- Single page? โ Use the URL-Prepend GET shortcut (fastest, zero config)
- JavaScript-heavy SPA? โ Add
?method=browser to the URL-Prepend
- Multiple pages? โ Use POST
/api/batch with async mode
- Entire documentation site? โ Use the Crawl Prepend or POST
/api/crawl
- Need a sitemap first? โ Use POST
/api/map to discover pages, then batch convert
1. Instant Convert (GET โ URL-Prepend)
The fastest method. Prepend the 2md URL to any target:
GET https://2md.traylinx.com/https://example.com/any-page
Query Parameters
| Param | Default | Options | Purpose |
|---|
format | markdown | markdown, json | json returns structured data with metadata |
method | auto | auto, native, static, browser | Use browser for JS-heavy SPAs |
force | false | true, false | Bypass cache entirely |
maxAge | โ | seconds (e.g. 3600) | Only serve cached results fresher than N seconds |
Examples
https://2md.traylinx.com/https://example.com/docs?format=json
https://2md.traylinx.com/https://react-app.dev?method=browser&format=json
https://2md.traylinx.com/https://old-page.com?force=true
No API key needed for public web pages.
JSON Response Schema
When using ?format=json, you receive:
{
"success": true,
"url": "https://example.com/docs",
"markdown": "# Page Title\n\nExtracted content...",
"cache": "miss",
"method": "native",
"tokens": { "html": 45000, "md": 3200 },
"metadata": { "title": "Page Title", "description": "..." },
"quality": { "wordCount": 1250 }
}
Error Response
{
"success": false,
"error": "Description of what went wrong"
}
2. Instant Crawl (GET โ URL-Prepend)
Crawl an entire site via GET:
GET https://2md.traylinx.com/crawl/https://docs.example.com?depth=3&maxPages=50
| Param | Default | Purpose |
|---|
depth | 3 | How many link levels deep to crawl |
maxPages | 50 | Maximum number of pages to convert |
email | โ | Email address for completion notification |
webhook_url | โ | URL to POST results to when done |
Returns a job_id for async polling (see Async Jobs below).
3. POST API Endpoints
Base URL: https://2md.traylinx.com
All POST endpoints accept Content-Type: application/json.
POST /api/convert โ Convert a single URL
{
"url": "https://example.com/docs",
"format": "json",
"method": "auto"
}
Optional fields:
| Field | Type | Default | Purpose |
|---|
downloadImages | bool | true | Download and embed images |
frontMatter | bool | true | Include YAML front matter |
screenshot | bool | false | Capture a screenshot of the page |
waitMs | number | 10000 | Wait time for page load (browser method) |
maxImageSizeMb | number | 10 | Max image size to download |
POST /api/batch โ Batch convert multiple URLs
{
"urls": ["https://example.com/1", "https://example.com/2"],
"format": "json",
"async": true
}
POST /api/crawl โ Crawl an entire website
{
"url": "https://example.com",
"format": "json",
"async": true,
"depth": 3,
"maxPages": 50
}
Optional: email (string), webhook_url (string) for completion notifications.
POST /api/map โ Map a website (discover pages without converting)
{
"url": "https://example.com",
"format": "json"
}
Returns a list of discovered URLs. Useful for planning which pages to convert.
POST /api/file2md โ Convert uploaded files
Multipart form upload. Supports: PDF, DOCX, images, audio, video.
POST /api/file2md
Content-Type: multipart/form-data
file=@document.pdf
apiKey=sk-...
format=json
Requires apiKey for media/vision extraction (images, audio, video) โ as a
body field, never a query parameter. With format=json the response body
is prefixed by ~1 KB of whitespace padding (proxy keep-alive): trim before
parsing. The X-Job-Id response header lets you recover a slow result from
GET /api/jobs/{id}/result (send the same x-client-id you posted with).
POST /api/agentify โ Generate AI Skill Bundles
{
"url": "https://docs.example.com",
"format": "json",
"async": true
}
Generates SKILL.md + llms.txt + reference files for injecting documentation knowledge into autonomous agents.
Format Options (all endpoints)
| Format | Content-Type | Description |
|---|
json | application/json | Structured JSON with markdown, metadata, token counts (recommended) |
markdown | text/plain | Raw Markdown text only |
stream | text/plain (chunked) | NDJSON streaming logs with final __JSON__ payload |
Async Jobs
Long-running requests (batch, crawl, agentify) return a job_id.
Poll status: GET https://2md.traylinx.com/api/jobs/{job_id}
Get result: GET https://2md.traylinx.com/api/jobs/{job_id}/result
Poll every 5-10 seconds. The status field will be running, done, or failed.
Important
- Free tier: Unlimited public page conversions, no API key required.
- Media/vision extraction: Requires an API key. Include
apiKey as a field in the POST body (multipart or JSON) โ a ?apiKey=... query parameter is ignored and the request will 401.
- Rate limits: The API uses tiered rate limiting. If you receive a 429 response, wait and retry.
- Full documentation: docs.traylinx.com
- Agent discovery: 2md.traylinx.com/llms.txt and 2md.traylinx.com/agents.json