# Transform API reference: HTML to markdown | Spider

Convert raw HTML into markdown, plain text or XML with the Transform API. Process content you already have without re-fetching the page.

Canonical: https://spider.cloud/docs/api/transform/

POST /transform

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

Endpoint Parameters (5)

| Name                   | Type    | Default | Description                                                                                                                                                            |
| ---------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data required          | object  |         | A list of html data to transform. Each object takes the keys `html` (or `content`), `url` and `lang`. The url and lang keys are optional.                              |
| return_format optional | string  | raw     | The format to return the data in. Possible values are `markdown`, `commonmark`, `text`, `xml`, and `raw`. Send one string. Use `raw` to return the HTML as it came in. |
| readability optional   | 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_full optional    | boolean | false   | Currently does the same as `clean`.                                                                                                                                    |
| clean optional         | boolean | false   | Remove scripts, styles, comments, hidden elements, iframes and ad or tracking elements.                                                                                |

## Request samples

cURL

```
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"}]}'
```

Python

```
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())
```

Node.js

```
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();
```
