xtomd API for AI Agents: Free X to Markdown Endpoint
X (formerly Twitter) content is everywhere, but reading it programmatically is broken. When your AI agent tries to fetch a page from x.com, it gets a JavaScript shell with no content. The server returns static HTML that requires rendering to display actual posts, threads, and articles.
That is where the xtomd API comes in. It converts any X post, thread, or article into clean Markdown that any agent can read. No API key, no authentication, no JavaScript rendering required.
The Problem Every Agent Hits
Every AI agent framework runs into the same wall when working with X content:
- Claude Code cannot read x.com URLs directly with
web_fetch - CrewAI agents get blank pages when trying to scrape threads
- LangChain tools fail at X content extraction
- AutoGPT and OpenClaw cannot parse tweets into usable text
The root cause is that X requires JavaScript execution to render content. Your serverless function, CLI tool, or agent runs server-side and gets an empty page. You need a middleman that loads X content, extracts the actual post or article text, and serves it in a format your agent can use.
That is exactly what the xtomd API does.
The API Endpoints
xtomd provides two endpoints. Pick the one that fits your workflow.
POST /api/markdown — Markdown Response (Recommended for Agents)
Endpoint: https://xtomd.com/api/markdown
Request body:
{
"url": "https://x.com/username/status/1234567890"
}
JSON response (default):
{
"markdown": "# Post Title\n\nPost content here...",
"url": "https://x.com/username/status/1234567890",
"author": {
"name": "Username",
"handle": "@username"
}
}
Add the header Accept: text/markdown to get plain Markdown text instead of JSON. This is useful for piping output directly into another tool.
Use /api/markdown when feeding content directly into an LLM. It strips away noise and gives you clean, readable text.
POST /api/fetch — Raw JSON Response
Endpoint: https://xtomd.com/api/fetch
This returns the full structured data including author metadata, engagement metrics (likes, retweets, views, bookmarks), media attachments, quoted tweets, and Draft.js block content for articles. Use it when you need structured data to process rather than just the text.
Quick Test
Copy this and run it in your terminal to test the API:
curl -X POST https://xtomd.com/api/markdown \
-H "Content-Type: application/json" \
-d '{"url": "https://x.com/elonmusk/status/1234567890"}'
Replace the URL with any public X post. You will get back structured JSON with the Markdown content.
Integration Examples
Claude Code (One-Liner)
Claude Code can fetch X content using curl inside a bash tool call:
curl -s -X POST https://xtomd.com/api/markdown \
-H "Content-Type: application/json" \
-H "Accept: text/markdown" \
-d '{"url":"https://x.com/username/status/1234567890"}'
Or use the MCP server for native integration. Install globally and add it to your Claude Code config:
npm install -g @xtomd/mcp-server
Then in your Claude Code MCP config:
{
"mcpServers": {
"xtomd": {
"command": "xtomd-mcp"
}
}
}
Python (Works with CrewAI, LangChain, AutoGPT)
import requests
def fetch_x_content(url):
response = requests.post(
"https://xtomd.com/api/markdown",
json={"url": url}
)
return response.json()["markdown"]
# Use it
content = fetch_x_content("https://x.com/username/status/1234567890")
print(content)
For CrewAI, wrap this in a tool decorator:
from crewai.tools import tool
@tool("Fetch X Content")
def fetch_x_thread(url: str) -> str:
"""Fetches an X post or thread and returns it as Markdown."""
response = requests.post(
"https://xtomd.com/api/markdown",
json={"url": url}
)
return response.json()["markdown"]
Node.js
async function fetchXContent(url) {
const response = await fetch("https://xtomd.com/api/markdown", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({url})
});
const data = await response.json();
return data.markdown;
}
const content = await fetchXContent("https://x.com/username/status/1234567890");
console.log(content);
OpenClaw
When the bird CLI in OpenClaw fails to fetch X content (which happens frequently because X blocks server-side requests), use xtomd as a fallback. An OpenClaw skill is available that automatically detects X URLs and routes them through the xtomd API.
CLI Tool (npx)
For quick one-off conversions from your terminal:
npx @xtomd/cli https://x.com/username/status/1234567890
This prints clean Markdown to stdout. Add --json for JSON output. Pipe it anywhere.
API Response Schema
/api/markdown Response
| Field | Type | Description |
|---|---|---|
markdown | string | Content formatted as Markdown |
url | string | The X post URL |
author.name | string | Author's display name |
author.handle | string | Author's @handle |
/api/fetch Response
| Field | Type | Description |
|---|---|---|
url | string | The X post URL |
author | object | Author name, handle, avatar, description |
text | string | Full text content of the post |
article | object | Article data with Draft.js blocks (for X Articles) |
media | array | Images, videos, and embedded content |
likes | number | Like count at fetch time |
retweets | number | Repost count |
views | number | View count |
quoteTweet | object | Quoted tweet data (if present) |
Rate Limits and Fair Use
- No API key required — the API is completely open
- No rate limiting currently — but be respectful of the service
- Results cached for 5 minutes — repeated requests for the same URL return instantly
- Self-hosting available — if you need high-volume access, xtomd is open source and can be deployed on your own Cloudflare Workers account
The endpoint is designed for production use. It handles thousands of requests daily. If you are building something that needs massive scale, check the GitHub repo and self-host.
Frequently Asked Questions
Is the xtomd API free?
Yes. Both /api/fetch and /api/markdown are completely free with no quotas, rate limits, or authentication required.
Do I need an API key?
No. Just send a POST request to the endpoint with the X URL in the request body. No API key, no signup, no authentication.
What X content types are supported?
Single posts, threads, X Articles (long-form), quoted tweets, and media (images and videos). Anything publicly visible on X works.
Can I use the xtomd API with Claude Code?
Yes. Claude Code can call the API using curl or the @xtomd/mcp-server package for native MCP integration. Both methods return clean Markdown that Claude can process directly.
Why can't AI agents read X URLs directly?
X requires JavaScript execution to render content. Server-side agents, CLI tools, and API calls receive an empty HTML shell with no actual content. xtomd solves this by extracting the content and serving it as Markdown.
Can I self-host xtomd?
Yes. The source is on GitHub. You can deploy it to your own Cloudflare Workers account or any server infrastructure. This is useful for guaranteed uptime or high-volume workloads.
Try the xtomd API Now
Paste any X URL and get clean Markdown in seconds. No signup, no API key.
Open xtomd.com