Setting the correct mime type for a new (plone.app.contenttypes.) Document

I'm creating some initial content for my add-on using plone.app.contenttypes and plone.api.

I'd like to create a Document (page) with some initial HTML. Here is my code:

homepage = api.content.create(
    container=site,
    type='Document',
    text=RichTextValue("""
    <p style="text-align: center; ">
      Some text
    </p>
    """),
    title='WELCOME!',
    format='text/html',
    )

Problem is that it seems that the content type is not correctly set to text/html, so when the user (an Editor) navigates to edit the page, TinyMCE does not fire up, and the Text Format combo-box in the edit form shows "text/x-plone-outputfilters-html" (manually changing to "text/html" makes TinyMCE appear).

What am I doing wrong?

You should explicitly set the mimeType and outputMimeType when you construct the RichTextValue:

RichTextValue("""<p style="text-align: center;">Some text</p>""", mimeType='text/html', outputMimeType='text/x-html-safe')

Since Plone 5 only adds content to site container when using generic setup, it would be nice if you shared your code. ( collective.api.examples ?)