POST
/api/convert$0.005📄 File Format Converter
Convert files between common formats without any dependencies. Supported conversions: CSV→JSON (parse rows to objects), JSON→CSV (serialize array to CSV), Markdown→HTML (full rendering with links, code blocks, and tables), HTML→text (clean text extraction). Input can be base64-encoded content or a public URL.
Request Body
Response Fields
Code Examples
cURL
bash
# CSV → JSON (base64 encoded input)
curl -X POST https://sparkforge.sh/api/convert \
-H "Content-Type: application/json" \
-H "X-PAYMENT: <x402-payment-token>" \
-d '{
"input": "bmFtZSxhZ2UKQWxpY2UsMzAKQm9iLDI1",
"from": "csv",
"to": "json"
}'
# Markdown → HTML (from URL)
curl -X POST https://sparkforge.sh/api/convert \
-H "Content-Type: application/json" \
-H "X-PAYMENT: <x402-payment-token>" \
-d '{
"input": "https://raw.githubusercontent.com/user/repo/main/README.md",
"from": "markdown",
"to": "html"
}'Python
python
import requests, base64
csv_data = "name,age\nAlice,30\nBob,25"
encoded = base64.b64encode(csv_data.encode()).decode()
response = requests.post(
"https://sparkforge.sh/api/convert",
headers={"Content-Type": "application/json", "X-PAYMENT": "<token>"},
json={"input": encoded, "from": "csv", "to": "json"}
)
data = response.json()
print(data["output"])
# → [{"name": "Alice", "age": "30"}, {"name": "Bob", "age": "25"}]TypeScript / Node.js
typescript
const csvData = "name,age\nAlice,30\nBob,25";
const encoded = Buffer.from(csvData).toString("base64");
const res = await fetch402("https://sparkforge.sh/api/convert", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ input: encoded, from: "csv", to: "json" }),
});
const { output, size } = await res.json();
const rows = JSON.parse(output);Example Response
json
{
"from": "csv",
"to": "json",
"output": "[
{
"name": "Alice",
"age": "30"
},
{
"name": "Bob",
"age": "25"
}
]",
"size": 58
}💳 Payment via x402
This endpoint costs $0.005 per call, paid in USDC on Base, Polygon, or Solana. Use the @x402/fetch library to handle payments automatically, or implement the x402 handshake manually.
bash
# Free demo mode (no payment)
curl https://sparkforge.sh/api/convert?demo=true
# Or try via MCP (Claude Desktop, Cursor, Windsurf)
# Add to mcp config: { "url": "https://sparkforge.sh/api/mcp" }