Magic CMS Content Format Conversion API

Leverage our intimate expertise in CMS content formats in your workflow!

Seamless Content Workflow

Effortlessly convert your content between formats to fit any CMS or platform.

JSON Blocks to/from HTML/Markdown

Transform structured JSON from modern editors like Editor.js into clean HTML or Markdown. Ideal for headless CMS setups and dynamic content rendering.

Markdown to/from HTML

Quickly convert your Markdown documents into rich HTML for your websites and blogs. Perfect for developers and content creators who prefer writing in Markdown. Easily convert existing HTML content back to Markdown for easier editing, version control, or to standardize your content creation process.

Available as a standalone API

If you are a Magic CMS Content paid subscriber, format conversion API is already included in your plan. This is available as a standalone product as well due to popular demand to use this API in content integration pipelines.

HTML to/from WordPress Blocks

Convert plain html to/from WordPress Gutenberg blocks, allowing you to use your WordPress content on other platforms or for custom rendering with full fidelity. If you have a large wordpress installation you can very easily automate your old html content to Gutenberg blocks either on the exiting installation or during migration.

API Documentation

Integrate our powerful content conversion API into your applications.

Server

https://api.magicquill.ai

Endpoint

POST /magic-cms/content/convert

Input Parameters

Parameter Type Description
source_format string The format of the source content. Supported values: `markdown`, `html`, `json_blocks`, `wordpress_blocks`. `json_blocks` is an Editor.js-compliant content block format for granular control of the editor contents.
target_format string The desired output format. Supported values: `markdown`, `html`, `json_blocks`, `wordpress_blocks`.
content string The content to be converted.

Output Format

The API returns a JSON object with the converted content.


{
  "converted_content": "..."
}
            

Code Samples

PHP (Laravel HTTP Client)


use Illuminate\Support\Facades\Http;

$response = Http::withHeaders([
    'Authorization' => 'Bearer YOUR_API_KEY',
    'Accept' => 'application/json',
])->post('https://api.magicquill.ai/magic-cms/content/convert', [
    'source_format' => 'markdown',
    'target_format' => 'html',
    'content' => '**Hello World**',
]);

$convertedContent = $response->json('converted_content');
                        

Node.js (axios)


const axios = require('axios');

async function convertContent() {
  try {
    const response = await axios.post('https://api.magicquill.ai/magic-cms/content/convert', {
      source_format: 'html',
      target_format: 'markdown',
      content: '<h1>Hello World</h1>',
    }, {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Accept': 'application/json',
      },
    });

    const convertedContent = response.data.converted_content;
    console.log(convertedContent);
  } catch (error) {
    console.error(error);
  }
}

convertContent();
                        

Go


package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	apiUrl := "https://api.magicquill.ai/magic-cms/content/convert"
	apiKey := "YOUR_API_KEY"

	data := map[string]string{
		"source_format": "markdown",
		"target_format": "html",
		"content":       "# Hello World",
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		fmt.Println(err)
		return
	}

	req, err := http.NewRequest("POST", apiUrl, bytes.NewBuffer(jsonData))
	if err != nil {
		fmt.Println(err)
		return
	}

	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Accept", "application/json")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	var result map[string]interface{}
	json.Unmarshal(body, &result)

	fmt.Println(result["converted_content"])
}
                        

Java (OkHttp)


import okhttp3.*;
import org.json.JSONObject;

import java.io.IOException;

public class ContentConverter {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();

        String json = new JSONObject()
                .put("source_format", "html")
                .put("target_format", "markdown")
                .put("content", "<h1>Hello World</h1>")
                .toString();

        RequestBody body = RequestBody.create(json, MediaType.get("application/json; charset=utf-8"));

        Request request = new Request.Builder()
                .url("https://api.magicquill.ai/magic-cms/content/convert")
                .header("Authorization", "Bearer YOUR_API_KEY")
                .header("Accept", "application/json")
                .post(body)
                .build();

        try (Response response = client.newCall(request).execute()) {
            if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);

            JSONObject responseBody = new JSONObject(response.body().string());
            System.out.println(responseBody.getString("converted_content"));
        }
    }
}
                        

No contracts. Cancel anytime.

Save 20%

Pro Plan

$19 .99 |  Month
$239.88.88 billed annually
  • 60,000 conversions / month
  • One easy REST endpoint
Purchase Plan

Business Plan

$59 .99 |  Month
$719.88 billed annually
  • 240,000 conversions / month
  • One easy REST endpoint
Purchase Plan

Enterprise Plan

$159 .99 |  Month
$1919.88 billed annually
  • 1,200,000 conversions / month
  • One easy REST endpoint
Purchase Plan