How can I create an entry via API that has rich text field?

Hey, I’m curious, I’m having trouble creating an entry with a rich text field via API, does someone have some documentation or library on how can I convert a WYSIWYG editor content into a rich text format? I’m trying to build a form that allows my users to suggest content that will be pushed as a draft entry into contentful.

Hi Alon,

A good starting point for Rich Text would be

You can of course create some Rich Text document via the Contentful web app and look at the entry’s plain JSON to see how the corresponding Rich Text would look like.


Base on the example here the format is different from the example here. so I am not able to send the payload.

It will be more useful to have an example payload for all the fields available added to the github or for now just paste an example of how the structure for the rich text should be.


1 Like

I found a way to send the data, here is the example for createEntry:

		environment.createEntry('<content_type>', {
			fields: {
				'<field_name>': {
					'<language>': {
                        content: [
                                data: {},
                                content: [
                                        value: "lorem ...",
                                        marks: [],
                                        data: {}
                        data: {},
						nodeType: 'document'

I hope it is helpful.



Thank you Esteban, you’ve been very helpful over the past two years!

Is this possible using the SDKs for java?

We use it like the below:

    val entry: CMAEntry = CMAEntry()
        .setField("slug", "en-US",  "IMPORTTEST")
        .setField("title", "en-US",  "IMPORTTEST")
        .setField("aboutField", "en-US", CMARichText("<p> asdsdfs </p> <h2> adffsdfs </h2>"))   --> This fails. This field needs to be updated as RichTextField

I created this account just so I could thank Estaban! Thank you!