# Convert a file between formats

`POST /v1/convert/file/type/{from_format}/to/{to_format}`

Converts base64 encoded file content from one format to another, for example JSON to XML or Markdown to PDF. from_format may be auto to detect the source format from the content. to_format and, when from_format is not auto, from_format must be formats listed by the formats endpoint; an unsupported pair answers conversion_failed.

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| from_format | string | yes |  |
| to_format | string | yes |  |

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| content | string | yes | The file content, base64 encoded |
| validate_urls_in_content | boolean | no | Whether to validate URLs in content (default `false`) |
| sanitize_urls_in_outputs | boolean | no | Whether to sanitize unsafe URLs (default `false`) |

## Example request

A request body that works, as JSON.

```json
{
  "content": "bmFtZSxhbW91bnQNCkNvZmZlZSw0DQpUZWEsMg=="
}
```

## Response

The fields inside `data` of a successful response.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| content | string | yes | The converted content |
| from_format | string | yes | Original format |
| to_format | string | yes | Target format |
| unsafe_urls | array of string | no | List of unsafe URLs found in content (if validation was enabled) (default `[]`) |

## Example response

A real answer from the operation, as JSON. The fields in the table above are inside `data`.

```json
{
  "data": {
    "content": "[\n  {\n    \"name\": \"Coffee\",\n    \"amount\": \"4\"\n  },\n  {\n    \"name\": \"Tea\",\n    \"amount\": \"2\"\n  }\n]",
    "from_format": "csv",
    "to_format": "json",
    "unsafe_urls": null
  },
  "errors": null,
  "meta": {
    "request_id": "36bae7d1-ba8a-482e-b8b1-152de4a70b21",
    "timestamp": "2026-10-27T07:19:41.999480Z",
    "version": "2026-03-26"
  },
  "pagination": null
}
```

## Responses

| Status | When it happens |
| --- | --- |
| 200 | Successful Response |
| 400 | The body respects the operation schema, but the use case rejected it. Each problem is one ApiError entry |
| 413 | The request is larger than the request size limit of the API allows |
| 422 | The body does not respect the operation schema. Each problem is one ApiError entry with the code validation_error |
| 500 | Something failed inside the server and was not an input problem. The same envelope, errors may be empty |

---
Source: https://skillfulsardine.com/developers/api/convert-file/