---
title: "Convert a file to Markdown"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Convert a file to Markdown

Path: CloudRaker Paperwork API › Tools

`POST /v1/files/{ref}/convert/markdown`

Returns the file as Markdown text.

`{ref}` is the file id or the file name.

When the file was already parsed, this serves the Markdown that parsing produced and costs nothing extra. Otherwise the bytes are converted on the spot — the answer is the same either way.

The result is text, not a new file: nothing is stored, and nothing is charged to your corpus.

**Learn more:** [Working with files](https://docs.cloudraker.com/paperwork/developers/files)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `ref` (`convertFileToMarkdown.path.ref`; string, required)
  - minLength 1

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/files/<ref>/convert/markdown' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/files/<ref>/convert/markdown';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/files/<ref>/convert/markdown"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
```

## Responses

### 200

The Markdown.

#### Example

```json
{
  "object": "conversion",
  "format": "markdown",
  "fileId": "string",
  "markdown": "string"
}
```

- `object` (`convertFileToMarkdown.response.200.object`; string, required)
- `format` (`convertFileToMarkdown.response.200.format`; string, required)
- `fileId` (`convertFileToMarkdown.response.200.fileId`; string, required)
- `markdown` (`convertFileToMarkdown.response.200.markdown`; string, required)

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`convertFileToMarkdown.response.400.success`; boolean, required)
  - one of `false`
- `error` (`convertFileToMarkdown.response.400.error`; array<unknown>, required)
- `data` (`convertFileToMarkdown.response.400.data`; unknown, required)

### 404

Unknown file.

### 409

Ambiguous name, or the bytes have not landed yet.

### 422

The file could not be converted.

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`convertFileToMarkdown.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`convertFileToMarkdown.response.429.message`; string, required)
- `retryable` (`convertFileToMarkdown.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`convertFileToMarkdown.response.429.requestId`; string, required)
- `docUrl` (`convertFileToMarkdown.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/tools/convert-file-to-markdown/index.md
