# Admin API - mobiledoc vs. lexical

**URL:** <https://forum.ghost.org/t/admin-api-mobiledoc-vs-lexical/57844>\
**Category:** Integrations & API\
**Created:** [May 29, 2025, 7:20pm UTC](https://forum.ghost.org/t/admin-api-mobiledoc-vs-lexical/57844 "2025-05-29T19:20:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe-blocher](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/joe-blocher/32/27872_2.png) [@joe-blocher](https://forum.ghost.org/u/joe-blocher)\
**Post date:** [May 29, 2025, 7:20pm UTC](https://forum.ghost.org/t/admin-api-mobiledoc-vs-lexical/57844/1 "2025-05-29T19:20:14Z")

</div>

I know, how I can add posts ( Admin API):

```auto
const html = '<h1>Hello World</h1>';

api.posts.add({
    title: 'Migrating to Ghost - HTML card',
    status: "published",
    mobiledoc: JSON.stringify({
        version: '0.3.1',
        markups: [],
        atoms: [],
        cards: [['html', {cardName: 'html', html: html}]],
        sections: [[10, 0]]
    })
})
    .then(response => console.log(response))
    .catch(error => console.error(error));

```

I know that `mobiledoc` is deprecated.

How can I do the same with `lexical`?  
Where can I find docs about `lexical`?

Or can I always use `mobiledoc` because it’s automatically converted to `lexical`?

Thanks  
Joe

---

<div class="post-metadata">

**Author:** ![joe-blocher](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/joe-blocher/32/27872_2.png) [@joe-blocher](https://forum.ghost.org/u/joe-blocher)\
**Post date:** [May 30, 2025, 8:08am UTC](https://forum.ghost.org/t/admin-api-mobiledoc-vs-lexical/57844/2 "2025-05-30T08:08:25Z")

</div>

I have halfway found a solution. I read a post and analyze the lexical value.

Output:

```auto
{
  id: '6838afe34e90655353430384',
  uuid: '36962a24-3e7e-46dd-9561-8ba8a8a42ecb',
  title: 'Migrating to Ghost - HTML card',
  slug: 'html-card',
  mobiledoc: null,
  lexical: '{
  "root": {
    "children": [
      {
        "type": "html",
        "version": 1,
        "html": "<h1>Hello World</h1>",
        "visibility": {
          "web": {
            "nonMember": true,
            "memberSegment": "status:free,status:-free"
          },
          "email": {
            "memberSegment": "status:free,status:-free"
          }
        }
      },
      {
        "children": [],
        "direction": null,
        "format": "",
        "indent": 0,
        "type": "paragraph",
        "version": 1
      }
    ],
    "direction": null,
    "format": "",
    "indent": 0,
    "type": "root",
    "version": 1
  }
}',
comment_id: '6838afe34e90655353430384',
feature_image: null,
...

```
