Accessing Member only or Paid member only post by API

Hi,

I’m unable to access Member Only or Paid Member only post by API. the html tag is showing blank whenever the post is marked as Member Only or Paid Member only. Please see attached screenshot.

I’m accessing content API as below: Can you help please? How to get html tag result for paid post?

http://localhost:3001/ghost/api/v3/content/posts/{postid}/?key={key)&include=tags,authors

1 Like

Hey! This is something I’m currently also struggling with. I’d appreciate it if someone knows how to do this.

Let me know if you’ve figured it out.

Is there a solution yet? I’m currently working on a pay per content module (Post) and wanted to access the paid posts over the API.

I’m thinking of just proxy the content through the module and register it as an paid member. Any thoughts or better solutions?

As a content API key is designed to be public facing, members-only cannot be accessible using the content API. You can use an Admin API key to access members-only posts.

Is there a way to authenticate using the Admin API Key in a simple get request to get the article itself and not only the data of the API?

I found a solution by fetching the paid article html and replacing the content section with the response of the Admin API:

To OP: For having a html field in the response the ?formats=html part in the request url is essential.

api_url = '%s/ghost/api/v3/admin/posts/slug/%s/?formats=html' % (URL, slug)