# Get post HTML content using Ghost Content API v3

**URL:** <https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284>\
**Category:** Developer help\
**Created:** [January 10, 2020, 4:59pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284 "2020-01-10T16:59:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MLFromScratch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mlfromscratch/32/2278_2.png) [@MLFromScratch](https://forum.ghost.org/u/MLFromScratch)\
**Post date:** [January 10, 2020, 4:59pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284/1 "2020-01-10T16:59:57Z")

</div>

I was trying to retrieve the HTML for an unpublished post - this should be possible right?

This is my basic query.

`http://mlfromscratch.com/ghost/api/v3/content/posts/<post_id>/?key=<key>`

I tried this on a post that was published, and it works. But I cannot get the HTML for the unpublished post. Is there some other easy way to do this?

**Edit:** The `<key>` is my content API key from an integration I made, and I found the `<post_id>` in Ghost admin in the URL of my post.

The request returns a 404 error:

```
{
    "errors": [
        {
            "message": "Post not found.",
            "errorType": "NotFoundError"
        }
    ]
}
```

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 10, 2020, 5:04pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284/2 "2020-01-10T17:04:30Z")

</div>

@MLFromScratch the Content API is a public API and therefore unpublished posts are not available, otherwise anyone viewing a Content API powered site could read all of your drafts.

What is the use-case for fetching an unpublished post? If this is server-side you can use the Admin API to fetch all posts both published and unpublished.

---

<div class="post-metadata">

**Author:** ![MLFromScratch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mlfromscratch/32/2278_2.png) [@MLFromScratch](https://forum.ghost.org/u/MLFromScratch)\
**Post date:** [January 10, 2020, 5:08pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284/3 "2020-01-10T17:08:58Z")

</div>

I’m making a post on IBM as a contractor - and they basically just need the HTML to publish it. I’m curious if there is a better way to deliver the article to them, than going through the admin API though.

This makes a lot of sense. I was just not aware of the admin API, so I will make a small script to solve this. Thank you for your help Kevin! 🙂

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 10, 2020, 5:19pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284/4 "2020-01-10T17:19:57Z")

</div>

> [@MLFromScratch](#):
>
> I’m curious if there is a better way to deliver the article to them, than going through the content API though.

Hmm, if you wanted to avoid a script there are a couple of options.

1. Open the post preview and copy/paste the relevant html section
2. Have web inspector open when opening a post in the editor, find the network request which loads the post, right-click and choose “Copy as fetch” then switch to the Console tab and paste. Before hitting Enter you’ll want to add the `?formats=html` query param and add `.then(response => response.json()).then(console.log)` to the end of the statement. A little long-winded but saves writing a script or getting admin api credentials for one-off things :)

---

<div class="post-metadata">

**Author:** ![MLFromScratch](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mlfromscratch/32/2278_2.png) [@MLFromScratch](https://forum.ghost.org/u/MLFromScratch)\
**Post date:** [January 10, 2020, 5:40pm UTC](https://forum.ghost.org/t/get-post-html-content-using-ghost-content-api-v3/11284/5 "2020-01-10T17:40:02Z")

</div>

Hi again Kevin, I just got the admin API to work through a Python script.

Do you by chance know if there is an easy way to save the images in the article?
