Transform API reference
Convert content you already have into a different format without making another web request. Send raw HTML and get back markdown, plain text, or XML. Useful when you have cached pages, downloaded archives, or want to re-process content in a pipeline.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| datarequired | object | A list of html data to transform. Each object takes the keys | |
| return_formatoptional | string | raw | The format to return the data in. Possible values are |
| readabilityoptional | boolean | false | Extract the main content of the page, the way a reader mode does, before converting. This may drastically improve the content for LLM usage. |
| clean_fulloptional | boolean | false | Currently does the same as |
| cleanoptional | boolean | false | Remove scripts, styles, comments, hidden elements, iframes and ad or tracking elements. |
Request samples
curl 'https://api.spider.cloud/transform' \
-H "Authorization: Bearer $SPIDER_API_KEY" \
-H 'Content-Type: application/json' \
-d'{"return_format":"markdown","data":[{"html":"<h1>Weekly notes</h1><p>Two things changed.</p><ul><li>Faster search</li><li>Table exports</li></ul>","url":"https://example.com/notes"}]}'import requests, os
headers = {
'Authorization': f'Bearer {os.getenv("SPIDER_API_KEY")}',
'Content-Type': 'application/json',
}
json_data = {"return_format":"markdown","data":[{"html":"<h1>Weekly notes</h1><p>Two things changed.</p><ul><li>Faster search</li><li>Table exports</li></ul>","url":"https://example.com/notes"}]}
response = requests.post('https://api.spider.cloud/transform',
headers=headers, json=json_data)
print(response.json())import https from 'https';
const options = {
hostname: 'api.spider.cloud',
port: 443,
path: '/transform',
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SPIDER_API_KEY}`,
'Content-Type': 'application/json'
}
};
const req = https.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({"return_format":"markdown","data":[{"html":"<h1>Weekly notes</h1><p>Two things changed.</p><ul><li>Faster search</li><li>Table exports</li></ul>","url":"https://example.com/notes"}]}));
req.end();